From a683f4689264f85953c246ac15492bad25974197 Mon Sep 17 00:00:00 2001 From: Mike Fiore Date: Thu, 19 Nov 2015 09:16:44 -0600 Subject: use a single layout for help screens as they're basically all the same, misc tweaks and fixes --- Mode/Mode.cpp | 2 ++ Mode/Mode.h | 1 + Mode/ModeJoin.cpp | 30 +++++++++++++++--------------- Mode/ModeJoin.h | 2 +- 4 files changed, 19 insertions(+), 16 deletions(-) (limited to 'Mode') diff --git a/Mode/Mode.cpp b/Mode/Mode.cpp index eea6d3c..29b16ca 100644 --- a/Mode/Mode.cpp +++ b/Mode/Mode.cpp @@ -1,5 +1,7 @@ #include "Mode.h" +const char* Mode::_file_name = "SurveyData.txt"; + Mode::Mode(DOGS102* lcd, ButtonHandler* buttons) : _lcd(lcd), _buttons(buttons), diff --git a/Mode/Mode.h b/Mode/Mode.h index 1254a9e..ac5d839 100644 --- a/Mode/Mode.h +++ b/Mode/Mode.h @@ -42,6 +42,7 @@ class Mode { ButtonHandler* _buttons; uint32_t _index; osThreadId _main_id; + static const char* _file_name; }; #endif diff --git a/Mode/ModeJoin.cpp b/Mode/ModeJoin.cpp index acdd407..492f669 100644 --- a/Mode/ModeJoin.cpp +++ b/Mode/ModeJoin.cpp @@ -4,7 +4,7 @@ ModeJoin::ModeJoin(DOGS102* lcd, ButtonHandler* buttons, mDot* dot, LoRaHandler* lora, uint8_t band) : Mode(lcd, buttons), - _lj(lcd, band), + _join(lcd, band), _dot(dot), _lora(lora), _band(band), @@ -22,22 +22,22 @@ bool ModeJoin::start() { _joined = false; _index = 1; - _lj.display(); - _lj.updateStatus("Joining..."); + _join.display(); + _join.updateStatus("Joining..."); if (_dot->getJoinMode() == mDot::MANUAL) { - _lj.updateId(mts::Text::bin2hexString(_dot->getNetworkId())); - _lj.updateKey(mts::Text::bin2hexString(_dot->getNetworkKey())); + _join.updateId(mts::Text::bin2hexString(_dot->getNetworkId())); + _join.updateKey(mts::Text::bin2hexString(_dot->getNetworkKey())); } else { - _lj.updateId(_dot->getNetworkName()); - _lj.updateKey(_dot->getNetworkPassphrase()); + _join.updateId(_dot->getNetworkName()); + _join.updateKey(_dot->getNetworkPassphrase()); } if (_band == mDot::FB_915) { _sub_band = _dot->getFrequencySubBand(); - _lj.updateFsb(_sub_band); + _join.updateFsb(_sub_band); } // mDot::DataRateStr returns format SF_XX - we only want to display the XX part - _lj.updateRate(_dot->DataRateStr(_data_rate).substr(3)); - _lj.updatePower(_power); + _join.updateRate(_dot->DataRateStr(_data_rate).substr(3)); + _join.updatePower(_power); _lora->setDataRate(_data_rate); _lora->setPower(_power); @@ -45,10 +45,10 @@ bool ModeJoin::start() { while (! _joined) { _next_tx = _lora->getNextTx(); if (_next_tx) { - _lj.updateCountdown(_next_tx * 1000); + _join.updateCountdown(_next_tx * 1000); } else { - _lj.updateAttempt(_index++); - _lj.updateStatus("Joining..."); + _join.updateAttempt(_index++); + _join.updateStatus("Joining..."); _lora->join(); } @@ -69,8 +69,8 @@ bool ModeJoin::start() { _ls = _lora->getStatus(); switch (_ls) { case LoRaHandler::join_success: - _lj.updateStatus("Join Success!"); - _lj.displayCancel(false); + _join.updateStatus("Join Success!"); + _join.displayCancel(false); logInfo("joined"); _joined = true; osDelay(2000); diff --git a/Mode/ModeJoin.h b/Mode/ModeJoin.h index 5b88e25..6669ad4 100644 --- a/Mode/ModeJoin.h +++ b/Mode/ModeJoin.h @@ -14,7 +14,7 @@ class ModeJoin : public Mode { bool start(); private: - LayoutJoin _lj; + LayoutJoin _join; mDot* _dot; LoRaHandler* _lora; uint8_t _band; -- cgit v1.2.3