From 9ab76f4ce5e88884868744fb62a0d02c033419d3 Mon Sep 17 00:00:00 2001 From: BlackMark Date: Mon, 6 Apr 2020 16:33:57 +0200 Subject: [PATCH] Add version number --- fantemp/terminal.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fantemp/terminal.hpp b/fantemp/terminal.hpp index 87f6e24..9e8dfb7 100644 --- a/fantemp/terminal.hpp +++ b/fantemp/terminal.hpp @@ -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(BOOTLOADER_CMD), m_inputSize) == 0) { handleBootloader(); + } else if (strncmp_P(m_inputBuffer, reinterpret_cast(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 \"");