|
@@ -142,6 +142,8 @@ void GcodeSuite::G34() {
|
142
|
142
|
z_maxdiff = 0.0f,
|
143
|
143
|
amplification = z_auto_align_amplification;
|
144
|
144
|
|
|
145
|
+ const ProbePtRaise raise_after = parser.boolval('E') ? PROBE_PT_STOW : PROBE_PT_RAISE;
|
|
146
|
+
|
145
|
147
|
uint8_t iteration;
|
146
|
148
|
bool err_break = false;
|
147
|
149
|
for (iteration = 0; iteration < z_auto_align_iterations; ++iteration) {
|
|
@@ -159,18 +161,18 @@ void GcodeSuite::G34() {
|
159
|
161
|
// Safe clearance even on an incline
|
160
|
162
|
if (iteration == 0 || izstepper > 0) do_blocking_move_to_z(z_probe);
|
161
|
163
|
|
162
|
|
- // Probe a Z height for each stepper
|
163
|
|
- if (isnan(probe_pt(z_auto_align_xpos[zstepper], z_auto_align_ypos[zstepper], PROBE_PT_RAISE, 0, true))) {
|
|
164
|
+ // Probe a Z height for each stepper.
|
|
165
|
+ const float z_probed_height = probe_pt(z_auto_align_xpos[zstepper], z_auto_align_ypos[zstepper], raise_after, 0, true);
|
|
166
|
+ if (isnan(z_probed_height)) {
|
164
|
167
|
SERIAL_ECHOLNPGM("Probing failed.");
|
165
|
168
|
err_break = true;
|
166
|
169
|
break;
|
167
|
170
|
}
|
168
|
171
|
|
169
|
|
- // This is not the trigger Z value. It is the position of the probe after raising it.
|
170
|
|
- // It is higher than the trigger value by a constant value (not known here). This value
|
171
|
|
- // is more useful for determining the desired next iteration Z position for probing. It is
|
172
|
|
- // equally well suited for determining the misalignment, just like the trigger position would be.
|
173
|
|
- z_measured[zstepper] = current_position[Z_AXIS];
|
|
172
|
+ // Add height to each value, to provide a more useful target height for
|
|
173
|
+ // the next iteration of probing. This allows adjustments to be made away from the bed.
|
|
174
|
+ z_measured[zstepper] = z_probed_height + Z_CLEARANCE_BETWEEN_PROBES;
|
|
175
|
+
|
174
|
176
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " measured position is ", z_measured[zstepper]);
|
175
|
177
|
|
176
|
178
|
// Remember the minimum measurement to calculate the correction later on
|