summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2016-09-14 11:01:44 -0500
committerJason Reiss <jreiss@multitech.com>2016-09-14 11:01:44 -0500
commit6efd824f3d18ba8985cbc87f629f5e737495c054 (patch)
tree5448db65ea84f56c2551ec3efd74d64daacdd6d9 /main.cpp
parent54270b95f3fe169948ef551c49204defcda4033b (diff)
parent768951bf1beb7a368b1a94b71a95c832d1f2fcc6 (diff)
downloadmtdot-box-evb-factory-firmware-6efd824f3d18ba8985cbc87f629f5e737495c054.tar.gz
mtdot-box-evb-factory-firmware-6efd824f3d18ba8985cbc87f629f5e737495c054.tar.bz2
mtdot-box-evb-factory-firmware-6efd824f3d18ba8985cbc87f629f5e737495c054.zip
Merge branch 'mts-lora' into Semtech
Conflicts: main.cpp
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/main.cpp b/main.cpp
index 48b3552..4810095 100644
--- a/main.cpp
+++ b/main.cpp
@@ -46,6 +46,9 @@
#include "FileName.h"
#include <string>
+#define DISABLE_DUTY_CYCLE true
+
+
// LCD and LED controllers
SPI lcd_spi(SPI1_MOSI, SPI1_MISO, SPI1_SCK);
I2C led_i2c(I2C_SDA, I2C_SCL);
@@ -61,7 +64,7 @@ osThreadId main_id;
ButtonHandler* buttons;
// LoRa controller
-LoRaHandler* lora;
+LoRaHandler* loraHandler;
mDot* dot;
// GPS
@@ -83,14 +86,13 @@ ModeSemtech* modeSemtech;
Serial debug(USBTX, USBRX);
// Survey Data File
-char* file_name;
+char file_name[] = "SurveyData.txt";
// Prototypes
void mainMenu();
int main() {
debug.baud(115200);
- file_name = "SurveyData.txt";
lcd = new DOGS102(lcd_spi, lcd_spi_cs, lcd_cd);
// NCP5623B::LEDs 1 & 2 are the screen backlight - not used on default build
@@ -100,7 +102,13 @@ int main() {
main_id = Thread::gettid();
buttons = new ButtonHandler(main_id);
dot = mDot::getInstance();
- lora = new LoRaHandler(main_id);
+
+ dot->setDisableDutyCycle(DISABLE_DUTY_CYCLE);
+
+ // Seed the RNG
+ srand(dot->getRadioRandom());
+
+ loraHandler = new LoRaHandler(main_id);
gps = new GPSPARSER(&gps_serial, led_cont);
sensors = new SensorHandler();
@@ -108,12 +116,13 @@ int main() {
MTSLog::setLogLevel(MTSLog::TRACE_LEVEL);
- modeJoin = new ModeJoin(lcd, buttons, dot, lora, gps, sensors);
- modeSingle = new ModeSingle(lcd, buttons, dot, lora, gps, sensors);
- modeSweep = new ModeSweep(lcd, buttons, dot, lora, gps, sensors);
- modeDemo = new ModeDemo(lcd, buttons, dot, lora, gps, sensors);
- modeConfig = new ModeConfig(lcd, buttons, dot, lora, gps, sensors);
- modeSemtech = new ModeSemtech(lcd, buttons, dot, lora, gps, sensors);
+
+ modeJoin = new ModeJoin(lcd, buttons, dot, loraHandler, gps, sensors);
+ modeSingle = new ModeSingle(lcd, buttons, dot, loraHandler, gps, sensors);
+ modeSweep = new ModeSweep(lcd, buttons, dot, loraHandler, gps, sensors);
+ modeDemo = new ModeDemo(lcd, buttons, dot, loraHandler, gps, sensors);
+ modeConfig = new ModeConfig(lcd, buttons, dot, loraHandler, gps, sensors);
+ modeSemtech = new ModeSemtech(lcd, buttons, dot, loraHandler, gps, sensors);
osDelay(1000);
logInfo("%sGPS detected", gps->gpsDetected() ? "" : "no ");
@@ -165,7 +174,7 @@ void mainMenu() {
// reset session between modes
dot->resetNetworkSession();
- lora->resetActivityLed();
+ loraHandler->resetActivityLed();
LayoutScrollSelect menu(lcd, items, product, menu_strings[0]);
menu.display();