Fix Realtime Reporting with G-code Motion Modes (#21630)

2.0.x
fedetony 4 years ago committed by Scott Lahteine
parent 9c86eef98b
commit b586b64119

@ -901,6 +901,7 @@ G29_TYPE GcodeSuite::G29() {
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE)); TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
G29_RETURN(isnan(abl.measured_z)); G29_RETURN(isnan(abl.measured_z));
} }
#endif // HAS_ABL_NOT_UBL #endif // HAS_ABL_NOT_UBL

@ -217,10 +217,10 @@ void GCodeParser::parse(char *p) {
#if ENABLED(GCODE_MOTION_MODES) #if ENABLED(GCODE_MOTION_MODES)
#if ENABLED(ARC_SUPPORT) #if ENABLED(ARC_SUPPORT)
case 'I' ... 'J': case 'R': case 'I' ... 'J':
if (motion_mode_codenum != 2 && motion_mode_codenum != 3) return; if (motion_mode_codenum != 2 && motion_mode_codenum != 3) return;
#endif #endif
case 'P' ... 'Q': case 'Q':
if (motion_mode_codenum != 5) return; if (motion_mode_codenum != 5) return;
case 'X' ... 'Z': case 'E' ... 'F': case 'X' ... 'Z': case 'E' ... 'F':
if (motion_mode_codenum < 0) return; if (motion_mode_codenum < 0) return;
@ -229,15 +229,23 @@ void GCodeParser::parse(char *p) {
TERN_(USE_GCODE_SUBCODES, subcode = motion_mode_subcode); TERN_(USE_GCODE_SUBCODES, subcode = motion_mode_subcode);
p--; // Back up one character to use the current parameter p--; // Back up one character to use the current parameter
break; break;
#endif // GCODE_MOTION_MODES #endif
#if ENABLED(REALTIME_REPORTING_COMMANDS) #if ENABLED(REALTIME_REPORTING_COMMANDS)
case 'S': case 'P': case 'R': { case 'P': case 'R': {
if (letter == 'R') {
#if ENABLED(GCODE_MOTION_MODES)
if (ENABLED(ARC_SUPPORT) && !WITHIN(motion_mode_codenum, 2, 3)) return;
#endif
}
else if (TERN0(GCODE_MOTION_MODES, motion_mode_codenum != 5)) return;
} // fall-thru
case 'S': {
codenum = 0; // The only valid codenum is 0 codenum = 0; // The only valid codenum is 0
uint8_t digits = 0; uint8_t digits = 0;
while (*p++ == '0') digits++; // Count up '0' characters while (*p++ == '0') digits++; // Count up '0' characters
command_letter = (digits == 3) ? letter : '?'; // Three '0' digits is a good command command_letter = (digits == 3) ? letter : '?'; // Three '0' digits is a good command
} return; // No parameters, so return } return; // No parameters needed, so return now
#endif #endif
default: return; default: return;

Loading…
Cancel
Save