Compare commits

...

2 Commits

Author SHA1 Message Date
67559642a3 Change boot-up message to include version 2020-04-06 16:36:33 +02:00
9ab76f4ce5 Add version number 2020-04-06 16:33:57 +02:00

View File

@@ -16,6 +16,8 @@ GF(SHOW_CMD, "show");
GF(CURVE_CMD, "curve"); GF(CURVE_CMD, "curve");
GF(MONITOR_CMD, "monitor"); GF(MONITOR_CMD, "monitor");
GF(BOOTLOADER_CMD, "bootloader"); GF(BOOTLOADER_CMD, "bootloader");
GF(VERSION_CMD, "version");
GF(VERSION, "1.1");
constexpr auto BACKSPACE = uint8_t{0x7f}; constexpr auto BACKSPACE = uint8_t{0x7f};
constexpr auto CTRL_C = uint8_t{0x03}; constexpr auto CTRL_C = uint8_t{0x03};
@@ -27,7 +29,9 @@ class Terminal {
{ {
m_serial.init(); m_serial.init();
m_serial << ENDL << F("FanTemp Control Panel") << ENDL << ENDL << F("$ "); m_serial << ENDL;
printVersion();
m_serial << ENDL << F("$ ");
} }
static void callback() static void callback()
@@ -112,6 +116,8 @@ class Terminal {
m_state = State::MONITOR; m_state = State::MONITOR;
} else if (strncmp_P(m_inputBuffer, reinterpret_cast<const char *>(BOOTLOADER_CMD), m_inputSize) == 0) { } else if (strncmp_P(m_inputBuffer, reinterpret_cast<const char *>(BOOTLOADER_CMD), m_inputSize) == 0) {
handleBootloader(); handleBootloader();
} else if (strncmp_P(m_inputBuffer, reinterpret_cast<const char *>(VERSION_CMD), m_inputSize) == 0) {
printVersion();
} else { } else {
printUnknown(); printUnknown();
} }
@@ -132,6 +138,7 @@ class Terminal {
m_serial << CURVE_CMD << F(" ......: shows the curve used to map temperature to fan speed") << ENDL; m_serial << CURVE_CMD << F(" ......: shows the curve used to map temperature to fan speed") << ENDL;
m_serial << MONITOR_CMD << F(" ....: loops the show command until Ctrl + C is pressed") << ENDL; m_serial << MONITOR_CMD << F(" ....: loops the show command until Ctrl + C is pressed") << ENDL;
m_serial << BOOTLOADER_CMD << F(" .: enters the bootloader after 10 seconds") << ENDL; m_serial << BOOTLOADER_CMD << F(" .: enters the bootloader after 10 seconds") << ENDL;
m_serial << VERSION_CMD << F(" ....: displays firmware version") << ENDL;
} }
static void showState() static void showState()
@@ -175,6 +182,11 @@ class Terminal {
Bootloader::enter(); Bootloader::enter();
} }
static void printVersion()
{
m_serial << F("FanTemp v") << VERSION << ENDL;
}
static void printUnknown() static void printUnknown()
{ {
m_serial << F("Unknown command \""); m_serial << F("Unknown command \"");