summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2015-12-10 09:11:07 -0600
committerMike Fiore <mfiore@multitech.com>2015-12-10 09:11:07 -0600
commita2e7ad209ca28b69e88c96c1def2a63d1581be6c (patch)
tree8b29c3d3379a67ff6e1633460599420a48ee3e4e
parentcef0e023623fd814f04c4fb68d7bf21d5433fb18 (diff)
downloadmtdot-box-evb-factory-firmware-a2e7ad209ca28b69e88c96c1def2a63d1581be6c.tar.gz
mtdot-box-evb-factory-firmware-a2e7ad209ca28b69e88c96c1def2a63d1581be6c.tar.bz2
mtdot-box-evb-factory-firmware-a2e7ad209ca28b69e88c96c1def2a63d1581be6c.zip
explicitly set data rate and power in Demo mode
-rw-r--r--Mode/Mode.cpp48
-rw-r--r--Mode/ModeDemo.cpp4
2 files changed, 28 insertions, 24 deletions
diff --git a/Mode/Mode.cpp b/Mode/Mode.cpp
index 30a96e3..32f67ad 100644
--- a/Mode/Mode.cpp
+++ b/Mode/Mode.cpp
@@ -266,16 +266,16 @@ std::vector<uint8_t> Mode::formatSurveyData(DataItem& data) {
satfix = (_gps->getNumSatellites() << 4 ) | (_gps->getFixStatus() & 0x0F );
send_data.push_back(satfix);
- if (_gps->getLockStatus()){ // if gps has a lock
+ if (_gps->getLockStatus()){ // if gps has a lock
// Send GPS data if GPS device locked
- send_data.push_back(0x15); // key for GPS Latitude
+ send_data.push_back(0x15); // key for GPS Latitude
send_data.push_back(data.gps_latitude.degrees);
send_data.push_back(data.gps_latitude.minutes);
convertS.f_s = data.gps_latitude.seconds;
send_data.push_back(convertS.t_u[1]);
send_data.push_back(convertS.t_u[0]);
- send_data.push_back(0x16); // key for GPS Longitude
+ send_data.push_back(0x16); // key for GPS Longitude
convertS.f_s = data.gps_longitude.degrees;
send_data.push_back(convertS.t_u[1]);
send_data.push_back(convertS.t_u[0]);
@@ -294,27 +294,27 @@ std::vector<uint8_t> Mode::formatSurveyData(DataItem& data) {
std::vector<uint8_t> Mode::formatSensorData(SensorItem& data) {
std::vector<uint8_t> send_data;
- send_data.clear();
- send_data.push_back(0x0E); // key for Current Acceleration 3-Axis Value
- convertS.f_s = data.accel_data._x *4; // shift data 2 bits while retaining sign
- send_data.push_back(convertS.t_u[1]); // get 8 MSB of 14 bit value
- convertS.f_s = data.accel_data._y * 4; // shift data 2 bits while retaining sign
- send_data.push_back(convertS.t_u[1]); // get 8 MSB of 14 bit value
- convertS.f_s = data.accel_data._z * 4; // shift data 2 bits while retaining sign
- send_data.push_back(convertS.t_u[1]); // get 8 MSB of 14 bit value
- send_data.push_back(0x08); // key for Current Pressure Value
- convertL.f_u = data.pressure_raw; // pressure data is 20 bits unsigned
- send_data.push_back(convertL.t_u[2]);
- send_data.push_back(convertL.t_u[1]);
- send_data.push_back(convertL.t_u[0]);
- send_data.push_back(0x05); // key for Current Ambient Light Value
- convertS.f_u = data.lux_data_raw; // data is 16 bits unsigned
- send_data.push_back(convertS.t_u[1]);
- send_data.push_back(convertS.t_u[0]);
- send_data.push_back(0x0B); // key for Current Temperature Value
- convertS.f_s = data.baro_data._temp; // temperature is signed 12 bit
- send_data.push_back(convertS.t_u[1]);
- send_data.push_back(convertS.t_u[0]);
+ send_data.clear();
+ send_data.push_back(0x0E); // key for Current Acceleration 3-Axis Value
+ convertS.f_s = data.accel_data._x *4; // shift data 2 bits while retaining sign
+ send_data.push_back(convertS.t_u[1]); // get 8 MSB of 14 bit value
+ convertS.f_s = data.accel_data._y * 4; // shift data 2 bits while retaining sign
+ send_data.push_back(convertS.t_u[1]); // get 8 MSB of 14 bit value
+ convertS.f_s = data.accel_data._z * 4; // shift data 2 bits while retaining sign
+ send_data.push_back(convertS.t_u[1]); // get 8 MSB of 14 bit value
+ send_data.push_back(0x08); // key for Current Pressure Value
+ convertL.f_u = data.pressure_raw; // pressure data is 20 bits unsigned
+ send_data.push_back(convertL.t_u[2]);
+ send_data.push_back(convertL.t_u[1]);
+ send_data.push_back(convertL.t_u[0]);
+ send_data.push_back(0x05); // key for Current Ambient Light Value
+ convertS.f_u = data.lux_data_raw; // data is 16 bits unsigned
+ send_data.push_back(convertS.t_u[1]);
+ send_data.push_back(convertS.t_u[0]);
+ send_data.push_back(0x0B); // key for Current Temperature Value
+ convertS.f_s = data.baro_data._temp; // temperature is signed 12 bit
+ send_data.push_back(convertS.t_u[1]);
+ send_data.push_back(convertS.t_u[0]);
return send_data;
}
diff --git a/Mode/ModeDemo.cpp b/Mode/ModeDemo.cpp
index 8448de8..f9ea69d 100644
--- a/Mode/ModeDemo.cpp
+++ b/Mode/ModeDemo.cpp
@@ -20,6 +20,10 @@ bool ModeDemo::start() {
// clear any stale signals
osSignalClear(_main_id, buttonSignal | loraSignal);
+ // set spreading factor and power
+ _dot->setTxDataRate(mDot::SF_9);
+ _dot->setTxPower(20);
+
_state = show_help;
displayHelp();