Add version number

This commit is contained in:
BlackMark 2020-04-06 16:33:57 +02:00
parent 07be559e94
commit 9ab76f4ce5

View File

@ -16,6 +16,8 @@ GF(SHOW_CMD, "show");
GF(CURVE_CMD, "curve");
GF(MONITOR_CMD, "monitor");
GF(BOOTLOADER_CMD, "bootloader");
GF(VERSION_CMD, "version");
GF(VERSION, "1.1");
constexpr auto BACKSPACE = uint8_t{0x7f};
constexpr auto CTRL_C = uint8_t{0x03};
@ -112,6 +114,8 @@ class Terminal {
m_state = State::MONITOR;
} else if (strncmp_P(m_inputBuffer, reinterpret_cast<const char *>(BOOTLOADER_CMD), m_inputSize) == 0) {
handleBootloader();
} else if (strncmp_P(m_inputBuffer, reinterpret_cast<const char *>(VERSION_CMD), m_inputSize) == 0) {
printVersion();
} else {
printUnknown();
}
@ -132,6 +136,7 @@ class Terminal {
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 << BOOTLOADER_CMD << F(" .: enters the bootloader after 10 seconds") << ENDL;
m_serial << VERSION_CMD << F(" ....: displays firmware version") << ENDL;
}
static void showState()
@ -175,6 +180,11 @@ class Terminal {
Bootloader::enter();
}
static void printVersion()
{
m_serial << F("FanTemp v") << VERSION << ENDL;
}
static void printUnknown()
{
m_serial << F("Unknown command \"");