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