1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 13:25:54 +00:00

Workaround for Pronterface M29

This commit is contained in:
Scott Lahteine 2018-09-27 15:38:07 -05:00
parent ea29b71a3a
commit 8f89ce9b16

View File

@ -1075,44 +1075,40 @@ 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)); return gcode_line_error(PSTR(MSG_ERR_LINE_NO));
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)); return gcode_line_error(PSTR(MSG_ERR_CHECKSUM_MISMATCH));
return;
}
}
else {
gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM));
return;
} }
else
return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM));
gcode_LastN = gcode_N; gcode_LastN = gcode_N;
} }
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
else if (card.saving) { else if (card.saving && strcmp(command, "M29") != 0) // No line number with M29 in Pronterface
gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM)); return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM));
return;
}
#endif #endif
// Movement commands alert when stopped // Movement commands alert when stopped
if (IsStopped()) { if (IsStopped()) {
char* gpos = strchr(command, 'G'); char* gpos = strchr(command, 'G');
if (gpos) { if (gpos) {
const int codenum = strtol(gpos + 1, NULL, 10); switch (strtol(gpos + 1, NULL, 10)) {
switch (codenum) {
case 0: case 0:
case 1: case 1:
case 2: #if ENABLED(ARC_SUPPORT)
case 3: case 2:
case 3:
#endif
#if ENABLED(BEZIER_CURVE_SUPPORT)
case 5:
#endif
SERIAL_ERRORLNPGM(MSG_ERR_STOPPED); SERIAL_ERRORLNPGM(MSG_ERR_STOPPED);
LCD_MESSAGEPGM(MSG_STOPPED); LCD_MESSAGEPGM(MSG_STOPPED);
break; break;