build command parser
This commit is contained in:
+2
-2
@@ -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?");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user