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

This commit is contained in:
fedetony 2021-04-17 10:54:43 +02:00 committed by GitHub
parent bca4652c5e
commit b8cf818dac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

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

View File

@ -217,10 +217,10 @@ void GCodeParser::parse(char *p) {
#if ENABLED(GCODE_MOTION_MODES)
#if ENABLED(ARC_SUPPORT)
case 'I' ... 'J': case 'R':
case 'I' ... 'J':
if (motion_mode_codenum != 2 && motion_mode_codenum != 3) return;
#endif
case 'P' ... 'Q':
case 'Q':
if (motion_mode_codenum != 5) return;
case 'X' ... 'Z': case 'E' ... 'F':
if (motion_mode_codenum < 0) return;
@ -229,15 +229,23 @@ void GCodeParser::parse(char *p) {
TERN_(USE_GCODE_SUBCODES, subcode = motion_mode_subcode);
p--; // Back up one character to use the current parameter
break;
#endif // GCODE_MOTION_MODES
#endif
#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
uint8_t digits = 0;
while (*p++ == '0') digits++; // Count up '0' characters
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
default: return;