diff --git a/Resources.h b/Resources.h index c9c251e..891800c 100644 --- a/Resources.h +++ b/Resources.h @@ -55,6 +55,11 @@ const uint8_t STATE_20_MSG_2_KEY = 39; const uint8_t STATE_20_MSG_3_KEY = 40; const uint8_t STATE_20_MSG_4_KEY = 41; const uint8_t COLON_SPACE_KEY = 42; +const uint8_t CMDSERVER_HELP_KEY = 43; +const uint8_t CMDSERVER_CMD_NOT_FOUND_KEY = 44; +const uint8_t THERMCONFIG_HELP_KEY = 45; +const uint8_t THERMVALUES_HELP_KEY = 46; +const uint8_t THERMCALIBRATE_HELP_KEY = 47; /* @@ -102,6 +107,11 @@ const String TEXT_RESOURCES[] = { "Calibration stopped", "Save calibration factor for channel ", ": ", + "HELP List this help for all commands", + "command not found", + "Thermometer configuration operations", + "Show thermometer measurement values", + "Thermometer calibration operations", }; */ diff --git a/ThermometerPro.cpp b/ThermometerPro.cpp index ae85b6a..60f97e5 100644 --- a/ThermometerPro.cpp +++ b/ThermometerPro.cpp @@ -1,14 +1,12 @@ #include "ThermometerPro.h" #include "cmd.h" -#include "test.h" #include "uptime.h" #include "thermometer.h" #include "Config.h" static CmdServer cmdServer(&Serial); -static TestCmd testCmd; static ConfigInvalidateCmd configInvalidateCmd; static Uptime uptime; static Thermometer thermometer; @@ -16,7 +14,6 @@ static Thermometer thermometer; void setup() { cmdServer.begin(); - testCmd.registerYourself(&cmdServer); configInvalidateCmd.registerYourself(&cmdServer); uptime.begin(&cmdServer); thermometer.begin(&cmdServer); diff --git a/cmd.cpp b/cmd.cpp index fbacf1c..694ade8 100644 --- a/cmd.cpp +++ b/cmd.cpp @@ -2,6 +2,7 @@ #include "cmd.h" #include "fatal.h" +#include "Resources.h" void Cmd::registerYourself(CmdServer *cmdServer) { @@ -73,7 +74,7 @@ void CmdServer::parseCommand() { Cmd *c = cmdList[i]; m_stream->println(c->getCmdName() + " " + c->getHelp()); } - m_stream->println("HELP List this help for all commands"); + m_stream->println(getResource(CMDSERVER_HELP_KEY)); } else { bool found = false; for (uint8_t i = 0; i < cmdListIdx; i++) { @@ -88,7 +89,7 @@ void CmdServer::parseCommand() { } } if (! found) - m_stream->println("command not found"); + m_stream->println(getResource(CMDSERVER_CMD_NOT_FOUND_KEY)); } } diff --git a/test.cpp b/test.cpp deleted file mode 100644 index 7667d38..0000000 --- a/test.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "test.h" - -String TestCmd::exec(String params) { - return "Result of testCmd"; -} - diff --git a/test.h b/test.h deleted file mode 100644 index 5dc257c..0000000 --- a/test.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef TEST_H_ -#define TEST_H_ - -#include "cmd.h" - -class TestCmd : public Cmd { -public: - virtual String getCmdName() { return "TEST"; } - virtual String getHelp() { return "Just a test command"; } - virtual String exec(String params); -}; - - -#endif /* TEST_H_ */ diff --git a/thermometer.h b/thermometer.h index d522ffc..8e14b80 100644 --- a/thermometer.h +++ b/thermometer.h @@ -10,6 +10,7 @@ #include #include "cmd.h" +#include "Resources.h" const bool DEBUG = true; const bool INFO = true; @@ -30,7 +31,7 @@ class ThermConfig : public Cmd { public: ThermConfig(Thermometer *thermometer) : m_thermometer(thermometer) {}; virtual String getCmdName() { return "TCFG"; } - virtual String getHelp() { return "Thermometer configuration operations"; } + virtual String getHelp() { return getResource(THERMCONFIG_HELP_KEY); } virtual String exec(String params); private: Thermometer *m_thermometer; @@ -40,7 +41,7 @@ class ThermValues : public Cmd { public: ThermValues(Thermometer *thermometer) : m_thermometer(thermometer) {}; virtual String getCmdName() { return "TVAL"; } - virtual String getHelp() { return "Show thermometer measurement values"; } + virtual String getHelp() { return getResource(THERMVALUES_HELP_KEY); } virtual String exec(String params); private: Thermometer *m_thermometer; @@ -50,7 +51,7 @@ class ThermCalibrate : public Cmd { public: ThermCalibrate(Thermometer *thermometer); virtual String getCmdName() { return "TCALIBR"; } - virtual String getHelp() { return "Thermometer calibration operations"; } + virtual String getHelp() { return getResource(THERMCALIBRATE_HELP_KEY); } virtual String exec(String params); friend class Thermometer; private: