Add handling of unknown commands
This commit is contained in:
parent
9d639cd955
commit
48cfdea11d
@ -89,6 +89,8 @@ class Terminal {
|
|||||||
printHelp();
|
printHelp();
|
||||||
} else if (strncmp_P(m_inputBuffer, reinterpret_cast<const char *>(SHOW_CMD), m_inputSize) == 0) {
|
} else if (strncmp_P(m_inputBuffer, reinterpret_cast<const char *>(SHOW_CMD), m_inputSize) == 0) {
|
||||||
showState();
|
showState();
|
||||||
|
} else {
|
||||||
|
printUnknown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,6 +114,14 @@ class Terminal {
|
|||||||
m_serial << F("Temperature .: ") << floatBuffer << F(" C") << ENDL;
|
m_serial << F("Temperature .: ") << floatBuffer << F(" C") << ENDL;
|
||||||
m_serial << F("Fan speed ...: ") << Controller::m_fanSpeed << F("%") << 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>
|
template <class Uart>
|
||||||
|
Loading…
Reference in New Issue
Block a user