Tweak to gcode_line_error/return

This commit is contained in:
Scott Lahteine 2018-04-07 21:25:39 -05:00
parent 4382f2124d
commit cea398849e

View file

@ -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