From e1736be283e3da3df63e9d29c9382c076e59f80e Mon Sep 17 00:00:00 2001 From: Mike Fiore Date: Mon, 23 Nov 2015 13:42:33 -0600 Subject: clean up after config, get things building again, update default configuration to match spec --- Mode/ModeConfig.cpp | 67 +++++++++++++++++++++++------------------------------ Mode/ModeConfig.h | 19 +++------------ 2 files changed, 32 insertions(+), 54 deletions(-) (limited to 'Mode') diff --git a/Mode/ModeConfig.cpp b/Mode/ModeConfig.cpp index 2d24716..6075897 100644 --- a/Mode/ModeConfig.cpp +++ b/Mode/ModeConfig.cpp @@ -15,53 +15,44 @@ const char ModeConfig::command_error[] = "Command not found!\r\n"; const char ModeConfig::done[] = "\r\nOK\r\n"; const char ModeConfig::error[] = "\r\nERROR\r\n"; -mts::MTSSerial* ModeConfig::_serialp = NULL; - void ModeConfig::addCommand(Command* cmd) { _commands.push_back(cmd); } -ModeConfig::ModeConfig(DOGS102* lcd, mts::MTSSerial& serial, mDot* dot, ButtonHandler* buttons) -: Mode(lcd, buttons), +ModeConfig::ModeConfig(DOGS102* lcd, ButtonHandler* buttons, mDot* dot, LoRaHandler* lora) +: Mode(lcd, buttons, dot, lora), _lc(lcd), - _serial(serial), - _dot(dot), - _mode(mDot::COMMAND_MODE), - _idle_thread(idle, NULL, osPriorityLow), - _serial_up(false), - _buttons(buttons) { - - _serialp = &serial; + _serial(USBTX, USBRX, 512, 512) +{ addCommand(new CmdAttention(_dot)); - addCommand(new CmdIdentification(_dot, serial)); + addCommand(new CmdIdentification(_dot, _serial)); addCommand(new CmdFactoryDefault(_dot)); addCommand(new CmdSaveConfig(_dot)); - addCommand(new CmdDisplayConfig(_dot, serial)); - - addCommand(new CmdFrequencyBand(_dot, serial)); - addCommand(new CmdFrequencySubBand(_dot, serial)); - addCommand(new CmdPublicNetwork(_dot, serial)); - addCommand(new CmdDeviceId(_dot, serial)); - - addCommand(new CmdNetworkAddress(_dot, serial)); - addCommand(new CmdNetworkSessionKey(_dot, serial)); - addCommand(new CmdDataSessionKey(_dot, serial)); - addCommand(new CmdNetworkKey(_dot, serial)); - addCommand(new CmdNetworkId(_dot, serial)); - - addCommand(new CmdNetworkJoinMode(_dot, serial)); - addCommand(new CmdTxDataRate(_dot, serial)); - addCommand(new CmdTxPower(_dot, serial)); - - addCommand(new CmdMinimumSize(_dot, serial)); - addCommand(new CmdMaximumSize(_dot, serial)); - addCommand(new CmdMinimumPower(_dot, serial)); - addCommand(new CmdMaximumPower(_dot, serial)); - addCommand(new CmdData(_dot, serial)); - addCommand(new CmdGetSurveyDataFile(_dot, serial)); - addCommand(new CmdDeleteSurveyDataFile(_dot, serial)); - + addCommand(new CmdDisplayConfig(_dot, _serial)); + + addCommand(new CmdFrequencyBand(_dot, _serial)); + addCommand(new CmdFrequencySubBand(_dot, _serial)); + addCommand(new CmdPublicNetwork(_dot, _serial)); + addCommand(new CmdDeviceId(_dot, _serial)); + + addCommand(new CmdNetworkAddress(_dot, _serial)); + addCommand(new CmdNetworkSessionKey(_dot, _serial)); + addCommand(new CmdDataSessionKey(_dot, _serial)); + addCommand(new CmdNetworkKey(_dot, _serial)); + addCommand(new CmdNetworkId(_dot, _serial)); + + addCommand(new CmdNetworkJoinMode(_dot, _serial)); + addCommand(new CmdTxDataRate(_dot, _serial)); + addCommand(new CmdTxPower(_dot, _serial)); + + addCommand(new CmdMinimumSize(_dot, _serial)); + addCommand(new CmdMaximumSize(_dot, _serial)); + addCommand(new CmdMinimumPower(_dot, _serial)); + addCommand(new CmdMaximumPower(_dot, _serial)); + addCommand(new CmdData(_dot, _serial)); + addCommand(new CmdGetSurveyDataFile(_dot, _serial)); + addCommand(new CmdDeleteSurveyDataFile(_dot, _serial)); } void ModeConfig::printHelp() { diff --git a/Mode/ModeConfig.h b/Mode/ModeConfig.h index ade3093..1192a8c 100644 --- a/Mode/ModeConfig.h +++ b/Mode/ModeConfig.h @@ -13,7 +13,7 @@ class ModeConfig : public Mode { public: - ModeConfig(DOGS102* lcd, mts::MTSSerial& serial, mDot* dot, ButtonHandler* buttons); + ModeConfig(DOGS102* lcd, ButtonHandler* buttons, mDot* dot, LoRaHandler* lora); // Command error text... static const char command_error[]; @@ -27,22 +27,9 @@ public: private: - static void idle(void const* args) { - while (1) - __WFI(); - } - - mts::MTSSerial& _serial; - static mts::MTSSerial* _serialp; - - LayoutConfig _lc; - ButtonHandler::ButtonEvent _be; - ButtonHandler* _buttons; - mDot* _dot; - mDot::Mode _mode; + mts::MTSSerial _serial; + LayoutConfig _lc; std::vector _commands; - Thread _idle_thread; - bool _serial_up; void addCommand(Command* cmd); -- cgit v1.2.3