Browse Source

Add 'E' argument to G34 to allow stowing between probes (#14533)

- Use the return value from probe_pt during `G34`
  Eliminate the assumption that probe_pt leaves current_position set to values relative to the probed points. This is not always true, depending on the raise_after argument.
- Add '`E`' argument to `G34` command allowing stowing between each probe.
Jason Smith 5 years ago
parent
commit
f2c5740d06
1 changed files with 9 additions and 7 deletions
  1. 9
    7
      Marlin/src/gcode/calibrate/G34_M422.cpp

+ 9
- 7
Marlin/src/gcode/calibrate/G34_M422.cpp View File

142
           z_maxdiff = 0.0f,
142
           z_maxdiff = 0.0f,
143
           amplification = z_auto_align_amplification;
143
           amplification = z_auto_align_amplification;
144
 
144
 
145
+    const ProbePtRaise raise_after = parser.boolval('E') ? PROBE_PT_STOW : PROBE_PT_RAISE;
146
+
145
     uint8_t iteration;
147
     uint8_t iteration;
146
     bool err_break = false;
148
     bool err_break = false;
147
     for (iteration = 0; iteration < z_auto_align_iterations; ++iteration) {
149
     for (iteration = 0; iteration < z_auto_align_iterations; ++iteration) {
159
         // Safe clearance even on an incline
161
         // Safe clearance even on an incline
160
         if (iteration == 0 || izstepper > 0) do_blocking_move_to_z(z_probe);
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
           SERIAL_ECHOLNPGM("Probing failed.");
167
           SERIAL_ECHOLNPGM("Probing failed.");
165
           err_break = true;
168
           err_break = true;
166
           break;
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
         if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " measured position is ", z_measured[zstepper]);
176
         if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " measured position is ", z_measured[zstepper]);
175
 
177
 
176
         // Remember the minimum measurement to calculate the correction later on
178
         // Remember the minimum measurement to calculate the correction later on

Loading…
Cancel
Save