Browse Source

Tweak to gcode_line_error/return

pull/1/head
Scott Lahteine 7 years ago
parent
commit
cea398849e
  1. 24
      Marlin/src/gcode/queue.cpp

24
Marlin/src/gcode/queue.cpp

@ -320,32 +320,24 @@ inline void get_serial_commands() {
gcode_N = strtol(npos + 1, NULL, 10);
if (gcode_N != gcode_LastN + 1 && !M110) {
gcode_line_error(PSTR(MSG_ERR_LINE_NO), i);
return;
}
if (gcode_N != gcode_LastN + 1 && !M110)
return gcode_line_error(PSTR(MSG_ERR_LINE_NO), i);
char *apos = strrchr(command, '*');
if (apos) {
uint8_t checksum = 0, count = uint8_t(apos - command);
while (count) checksum ^= command[--count];
if (strtol(apos + 1, NULL, 10) != checksum) {
gcode_line_error(PSTR(MSG_ERR_CHECKSUM_MISMATCH), i);
return;
}
}
else {
gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
return;
if (strtol(apos + 1, NULL, 10) != checksum)
return gcode_line_error(PSTR(MSG_ERR_CHECKSUM_MISMATCH), i);
}
else
return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
gcode_LastN = gcode_N;
}
#if ENABLED(SDSUPPORT)
else if (card.saving) {
gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
return;
}
else if (card.saving)
return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
#endif
// Movement commands alert when stopped

Loading…
Cancel
Save