summaryrefslogtreecommitdiff
path: root/Mode
diff options
context:
space:
mode:
authorLeon Lindenfelser <llindenfelser@multitech.com>2015-12-03 16:32:43 -0600
committerLeon Lindenfelser <llindenfelser@multitech.com>2015-12-03 16:32:43 -0600
commit965622efb5fa3bcb4a1c42aa55a5eda101b99370 (patch)
treeaf86490324858f10f642a486dcd6a4ea5a4ffef3 /Mode
parente0116023a927495c8cfa9249925157228efe3fa9 (diff)
downloadmtdot-box-evb-factory-firmware-965622efb5fa3bcb4a1c42aa55a5eda101b99370.tar.gz
mtdot-box-evb-factory-firmware-965622efb5fa3bcb4a1c42aa55a5eda101b99370.tar.bz2
mtdot-box-evb-factory-firmware-965622efb5fa3bcb4a1c42aa55a5eda101b99370.zip
Added update sensor function.
Cleaned up sensorhandler so it compiles and hopefully works.
Diffstat (limited to 'Mode')
-rw-r--r--Mode/Mode.cpp10
-rw-r--r--Mode/Mode.h3
2 files changed, 12 insertions, 1 deletions
diff --git a/Mode/Mode.cpp b/Mode/Mode.cpp
index 73292dc..059ddb3 100644
--- a/Mode/Mode.cpp
+++ b/Mode/Mode.cpp
@@ -36,7 +36,8 @@ Mode::Mode(DOGS102* lcd, ButtonHandler* buttons, mDot* dot, LoRaHandler* lora)
_next_tx(0),
_send_data(false),
_gpsUART(PA_2, PA_3),
- _mdot_gps(&_gpsUART)
+ _mdot_gps(&_gpsUART),
+ _mdot_sensors()
{}
Mode::~Mode() {}
@@ -152,6 +153,13 @@ void Mode::updateData(DataItem& data, DataType type, bool status) {
data.power = _power;
}
+void Mode::updateSensors(SensorItem& data) {
+ data.accel_data = _mdot_sensors.getAcceleration();
+ data.baro_data = _mdot_sensors.getBarometer();
+ data.lux_data = _mdot_sensors.getLight();
+ data.pressure = _mdot_sensors.getPressure();
+}
+
uint32_t Mode::getIndex(DataType type) {
uint32_t index = 0;
mDot::mdot_file file;
diff --git a/Mode/Mode.h b/Mode/Mode.h
index 5d41ed1..d97dfb1 100644
--- a/Mode/Mode.h
+++ b/Mode/Mode.h
@@ -9,6 +9,7 @@
#include "ISL29011.h"
#include "MMA845x.h"
#include "MPL3115A2.h"
+#include "SensorHandler.h"
class Mode {
public:
@@ -47,6 +48,7 @@ class Mode {
bool deleteDataFile();
bool appendDataFile(const DataItem& data);
void updateData(DataItem& data, DataType type, bool status);
+ void updateSensors(SensorItem& data);
uint32_t getIndex(DataType type);
std::vector<uint8_t> formatSurveyData(DataItem& data);
@@ -71,6 +73,7 @@ class Mode {
bool _send_data;
mts::MTSSerial _gpsUART;
GPSPARSER _mdot_gps;
+ SensorHandler _mdot_sensors;
};
#endif