Browse Source

G34/M422 cleanup

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
committed by Scott Lahteine
parent
commit
eff2330ce1
  1. 33
      Marlin/src/gcode/calibrate/G34_M422.cpp

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

@ -320,7 +320,6 @@ void GcodeSuite::G34() {
}; };
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS) #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
// Check if the applied corrections go in the correct direction. // Check if the applied corrections go in the correct direction.
// Calculate the sum of the absolute deviations from the mean of the probe measurements. // Calculate the sum of the absolute deviations from the mean of the probe measurements.
// Compare to the last iteration to ensure it's getting better. // Compare to the last iteration to ensure it's getting better.
@ -478,32 +477,18 @@ void GcodeSuite::M422() {
const bool is_probe_point = parser.seen('S'); const bool is_probe_point = parser.seen('S');
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS) if (TERN0(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS, is_probe_point && parser.seen('W'))) {
if (is_probe_point && parser.seen('W')) { SERIAL_ECHOLNPGM("?(S) and (W) may not be combined.");
SERIAL_ECHOLNPGM("?(S) and (W) may not be combined."); return;
return; }
}
#endif
xy_pos_t *pos_dest = ( xy_pos_t *pos_dest = (
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS) TERN_(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS, !is_probe_point ? z_stepper_align.stepper_xy :)
!is_probe_point ? z_stepper_align.stepper_xy :
#endif
z_stepper_align.xy z_stepper_align.xy
); );
if (!is_probe_point if (!is_probe_point && TERN1(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS, !parser.seen('W'))) {
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS) SERIAL_ECHOLNPGM("?(S)" TERN_(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS, " or (W)") " is required.");
&& !parser.seen('W')
#endif
) {
SERIAL_ECHOLNPGM(
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
"?(S) or (W) is required."
#else
"?(S) is required."
#endif
);
return; return;
} }
@ -512,7 +497,7 @@ void GcodeSuite::M422() {
if (is_probe_point) { if (is_probe_point) {
position_index = parser.intval('S') - 1; position_index = parser.intval('S') - 1;
if (!WITHIN(position_index, 0, int8_t(NUM_Z_STEPPER_DRIVERS) - 1)) { if (!WITHIN(position_index, 0, int8_t(NUM_Z_STEPPER_DRIVERS) - 1)) {
SERIAL_ECHOLNPGM("?(S) Z-ProbePosition index invalid."); SERIAL_ECHOLNPGM("?(S) Probe-position index invalid.");
return; return;
} }
} }
@ -520,7 +505,7 @@ void GcodeSuite::M422() {
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS) #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
position_index = parser.intval('W') - 1; position_index = parser.intval('W') - 1;
if (!WITHIN(position_index, 0, NUM_Z_STEPPER_DRIVERS - 1)) { if (!WITHIN(position_index, 0, NUM_Z_STEPPER_DRIVERS - 1)) {
SERIAL_ECHOLNPGM("?(W) Z-Stepper index invalid."); SERIAL_ECHOLNPGM("?(W) Z-stepper index invalid.");
return; return;
} }
#endif #endif

Loading…
Cancel
Save