|
@@ -153,7 +153,9 @@ void GcodeSuite::G34() {
|
153
|
153
|
if (!all_axes_known()) home_all_axes();
|
154
|
154
|
|
155
|
155
|
// Move the Z coordinate realm towards the positive - dirty trick
|
156
|
|
- current_position.z -= z_probe * 0.5f;
|
|
156
|
+ current_position.z += z_probe * 0.5f;
|
|
157
|
+ sync_plan_position();
|
|
158
|
+ // Now, the Z origin lies below the build plate. That allows to probe deeper, before run_z_probe throws an error.
|
157
|
159
|
|
158
|
160
|
#if DISABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
|
159
|
161
|
float last_z_align_move[NUM_Z_STEPPER_DRIVERS] = ARRAY_N(NUM_Z_STEPPER_DRIVERS, 10000.0f, 10000.0f, 10000.0f);
|
|
@@ -171,7 +173,9 @@ void GcodeSuite::G34() {
|
171
|
173
|
bool adjustment_reverse = false;
|
172
|
174
|
#endif
|
173
|
175
|
|
174
|
|
- LOOP_L_N(iteration, z_auto_align_iterations) {
|
|
176
|
+ // 'iteration' is declared above and is also used after the for-loop.
|
|
177
|
+ // *not* the same as LOOP_L_N(iteration, z_auto_align_iterations)
|
|
178
|
+ for (iteration = 0; iteration < z_auto_align_iterations; ++iteration) {
|
175
|
179
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> probing all positions.");
|
176
|
180
|
|
177
|
181
|
SERIAL_ECHOLNPAIR("\nITERATION: ", int(iteration + 1));
|
|
@@ -192,7 +196,9 @@ void GcodeSuite::G34() {
|
192
|
196
|
DEBUG_ECHOLNPAIR_P(PSTR("Probing X"), z_stepper_align.xy[iprobe].x, SP_Y_STR, z_stepper_align.xy[iprobe].y);
|
193
|
197
|
|
194
|
198
|
// Probe a Z height for each stepper.
|
195
|
|
- const float z_probed_height = probe.probe_at_point(z_stepper_align.xy[iprobe], raise_after, 0, true);
|
|
199
|
+ // Probing sanity check is disabled, as it would trigger even in normal cases because
|
|
200
|
+ // current_position.z has been manually altered in the "dirty trick" above.
|
|
201
|
+ const float z_probed_height = probe.probe_at_point(z_stepper_align.xy[iprobe], raise_after, 0, true, false);
|
196
|
202
|
if (isnan(z_probed_height)) {
|
197
|
203
|
SERIAL_ECHOLNPGM("Probing failed.");
|
198
|
204
|
err_break = true;
|