From 48cfdea11d6b60e4f4982c9d5542a8b26f1ca4df Mon Sep 17 00:00:00 2001 From: BlackMark Date: Wed, 1 Apr 2020 03:58:44 +0200 Subject: [PATCH] Add handling of unknown commands --- fantemp/terminal.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fantemp/terminal.hpp b/fantemp/terminal.hpp index dd9e017..95bbeba 100644 --- a/fantemp/terminal.hpp +++ b/fantemp/terminal.hpp @@ -89,6 +89,8 @@ class Terminal { printHelp(); } else if (strncmp_P(m_inputBuffer, reinterpret_cast(SHOW_CMD), m_inputSize) == 0) { showState(); + } else { + printUnknown(); } } } @@ -112,6 +114,14 @@ class Terminal { m_serial << F("Temperature .: ") << floatBuffer << F(" C") << ENDL; m_serial << F("Fan speed ...: ") << Controller::m_fanSpeed << F("%") << ENDL; } + + static void printUnknown() + { + m_serial << F("Unknown command \""); + for (uint16_t i = 0; i < m_inputSize; ++i) + m_serial << static_cast(m_inputBuffer[i]); + m_serial << F("\"") << ENDL; + } }; template