41
41
#include " ../../module/tool_change.h"
42
42
#endif
43
43
44
- #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
44
+ #if HAS_Z_STEPPER_ALIGN_STEPPER_XY
45
45
#include " ../../libs/least_squares_fit.h"
46
46
#endif
47
47
@@ -122,7 +122,7 @@ void GcodeSuite::G34() {
122
122
break ;
123
123
}
124
124
125
- const float z_auto_align_amplification = TERN (Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS , Z_STEPPER_ALIGN_AMP, parser.floatval (' A' , Z_STEPPER_ALIGN_AMP));
125
+ const float z_auto_align_amplification = TERN (HAS_Z_STEPPER_ALIGN_STEPPER_XY , Z_STEPPER_ALIGN_AMP, parser.floatval (' A' , Z_STEPPER_ALIGN_AMP));
126
126
if (!WITHIN (ABS (z_auto_align_amplification), 0 .5f , 2 .0f )) {
127
127
SERIAL_ECHOLNPGM (" ?(A)mplification out of bounds (0.5-2.0)." );
128
128
break ;
@@ -179,7 +179,7 @@ void GcodeSuite::G34() {
179
179
// Now, the Z origin lies below the build plate. That allows to probe deeper, before run_z_probe throws an error.
180
180
// This hack is un-done at the end of G34 - either by re-homing, or by using the probed heights of the last iteration.
181
181
182
- #if DISABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
182
+ #if !HAS_Z_STEPPER_ALIGN_STEPPER_XY
183
183
float last_z_align_move[NUM_Z_STEPPER_DRIVERS] = ARRAY_N_1 (NUM_Z_STEPPER_DRIVERS, 10000 .0f );
184
184
#else
185
185
float last_z_align_level_indicator = 10000 .0f ;
@@ -188,7 +188,7 @@ void GcodeSuite::G34() {
188
188
z_maxdiff = 0 .0f ,
189
189
amplification = z_auto_align_amplification;
190
190
191
- #if DISABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
191
+ #if !HAS_Z_STEPPER_ALIGN_STEPPER_XY
192
192
bool adjustment_reverse = false ;
193
193
#endif
194
194
@@ -256,7 +256,7 @@ void GcodeSuite::G34() {
256
256
z_maxdiff = z_measured_max - z_measured_min;
257
257
z_probe = Z_BASIC_CLEARANCE + z_measured_max + z_maxdiff;
258
258
259
- #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
259
+ #if HAS_Z_STEPPER_ALIGN_STEPPER_XY
260
260
// Replace the initial values in z_measured with calculated heights at
261
261
// each stepper position. This allows the adjustment algorithm to be
262
262
// shared between both possible probing mechanisms.
@@ -338,7 +338,7 @@ void GcodeSuite::G34() {
338
338
return false ;
339
339
};
340
340
341
- #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
341
+ #if HAS_Z_STEPPER_ALIGN_STEPPER_XY
342
342
// Check if the applied corrections go in the correct direction.
343
343
// Calculate the sum of the absolute deviations from the mean of the probe measurements.
344
344
// Compare to the last iteration to ensure it's getting better.
@@ -370,7 +370,7 @@ void GcodeSuite::G34() {
370
370
float z_align_move = z_measured[zstepper] - z_measured_min;
371
371
const float z_align_abs = ABS (z_align_move);
372
372
373
- #if DISABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
373
+ #if !HAS_Z_STEPPER_ALIGN_STEPPER_XY
374
374
// Optimize one iteration's correction based on the first measurements
375
375
if (z_align_abs) amplification = (iteration == 1 ) ? _MIN (last_z_align_move[zstepper] / z_align_abs, 2 .0f ) : z_auto_align_amplification;
376
376
@@ -394,7 +394,7 @@ void GcodeSuite::G34() {
394
394
// Lock all steppers except one
395
395
stepper.set_all_z_lock (true , zstepper);
396
396
397
- #if DISABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
397
+ #if !HAS_Z_STEPPER_ALIGN_STEPPER_XY
398
398
// Decreasing accuracy was detected so move was inverted.
399
399
// Will match reversed Z steppers on dual steppers. Triple will need more work to map.
400
400
if (adjustment_reverse) {
@@ -467,7 +467,7 @@ void GcodeSuite::G34() {
467
467
*
468
468
* S<index> : Index of the probe point to set
469
469
*
470
- * With Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS :
470
+ * With Z_STEPPER_ALIGN_STEPPER_XY :
471
471
* W<index> : Index of the Z stepper position to set
472
472
* The W and S parameters may not be combined.
473
473
*
@@ -488,18 +488,18 @@ void GcodeSuite::M422() {
488
488
489
489
const bool is_probe_point = parser.seen (' S' );
490
490
491
- if (TERN0 (Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS , is_probe_point && parser.seen (' W' ))) {
491
+ if (TERN0 (HAS_Z_STEPPER_ALIGN_STEPPER_XY , is_probe_point && parser.seen (' W' ))) {
492
492
SERIAL_ECHOLNPGM (" ?(S) and (W) may not be combined." );
493
493
return ;
494
494
}
495
495
496
496
xy_pos_t *pos_dest = (
497
- TERN_ (Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS , !is_probe_point ? z_stepper_align.stepper_xy :)
497
+ TERN_ (HAS_Z_STEPPER_ALIGN_STEPPER_XY , !is_probe_point ? z_stepper_align.stepper_xy :)
498
498
z_stepper_align.xy
499
499
);
500
500
501
- if (!is_probe_point && TERN1 (Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS , !parser.seen (' W' ))) {
502
- SERIAL_ECHOLNPGM (" ?(S)" TERN_ (Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS , " or (W)" ) " is required." );
501
+ if (!is_probe_point && TERN1 (HAS_Z_STEPPER_ALIGN_STEPPER_XY , !parser.seen (' W' ))) {
502
+ SERIAL_ECHOLNPGM (" ?(S)" TERN_ (HAS_Z_STEPPER_ALIGN_STEPPER_XY , " or (W)" ) " is required." );
503
503
return ;
504
504
}
505
505
@@ -513,7 +513,7 @@ void GcodeSuite::M422() {
513
513
}
514
514
}
515
515
else {
516
- #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
516
+ #if HAS_Z_STEPPER_ALIGN_STEPPER_XY
517
517
position_index = parser.intval (' W' ) - 1 ;
518
518
if (!WITHIN (position_index, 0 , NUM_Z_STEPPER_DRIVERS - 1 )) {
519
519
SERIAL_ECHOLNPGM (" ?(W) Z-stepper index invalid." );
@@ -551,7 +551,7 @@ void GcodeSuite::M422_report(const bool forReplay/*=true*/) {
551
551
SP_Y_STR, z_stepper_align.xy [i].y
552
552
);
553
553
}
554
- #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
554
+ #if HAS_Z_STEPPER_ALIGN_STEPPER_XY
555
555
LOOP_L_N (i, NUM_Z_STEPPER_DRIVERS) {
556
556
report_echo_start (forReplay);
557
557
SERIAL_ECHOLNPGM_P (
0 commit comments