summaryrefslogtreecommitdiff
path: root/Layout/LayoutDemoSampling.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Layout/LayoutDemoSampling.cpp')
-rw-r--r--Layout/LayoutDemoSampling.cpp60
1 files changed, 51 insertions, 9 deletions
diff --git a/Layout/LayoutDemoSampling.cpp b/Layout/LayoutDemoSampling.cpp
index 14a4cf7..990e1e4 100644
--- a/Layout/LayoutDemoSampling.cpp
+++ b/Layout/LayoutDemoSampling.cpp
@@ -54,11 +54,9 @@ void LayoutDemoSampling::updateCountdown(uint32_t seconds) {
char buf[32];
size_t size;
- memset(buf, 0, sizeof(buf));
- // for some reason, there's a % character that gets displayed in the last column
- // add the extra spaces to wipe it out
- writeField(_fInfo, "No Free Channel ", true);
- size = snprintf(buf, sizeof(buf), "%lu s ", seconds);
+ // make sure the string version is used
+ writeField(_fInfo, string("No Free Channel"), true);
+ size = snprintf(buf, sizeof(buf), "%lu s", seconds);
writeField(_fSw2, buf, size, true);
}
@@ -66,10 +64,6 @@ void LayoutDemoSampling::updateInterval(uint32_t seconds) {
char buf[32];
size_t size;
- memset(buf, ' ', sizeof(buf));
- writeField(_fInfo, buf, size, true);
-
- memset(buf, 0, sizeof(buf));
if (seconds < 60)
size = snprintf(buf, sizeof(buf), "Interval %lu s", seconds);
else if (seconds < 60 * 60)
@@ -80,3 +74,51 @@ void LayoutDemoSampling::updateInterval(uint32_t seconds) {
writeField(_fInfo, buf, size, true);
}
+void LayoutDemoSampling::updateAccelerationX(int16_t x) {
+ char buf[16];
+ size_t size;
+ size = snprintf(buf, sizeof(buf), "%d", x);
+ writeField(_fAccx, buf, size, true);
+}
+
+void LayoutDemoSampling::updateAccelerationY(int16_t y) {
+ char buf[16];
+ size_t size;
+ size = snprintf(buf, sizeof(buf), "%d", y);
+ writeField(_fAccy, buf, size, true);
+}
+
+void LayoutDemoSampling::updateAccelerationZ(int16_t z) {
+ char buf[16];
+ size_t size;
+ size = snprintf(buf, sizeof(buf), "%d", z);
+ writeField(_fAccz, buf, size, true);
+}
+
+void LayoutDemoSampling::updatePressure(float pressure) {
+ char buf[16];
+ size_t size;
+ size = snprintf(buf, sizeof(buf), "%3.2f KPa", pressure/1000);
+ writeField(_fPres, buf, size, true);
+}
+
+void LayoutDemoSampling::updateAltitude(float altitude) {
+ char buf[16];
+ size_t size;
+ size = snprintf(buf, sizeof(buf), "%5.2f m", altitude);
+ writeField(_fAlt, buf, size, true);
+}
+
+void LayoutDemoSampling::updateTemperature(float temperature) {
+ char buf[16];
+ size_t size;
+ size = snprintf(buf, sizeof(buf), "%3.2f C", temperature);
+ writeField(_fTemp, buf, size, true);
+}
+
+void LayoutDemoSampling::updateLight(float light) {
+ char buf[16];
+ size_t size;
+ size = snprintf(buf, sizeof(buf), "%4.2f lux", light);
+ writeField(_fLight, buf, size, true);
+}