From c80cdb2f3f7b9b23fde37406572cff6895c3bd95 Mon Sep 17 00:00:00 2001 From: Mike Fiore Date: Wed, 6 Jan 2016 13:39:51 -0600 Subject: add back button to Interval and Trigger modes in LoRa demo so we don't have to exit back to main menu to switch --- Mode/ModeDemo.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'Mode') diff --git a/Mode/ModeDemo.cpp b/Mode/ModeDemo.cpp index 3fc7961..0c4ffa2 100644 --- a/Mode/ModeDemo.cpp +++ b/Mode/ModeDemo.cpp @@ -44,10 +44,16 @@ bool ModeDemo::start() { _state = sampling; _mode = trigger; _sam.display(); - _sam.updateSw2("Send"); + _sam.updateSw1(" Send"); + _sam.updateSw2("Back"); break; case sampling: - if (_mode == interval) { + if (_mode == trigger) { + if (_dot->getNextTxMs() > 0) + no_channel = true; + else + send = true; + } else { _interval = (_interval + 1) % (sizeof(_intervals) / sizeof(uint32_t)); _sam.updateInterval(_intervals[_interval]); } @@ -63,15 +69,14 @@ bool ModeDemo::start() { _send_timer.start(); _sam.display(); _sam.updateSw1("Interval"); + _sam.updateSw2("Back"); _sam.updateInterval(_intervals[_interval]); break; case sampling: - if (_mode == trigger) { - if (_dot->getNextTxMs() > 0) - no_channel = true; - else - send = true; - } + _send_timer.stop(); + _send_timer.reset(); + _state = show_help; + displayHelp(); break; } break; @@ -89,12 +94,13 @@ bool ModeDemo::start() { switch (_state) { case sampling: if (_mode == trigger) { - _sam.updateSw2("Send"); + _sam.updateSw1(" Send"); _sam.updateInfo(" "); } else { _sam.updateSw1("Interval"); _sam.updateInterval(_intervals[_interval]); } + _sam.updateSw2("Back"); break; } break; @@ -103,12 +109,13 @@ bool ModeDemo::start() { switch (_state) { case sampling: if (_mode == trigger) { - _sam.updateSw2("Send"); + _sam.updateSw1(" Send"); _sam.updateInfo(" "); } else { _sam.updateSw1("Interval"); _sam.updateInterval(_intervals[_interval]); } + _sam.updateSw2("Back"); break; } break; -- cgit v1.2.3 From 08de8463fed95e38b260d23ad4e54b5fb71cd43c Mon Sep 17 00:00:00 2001 From: Mike Fiore Date: Wed, 6 Jan 2016 14:23:55 -0600 Subject: remove 1 hour interval in demo mode b/c mbed timers can only count up to ~35 minutes --- Mode/ModeDemo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Mode') diff --git a/Mode/ModeDemo.cpp b/Mode/ModeDemo.cpp index 0c4ffa2..d1dc793 100644 --- a/Mode/ModeDemo.cpp +++ b/Mode/ModeDemo.cpp @@ -2,7 +2,7 @@ #include "MTSLog.h" // 10 s, 30 s, 1 min, 5 min, 10 min, 15 min, 30 min 1 hour -const uint32_t ModeDemo::_intervals[] = { 10, 30, 60, 5 * 60, 10 * 60, 15 * 60, 30 * 60, 60 * 60 }; +const uint32_t ModeDemo::_intervals[] = { 10, 30, 60, 5 * 60, 10 * 60, 15 * 60, 30 * 60 }; ModeDemo::ModeDemo(DOGS102* lcd, ButtonHandler* buttons, mDot* dot, LoRaHandler* lora, GPSPARSER* gps, SensorHandler* sensors) : Mode(lcd, buttons, dot, lora, gps, sensors), -- cgit v1.2.3