🚸 Improve Z-Probe raise for deploy (#25498)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
98c0cc044d
commit
88da531e5d
|
@ -108,7 +108,6 @@ void GcodeSuite::G35() {
|
||||||
// length of the deployed pin (BLTOUCH stroke < 7mm)
|
// length of the deployed pin (BLTOUCH stroke < 7mm)
|
||||||
|
|
||||||
// Unsure if this is even required. The probe seems to lift correctly after probe done.
|
// 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);
|
const float z_probed_height = probe.probe_at_point(tramming_points[i], PROBE_PT_RAISE, 0, true);
|
||||||
|
|
||||||
if (isnan(z_probed_height)) {
|
if (isnan(z_probed_height)) {
|
||||||
|
|
|
@ -108,7 +108,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
auto g76_probe = [](const TempSensorID sid, celsius_t &targ, const xy_pos_t &nozpos) {
|
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);
|
ptc.set_enabled(false);
|
||||||
const float measured_z = probe.probe_at_point(nozpos, PROBE_PT_STOW, 0, false); // verbose=0, probe_relative=false
|
const float measured_z = probe.probe_at_point(nozpos, PROBE_PT_STOW, 0, false); // verbose=0, probe_relative=false
|
||||||
ptc.set_enabled(true);
|
ptc.set_enabled(true);
|
||||||
|
|
|
@ -53,9 +53,7 @@ static int8_t reference_index; // = 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool probe_single_point() {
|
static bool probe_single_point() {
|
||||||
do_blocking_move_to_z(TERN(BLTOUCH, Z_CLEARANCE_DEPLOY_PROBE, Z_CLEARANCE_BETWEEN_PROBES));
|
const float z_probed_height = probe.probe_at_point(tramming_points[tram_index], PROBE_PT_RAISE, 0, true);
|
||||||
// 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);
|
|
||||||
z_measured[tram_index] = z_probed_height;
|
z_measured[tram_index] = z_probed_height;
|
||||||
if (reference_index < 0) reference_index = tram_index;
|
if (reference_index < 0) reference_index = tram_index;
|
||||||
move_to_tramming_wait_pos();
|
move_to_tramming_wait_pos();
|
||||||
|
|
|
@ -147,7 +147,7 @@ xyz_pos_t Probe::offset; // Initialized by settings.load()
|
||||||
WRITE(MAGLEV_TRIGGER_PIN, LOW);
|
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)
|
#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);
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("1st Probe Z:", first_probe_z);
|
||||||
|
|
||||||
// Raise to give the probe clearance
|
// 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
|
#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) {
|
if (current_position.z > z) {
|
||||||
// Probe down fast. If the probe never triggered, raise for probe clearance
|
// Probe down fast. If the probe never triggered, raise for probe clearance
|
||||||
if (!probe_down_to_z(z, z_probe_fast_mm_s))
|
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
|
#endif
|
||||||
|
|
||||||
|
@ -810,7 +810,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
|
||||||
#if EXTRA_PROBING > 0
|
#if EXTRA_PROBING > 0
|
||||||
< TOTAL_PROBING - 1
|
< TOTAL_PROBING - 1
|
||||||
#endif
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -878,13 +878,16 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(BLTOUCH)
|
#if ENABLED(BLTOUCH)
|
||||||
if (bltouch.high_speed_mode && bltouch.triggered())
|
// Reset a BLTouch in HS mode if already triggered
|
||||||
bltouch._reset();
|
if (bltouch.high_speed_mode && bltouch.triggered()) bltouch._reset();
|
||||||
#endif
|
#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
|
// On delta keep Z below clip height or do_blocking_move_to will abort
|
||||||
xyz_pos_t npos = NUM_AXIS_ARRAY(
|
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.i, current_position.j, current_position.k,
|
||||||
current_position.u, current_position.v, current_position.w
|
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_(HAS_PTC, ptc.apply_compensation(measured_z));
|
||||||
TERN_(X_AXIS_TWIST_COMPENSATION, measured_z += xatc.compensation(npos + offset_xy));
|
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)) {
|
if (!isnan(measured_z)) {
|
||||||
const bool big_raise = raise_after == PROBE_PT_BIG_RAISE;
|
const ProbePtRaise raise_type = (TERN0(BLTOUCH, !bltouch.high_speed_mode) && raise_after == PROBE_PT_RAISE) ? PROBE_PT_STOW : raise_after;
|
||||||
if (big_raise || raise_after == PROBE_PT_RAISE)
|
const bool big_raise = raise_type == PROBE_PT_BIG_RAISE;
|
||||||
do_blocking_move_to_z(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES), z_probe_fast_mm_s);
|
if (big_raise || raise_type == PROBE_PT_RAISE)
|
||||||
else if (raise_after == PROBE_PT_STOW || raise_after == PROBE_PT_LAST_STOW)
|
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 (stow()) measured_z = NAN; // Error on stow?
|
||||||
|
|
||||||
if (verbose_level > 2)
|
if (verbose_level > 2)
|
||||||
SERIAL_ECHOLNPGM("Bed X: ", LOGICAL_X_POSITION(rx), " Y: ", LOGICAL_Y_POSITION(ry), " Z: ", measured_z);
|
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)) {
|
if (isnan(measured_z)) {
|
||||||
stow();
|
stow();
|
||||||
LCD_MESSAGE(MSG_LCD_PROBING_FAILED);
|
LCD_MESSAGE(MSG_LCD_PROBING_FAILED);
|
||||||
|
|
Loading…
Reference in a new issue