Add ctrl + c handler

This commit is contained in:
BlackMark 2020-04-01 05:07:12 +02:00
parent 7f62961757
commit aab90f0fc0

View File

@ -89,7 +89,9 @@ class Terminal {
static void parseInput()
{
if (m_inputSize) {
if (strncmp_P(m_inputBuffer, reinterpret_cast<const char *>(HELP_CMD), m_inputSize) == 0) {
if (m_inputBuffer[m_inputSize - 1] == CTRL_C) {
handleCtrlC();
} else if (strncmp_P(m_inputBuffer, reinterpret_cast<const char *>(HELP_CMD), m_inputSize) == 0) {
printHelp();
} else if (strncmp_P(m_inputBuffer, reinterpret_cast<const char *>(SHOW_CMD), m_inputSize) == 0) {
showState();
@ -101,6 +103,11 @@ class Terminal {
}
}
static void handleCtrlC()
{
m_serial << F("Abort!") << ENDL;
}
static void printHelp()
{
m_serial << F("FanTemp command overview: ") << ENDL;