summaryrefslogtreecommitdiff
path: root/Layout
diff options
context:
space:
mode:
authorLeon Lindenfelser <llindenfelser@multitech.com>2015-12-09 15:57:07 -0600
committerLeon Lindenfelser <llindenfelser@multitech.com>2015-12-09 15:57:07 -0600
commit96b7412369c44c3cc7608859c19161073cd114da (patch)
tree3ab007d9093f7ad2045f688760e37cfa00c87ccd /Layout
parent01988b37d50f8e5fefd2d21aea8102683c6917a1 (diff)
downloadmtdot-box-evb-factory-firmware-96b7412369c44c3cc7608859c19161073cd114da.tar.gz
mtdot-box-evb-factory-firmware-96b7412369c44c3cc7608859c19161073cd114da.tar.bz2
mtdot-box-evb-factory-firmware-96b7412369c44c3cc7608859c19161073cd114da.zip
Display sensor data on demo screen.
Diffstat (limited to 'Layout')
-rw-r--r--Layout/LayoutDemoSampling.cpp48
-rw-r--r--Layout/LayoutDemoSampling.h8
2 files changed, 56 insertions, 0 deletions
diff --git a/Layout/LayoutDemoSampling.cpp b/Layout/LayoutDemoSampling.cpp
index c88acee..52c1493 100644
--- a/Layout/LayoutDemoSampling.cpp
+++ b/Layout/LayoutDemoSampling.cpp
@@ -80,3 +80,51 @@ void LayoutDemoSampling::updateInterval(uint32_t seconds) {
writeField(_fInfo, buf, size, true);
}
+void LayoutDemoSampling::updateAccelerationX(uint16_t x) {
+ char buf[16];
+ memset(buf, ' ', sizeof(buf));
+ snprintf(buf, sizeof(buf), "%d", x);
+ writeField(_fAccx, buf, true);
+}
+
+void LayoutDemoSampling::updateAccelerationY(uint16_t y) {
+ char buf[16];
+ memset(buf, ' ', sizeof(buf));
+ snprintf(buf, sizeof(buf), "%d", y);
+ writeField(_fAccy, buf, true);
+}
+
+void LayoutDemoSampling::updateAccelerationZ(uint16_t z) {
+ char buf[16];
+ memset(buf, ' ', sizeof(buf));
+ snprintf(buf, sizeof(buf), "%d", z);
+ writeField(_fAccz, buf, true);
+}
+
+void LayoutDemoSampling::updatePressure(float pressure) {
+ char buf[16];
+ memset(buf, ' ', sizeof(buf));
+ snprintf(buf, sizeof(buf), "%3.2f KPa", pressure/1000);
+ writeField(_fPres, buf, true);
+}
+
+void LayoutDemoSampling::updateAltitude(float altitude) {
+ char buf[16];
+ memset(buf, ' ', sizeof(buf));
+ snprintf(buf, sizeof(buf), "%5.2f m", altitude);
+ writeField(_fAlt, buf, true);
+}
+
+void LayoutDemoSampling::updateTemperature(float temperature) {
+ char buf[16];
+ memset(buf, ' ', sizeof(buf));
+ snprintf(buf, sizeof(buf), "%3.2f C", temperature);
+ writeField(_fTemp, buf, true);
+}
+
+void LayoutDemoSampling::updateLight(float light) {
+ char buf[16];
+ memset(buf, ' ', sizeof(buf));
+ snprintf(buf, sizeof(buf), "%4.2f lux", light);
+ writeField(_fLight, buf, true);
+}
diff --git a/Layout/LayoutDemoSampling.h b/Layout/LayoutDemoSampling.h
index 9d075b2..f3faceb 100644
--- a/Layout/LayoutDemoSampling.h
+++ b/Layout/LayoutDemoSampling.h
@@ -2,6 +2,7 @@
#define __LAYOUTDEMOSAMPLING_H__
#include "Layout.h"
+#include "MMA845x.h"
class LayoutDemoSampling : public Layout {
public:
@@ -14,6 +15,13 @@ class LayoutDemoSampling : public Layout {
void updateSw2(std::string sw2);
void updateCountdown(uint32_t seconds);
void updateInterval(uint32_t seconds);
+ void updateAccelerationX(uint16_t x);
+ void updateAccelerationY(uint16_t y);
+ void updateAccelerationZ(uint16_t z);
+ void updatePressure(float pressure);
+ void updateAltitude(float altitude);
+ void updateTemperature(float temperature);
+ void updateLight(float light);
private:
Label _lAccx;