Fix commands being accepted in monitor mode

This commit is contained in:
BlackMark 2020-04-06 19:53:46 +02:00
parent dd42aebb16
commit e29ee8c11f

View File

@ -95,8 +95,6 @@ class Terminal {
if (handleInput) { if (handleInput) {
parseInput(); parseInput();
m_inputSize = 0;
m_serial << F("$ ");
} }
if (m_state == State::MONITOR && --m_monitorDelayCounter == 0) { if (m_state == State::MONITOR && --m_monitorDelayCounter == 0) {
@ -127,7 +125,8 @@ class Terminal {
if (m_inputSize) { if (m_inputSize) {
if (m_inputBuffer[m_inputSize - 1] == CTRL_C) { if (m_inputBuffer[m_inputSize - 1] == CTRL_C) {
handleCtrlC(); handleCtrlC();
} else if (substringEquals(m_inputBuffer, detail::HELP_CMD, m_inputSize)) { } else if (m_state == State::NONE) {
if (substringEquals(m_inputBuffer, detail::HELP_CMD, m_inputSize)) {
printHelp(); printHelp();
} else if (substringEquals(m_inputBuffer, detail::SHOW_CMD, m_inputSize)) { } else if (substringEquals(m_inputBuffer, detail::SHOW_CMD, m_inputSize)) {
showState(); showState();
@ -146,6 +145,11 @@ class Terminal {
} }
} }
m_inputSize = 0;
if (m_state == State::NONE)
m_serial << F("$ ");
}
static void handleCtrlC() static void handleCtrlC()
{ {
m_serial << F("Abort!") << detail::ENDL; m_serial << F("Abort!") << detail::ENDL;