Tweak to gcode_line_error/return
This commit is contained in:
parent
4382f2124d
commit
cea398849e
@ -320,32 +320,24 @@ inline void get_serial_commands() {
|
|||||||
|
|
||||||
gcode_N = strtol(npos + 1, NULL, 10);
|
gcode_N = strtol(npos + 1, NULL, 10);
|
||||||
|
|
||||||
if (gcode_N != gcode_LastN + 1 && !M110) {
|
if (gcode_N != gcode_LastN + 1 && !M110)
|
||||||
gcode_line_error(PSTR(MSG_ERR_LINE_NO), i);
|
return gcode_line_error(PSTR(MSG_ERR_LINE_NO), i);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *apos = strrchr(command, '*');
|
char *apos = strrchr(command, '*');
|
||||||
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, NULL, 10) != checksum) {
|
if (strtol(apos + 1, NULL, 10) != checksum)
|
||||||
gcode_line_error(PSTR(MSG_ERR_CHECKSUM_MISMATCH), i);
|
return gcode_line_error(PSTR(MSG_ERR_CHECKSUM_MISMATCH), i);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
|
||||||
|
|
||||||
gcode_LastN = gcode_N;
|
gcode_LastN = gcode_N;
|
||||||
}
|
}
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
else if (card.saving) {
|
else if (card.saving)
|
||||||
gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
|
return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Movement commands alert when stopped
|
// Movement commands alert when stopped
|
||||||
|
Loading…
Reference in New Issue
Block a user