Handle/strip leading whitespace in gcode stream

This commit is contained in:
Yuri D'Elia 2022-12-14 13:44:17 +01:00 committed by DRracer
parent a4d427adf2
commit 9105573ac9
1 changed files with 14 additions and 8 deletions

View File

@ -419,15 +419,21 @@ void get_command()
return; return;
} }
} }
// if we don't receive 'N' but still see '*' else
if (*(cmd_head != 'N') && (strchr(cmd_start, '*') != NULL))
{ {
SERIAL_ERROR_START; // move cmd_start past all spaces
SERIAL_ERRORRPGM(_n("No Line Number with checksum, Last Line: "));////MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM while (*cmd_start == ' ') ++cmd_start;
SERIAL_ERRORLN(gcode_LastN);
FlushSerialRequestResend(); // if we didn't receive 'N' but still see '*'
serial_count = 0; if (strchr(cmd_start, '*') != NULL)
return; {
SERIAL_ERROR_START;
SERIAL_ERRORRPGM(_n("No Line Number with checksum, Last Line: "));////MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM
SERIAL_ERRORLN(gcode_LastN);
FlushSerialRequestResend();
serial_count = 0;
return;
}
} }
// Handle KILL early, even when Stopped // Handle KILL early, even when Stopped