🚸 Improve Z-Probe raise for deploy (#25498)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
James Gilliland 2023-03-18 03:30:30 -05:00 committed by Scott Lahteine
parent 98c0cc044d
commit 88da531e5d
4 changed files with 20 additions and 16 deletions

View file

@ -108,7 +108,6 @@ void GcodeSuite::G35() {
// length of the deployed pin (BLTOUCH stroke < 7mm)
// Unsure if this is even required. The probe seems to lift correctly after probe done.
do_blocking_move_to_z(SUM_TERN(BLTOUCH, Z_CLEARANCE_BETWEEN_PROBES, bltouch.z_extra_clearance()));
const float z_probed_height = probe.probe_at_point(tramming_points[i], PROBE_PT_RAISE, 0, true);
if (isnan(z_probed_height)) {

View file

@ -108,7 +108,6 @@
};
auto g76_probe = [](const TempSensorID sid, celsius_t &targ, const xy_pos_t &nozpos) {
do_z_clearance(5.0); // Raise nozzle before probing
ptc.set_enabled(false);
const float measured_z = probe.probe_at_point(nozpos, PROBE_PT_STOW, 0, false); // verbose=0, probe_relative=false
ptc.set_enabled(true);

View file

@ -53,9 +53,7 @@ static int8_t reference_index; // = 0
#endif
static bool probe_single_point() {
do_blocking_move_to_z(TERN(BLTOUCH, Z_CLEARANCE_DEPLOY_PROBE, Z_CLEARANCE_BETWEEN_PROBES));
// Stow after each point with BLTouch "HIGH SPEED" mode for push-pin safety
const float z_probed_height = probe.probe_at_point(tramming_points[tram_index], TERN0(BLTOUCH, bltouch.high_speed_mode) ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, true);
const float z_probed_height = probe.probe_at_point(tramming_points[tram_index], PROBE_PT_RAISE, 0, true);
z_measured[tram_index] = z_probed_height;
if (reference_index < 0) reference_index = tram_index;
move_to_tramming_wait_pos();

View file

@ -147,7 +147,7 @@ xyz_pos_t Probe::offset; // Initialized by settings.load()
WRITE(MAGLEV_TRIGGER_PIN, LOW);
}
inline void maglev_idle() { do_blocking_move_to_z(10); }
inline void maglev_idle() { do_z_clearance(10); }
#elif ENABLED(TOUCH_MI_PROBE)
@ -749,7 +749,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("1st Probe Z:", first_probe_z);
// Raise to give the probe clearance
do_blocking_move_to_z(current_position.z + Z_CLEARANCE_MULTI_PROBE, z_probe_fast_mm_s);
do_z_clearance(current_position.z + Z_CLEARANCE_MULTI_PROBE);
#elif Z_PROBE_FEEDRATE_FAST != Z_PROBE_FEEDRATE_SLOW
@ -759,7 +759,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
if (current_position.z > z) {
// Probe down fast. If the probe never triggered, raise for probe clearance
if (!probe_down_to_z(z, z_probe_fast_mm_s))
do_blocking_move_to_z(current_position.z + Z_CLEARANCE_BETWEEN_PROBES, z_probe_fast_mm_s);
do_z_clearance(current_position.z + Z_CLEARANCE_BETWEEN_PROBES);
}
#endif
@ -810,7 +810,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#if EXTRA_PROBING > 0
< TOTAL_PROBING - 1
#endif
) do_blocking_move_to_z(z + Z_CLEARANCE_MULTI_PROBE, z_probe_fast_mm_s);
) do_z_clearance(z + Z_CLEARANCE_MULTI_PROBE);
#endif
}
@ -878,13 +878,16 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
}
#if ENABLED(BLTOUCH)
if (bltouch.high_speed_mode && bltouch.triggered())
bltouch._reset();
// Reset a BLTouch in HS mode if already triggered
if (bltouch.high_speed_mode && bltouch.triggered()) bltouch._reset();
#endif
// Use a safe Z height for the XY move
const float safe_z = _MAX(current_position.z, SUM_TERN(BLTOUCH, Z_CLEARANCE_BETWEEN_PROBES, bltouch.z_extra_clearance()));
// On delta keep Z below clip height or do_blocking_move_to will abort
xyz_pos_t npos = NUM_AXIS_ARRAY(
rx, ry, TERN(DELTA, _MIN(delta_clip_start_height, current_position.z), current_position.z),
rx, ry, TERN(DELTA, _MIN(delta_clip_start_height, safe_z), safe_z),
current_position.i, current_position.j, current_position.k,
current_position.u, current_position.v, current_position.w
);
@ -907,17 +910,22 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
TERN_(HAS_PTC, ptc.apply_compensation(measured_z));
TERN_(X_AXIS_TWIST_COMPENSATION, measured_z += xatc.compensation(npos + offset_xy));
}
// Deploy succeeded and a successful measurement was done.
// Raise and/or stow the probe depending on 'raise_after' and settings.
if (!isnan(measured_z)) {
const bool big_raise = raise_after == PROBE_PT_BIG_RAISE;
if (big_raise || raise_after == PROBE_PT_RAISE)
do_blocking_move_to_z(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES), z_probe_fast_mm_s);
else if (raise_after == PROBE_PT_STOW || raise_after == PROBE_PT_LAST_STOW)
const ProbePtRaise raise_type = (TERN0(BLTOUCH, !bltouch.high_speed_mode) && raise_after == PROBE_PT_RAISE) ? PROBE_PT_STOW : raise_after;
const bool big_raise = raise_type == PROBE_PT_BIG_RAISE;
if (big_raise || raise_type == PROBE_PT_RAISE)
do_z_clearance(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES));
else if (raise_type == PROBE_PT_STOW || raise_type == PROBE_PT_LAST_STOW)
if (stow()) measured_z = NAN; // Error on stow?
if (verbose_level > 2)
SERIAL_ECHOLNPGM("Bed X: ", LOGICAL_X_POSITION(rx), " Y: ", LOGICAL_Y_POSITION(ry), " Z: ", measured_z);
}
// If any error occurred stow the probe and set an alert
if (isnan(measured_z)) {
stow();
LCD_MESSAGE(MSG_LCD_PROBING_FAILED);