|
|
|
@ -35,7 +35,7 @@ EventHandlerResult FocusSerial::afterEachCycle() {
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
command_[buf_cursor_++] = Runtime.serialPort().read();
|
|
|
|
|
} while ( command_[buf_cursor_ - 1] != SEPARATOR
|
|
|
|
|
} while (command_[buf_cursor_ - 1] != SEPARATOR
|
|
|
|
|
&& buf_cursor_ < sizeof(command_)
|
|
|
|
|
&& Runtime.serialPort().available()
|
|
|
|
|
&& (Runtime.serialPort().peek() != NEWLINE));
|
|
|
|
@ -48,7 +48,7 @@ EventHandlerResult FocusSerial::afterEachCycle() {
|
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (command_[buf_cursor_ - 1] != SEPARATOR) && (Runtime.serialPort().peek() != NEWLINE)
|
|
|
|
|
if ((command_[buf_cursor_ - 1] != SEPARATOR) && (Runtime.serialPort().peek() != NEWLINE)
|
|
|
|
|
&& buf_cursor_ < sizeof(command_)
|
|
|
|
|
) {
|
|
|
|
|
// We don't have enough command to work with yet.
|
|
|
|
@ -58,7 +58,7 @@ EventHandlerResult FocusSerial::afterEachCycle() {
|
|
|
|
|
|
|
|
|
|
// If this was a command with a space-delimited payload,
|
|
|
|
|
// strip the space delimiter off
|
|
|
|
|
if ( (command_[buf_cursor_ - 1] == SEPARATOR) ) {
|
|
|
|
|
if ((command_[buf_cursor_ - 1] == SEPARATOR)) {
|
|
|
|
|
command_[buf_cursor_ - 1] = '\0';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|