|
@ -445,7 +445,7 @@ void GCodeQueue::get_serial_commands() { |
|
|
if (process_line_done(serial.input_state, serial.line_buffer, serial.count)) |
|
|
if (process_line_done(serial.input_state, serial.line_buffer, serial.count)) |
|
|
continue; |
|
|
continue; |
|
|
|
|
|
|
|
|
char* command = serial.line_buffer; |
|
|
char *command = serial.line_buffer; |
|
|
|
|
|
|
|
|
while (*command == ' ') command++; // Skip leading spaces
|
|
|
while (*command == ' ') command++; // Skip leading spaces
|
|
|
char *npos = (*command == 'N') ? command : nullptr; // Require the N parameter to start the line
|
|
|
char *npos = (*command == 'N') ? command : nullptr; // Require the N parameter to start the line
|
|
@ -459,7 +459,7 @@ void GCodeQueue::get_serial_commands() { |
|
|
if (n2pos) npos = n2pos; |
|
|
if (n2pos) npos = n2pos; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const long gcode_N = strtol(npos + 1, nullptr, 10); |
|
|
const long gcode_N = parse_int32(npos + 1); |
|
|
|
|
|
|
|
|
if (gcode_N != serial.last_N + 1 && !M110) { |
|
|
if (gcode_N != serial.last_N + 1 && !M110) { |
|
|
// In case of error on a serial port, don't prevent other serial port from making progress
|
|
|
// In case of error on a serial port, don't prevent other serial port from making progress
|
|
@ -471,7 +471,7 @@ void GCodeQueue::get_serial_commands() { |
|
|
if (apos) { |
|
|
if (apos) { |
|
|
uint8_t checksum = 0, count = uint8_t(apos - command); |
|
|
uint8_t checksum = 0, count = uint8_t(apos - command); |
|
|
while (count) checksum ^= command[--count]; |
|
|
while (count) checksum ^= command[--count]; |
|
|
if (strtol(apos + 1, nullptr, 10) != checksum) { |
|
|
if (parse_int32(apos + 1) != checksum) { |
|
|
// In case of error on a serial port, don't prevent other serial port from making progress
|
|
|
// In case of error on a serial port, don't prevent other serial port from making progress
|
|
|
gcode_line_error(PSTR(STR_ERR_CHECKSUM_MISMATCH), p); |
|
|
gcode_line_error(PSTR(STR_ERR_CHECKSUM_MISMATCH), p); |
|
|
break; |
|
|
break; |
|
@ -500,7 +500,7 @@ void GCodeQueue::get_serial_commands() { |
|
|
if (IsStopped()) { |
|
|
if (IsStopped()) { |
|
|
char* gpos = strchr(command, 'G'); |
|
|
char* gpos = strchr(command, 'G'); |
|
|
if (gpos) { |
|
|
if (gpos) { |
|
|
switch (strtol(gpos + 1, nullptr, 10)) { |
|
|
switch (parse_int32(gpos + 1)) { |
|
|
case 0: case 1: |
|
|
case 0: case 1: |
|
|
#if ENABLED(ARC_SUPPORT) |
|
|
#if ENABLED(ARC_SUPPORT) |
|
|
case 2: case 3: |
|
|
case 2: case 3: |
|
|