Browse Source

🚸 Improve M422 error messages

FB4S_WIFI
Scott Lahteine 2 years ago
committed by Scott Lahteine
parent
commit
e4ca822dcf
  1. 29
      Marlin/src/gcode/calibrate/G34_M422.cpp

29
Marlin/src/gcode/calibrate/G34_M422.cpp

@ -493,7 +493,7 @@ void GcodeSuite::M422() {
return; return;
} }
xy_pos_t *pos_dest = ( xy_pos_t * const pos_dest = (
TERN_(HAS_Z_STEPPER_ALIGN_STEPPER_XY, !is_probe_point ? z_stepper_align.stepper_xy :) TERN_(HAS_Z_STEPPER_ALIGN_STEPPER_XY, !is_probe_point ? z_stepper_align.stepper_xy :)
z_stepper_align.xy z_stepper_align.xy
); );
@ -504,24 +504,25 @@ void GcodeSuite::M422() {
} }
// Get the Probe Position Index or Z Stepper Index // Get the Probe Position Index or Z Stepper Index
int8_t position_index; int8_t position_index = 1;
if (is_probe_point) { FSTR_P err_string = F("?(S) Probe-position");
position_index = parser.intval('S') - 1; if (is_probe_point)
if (!WITHIN(position_index, 0, int8_t(NUM_Z_STEPPER_DRIVERS) - 1)) { position_index = parser.intval('S');
SERIAL_ECHOLNPGM("?(S) Probe-position index invalid.");
return;
}
}
else { else {
#if HAS_Z_STEPPER_ALIGN_STEPPER_XY #if HAS_Z_STEPPER_ALIGN_STEPPER_XY
position_index = parser.intval('W') - 1; err_string = F("?(W) Z-stepper");
if (!WITHIN(position_index, 0, NUM_Z_STEPPER_DRIVERS - 1)) { position_index = parser.intval('W');
SERIAL_ECHOLNPGM("?(W) Z-stepper index invalid.");
return;
}
#endif #endif
} }
if (!WITHIN(position_index, 1, NUM_Z_STEPPER_DRIVERS)) {
SERIAL_ECHOF(err_string);
SERIAL_ECHOLNPGM(" index invalid (1.." STRINGIFY(NUM_Z_STEPPER_DRIVERS) ").");
return;
}
--position_index;
const xy_pos_t pos = { const xy_pos_t pos = {
parser.floatval('X', pos_dest[position_index].x), parser.floatval('X', pos_dest[position_index].x),
parser.floatval('Y', pos_dest[position_index].y) parser.floatval('Y', pos_dest[position_index].y)

Loading…
Cancel
Save