Add handling of unknown commands

This commit is contained in:
BlackMark 2020-04-01 03:58:44 +02:00
parent 9d639cd955
commit 48cfdea11d

View File

@ -89,6 +89,8 @@ class Terminal {
printHelp();
} else if (strncmp_P(m_inputBuffer, reinterpret_cast<const char *>(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<char>(m_inputBuffer[i]);
m_serial << F("\"") << ENDL;
}
};
template <class Uart>