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) {
parseInput();
m_inputSize = 0;
m_serial << F("$ ");
}
if (m_state == State::MONITOR && --m_monitorDelayCounter == 0) {
@ -127,23 +125,29 @@ class Terminal {
if (m_inputSize) {
if (m_inputBuffer[m_inputSize - 1] == CTRL_C) {
handleCtrlC();
} else if (substringEquals(m_inputBuffer, detail::HELP_CMD, m_inputSize)) {
printHelp();
} else if (substringEquals(m_inputBuffer, detail::SHOW_CMD, m_inputSize)) {
showState();
} else if (substringEquals(m_inputBuffer, detail::CURVE_CMD, m_inputSize)) {
printCurve();
} else if (substringEquals(m_inputBuffer, detail::MONITOR_CMD, m_inputSize)) {
m_state = State::MONITOR;
m_monitorDelayCounter = MONITOR_DELAY;
} else if (substringEquals(m_inputBuffer, detail::BOOTLOADER_CMD, m_inputSize)) {
handleBootloader();
} else if (substringEquals(m_inputBuffer, detail::VERSION_CMD, m_inputSize)) {
printVersion();
} else {
printUnknown();
} else if (m_state == State::NONE) {
if (substringEquals(m_inputBuffer, detail::HELP_CMD, m_inputSize)) {
printHelp();
} else if (substringEquals(m_inputBuffer, detail::SHOW_CMD, m_inputSize)) {
showState();
} else if (substringEquals(m_inputBuffer, detail::CURVE_CMD, m_inputSize)) {
printCurve();
} else if (substringEquals(m_inputBuffer, detail::MONITOR_CMD, m_inputSize)) {
m_state = State::MONITOR;
m_monitorDelayCounter = MONITOR_DELAY;
} else if (substringEquals(m_inputBuffer, detail::BOOTLOADER_CMD, m_inputSize)) {
handleBootloader();
} else if (substringEquals(m_inputBuffer, detail::VERSION_CMD, m_inputSize)) {
printVersion();
} else {
printUnknown();
}
}
}
m_inputSize = 0;
if (m_state == State::NONE)
m_serial << F("$ ");
}
static void handleCtrlC()