build command parser

This commit is contained in:
Leonetienne
2025-12-14 12:50:48 +01:00
parent 181139aae5
commit 25313b198e
6 changed files with 71 additions and 13 deletions
+2 -2
View File
@@ -66,14 +66,14 @@ void UartHandler::poll()
}
// Is the last byte read 0x0A? Then push the packet
if (inBufPos > 0 && inBuf[inBufPos - 1] == 0x0A) {
if (inBufPos > 0 && inBuf[inBufPos - 1] == TERMINATOR_BYTE) {
pushPacket();
inBufPos = 0;
}
// Is the last byte NOT 0x0A and we are on the last possibly byte?
// Then something is wrong and we are declaring error.
if (inBufPos == PACKET_SIZE && inBuf[inBufPos - 1] != 0x0A) {
if (inBufPos == PACKET_SIZE && inBuf[inBufPos - 1] != TERMINATOR_BYTE) {
StateMachine::getInstance().raiseError("UART packet did not contain the 0x0A endbyte! May it be too long?");
}
}