diff --git a/fantemp/terminal.hpp b/fantemp/terminal.hpp index 8b10923..a0fd3a6 100644 --- a/fantemp/terminal.hpp +++ b/fantemp/terminal.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include "flash/flash.hpp" #define ENDL F("\r\n") @@ -49,6 +51,7 @@ class Terminal { if (m_serial.peek(inputByte) && (inputByte == '\r' || inputByte == '\n')) { m_serial.rxByte(inputByte); } + m_serial << ENDL; handleInput = true; break; } @@ -63,7 +66,7 @@ class Terminal { if (handleInput) { parseInput(); m_inputSize = 0; - m_serial << ENDL << F("$ "); + m_serial << F("$ "); } } @@ -74,7 +77,18 @@ class Terminal { static char m_inputBuffer[INPUT_BUFFER_SIZE]; static uint16_t m_inputSize; - static void parseInput() {} + static void parseInput() + { + if (m_inputSize && strncmp_P(m_inputBuffer, reinterpret_cast(F("help")), m_inputSize) == 0) { + printHelp(); + } + } + + static void printHelp() + { + m_serial << F("Help: ") << ENDL; + m_serial << F("help .: print this help message") << ENDL; + } }; template