🚸 BLTouch extra clearance for PROBE_PT_RAISE

This commit is contained in:
Scott Lahteine
2023-04-11 18:18:37 -05:00
parent b3a3cf28d2
commit b1537135e4

View File

@@ -943,32 +943,25 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
do_blocking_move_to(npos, feedRate_t(XY_PROBE_FEEDRATE_MM_S)); do_blocking_move_to(npos, feedRate_t(XY_PROBE_FEEDRATE_MM_S));
#if ENABLED(BD_SENSOR) #if ENABLED(BD_SENSOR)
return current_position.z - bdl.read(); // Difference between Z-home-relative Z and sensor reading
#endif
float measured_z = NAN; return current_position.z - bdl.read(); // Difference between Z-home-relative Z and sensor reading
if (!deploy()) {
measured_z = run_z_probe(sanity_check) + offset.z; #else // !BD_SENSOR
TERN_(HAS_PTC, ptc.apply_compensation(measured_z));
TERN_(X_AXIS_TWIST_COMPENSATION, measured_z += xatc.compensation(npos + offset_xy)); float measured_z = deploy() ? NAN : run_z_probe(sanity_check) + offset.z;
}
// Deploy succeeded and a successful measurement was done. // Deploy succeeded and a successful measurement was done.
// Raise and/or stow the probe depending on 'raise_after' and settings. // Raise and/or stow the probe depending on 'raise_after' and settings.
if (!isnan(measured_z)) { if (!isnan(measured_z)) {
const ProbePtRaise raise_type = (TERN0(BLTOUCH, !bltouch.high_speed_mode) && raise_after == PROBE_PT_RAISE) ? PROBE_PT_STOW : raise_after; switch (raise_after) {
switch (raise_type) {
default: break; default: break;
case PROBE_PT_RAISE: case PROBE_PT_RAISE:
do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES); do_z_clearance(Z_PROBE_SAFE_CLEARANCE);
break; break;
case PROBE_PT_STOW: case PROBE_PT_LAST_STOW: case PROBE_PT_STOW: case PROBE_PT_LAST_STOW:
if (stow()) measured_z = NAN; // Error on stow? if (stow()) measured_z = NAN; // Error on stow?
break; break;
} }
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 any error occurred stow the probe and set an alert
@@ -979,9 +972,16 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
SERIAL_ERROR_MSG(STR_ERR_PROBING_FAILED); SERIAL_ERROR_MSG(STR_ERR_PROBING_FAILED);
#endif #endif
} }
DEBUG_ECHOLNPGM("measured_z: ", measured_z); else {
TERN_(HAS_PTC, ptc.apply_compensation(measured_z));
TERN_(X_AXIS_TWIST_COMPENSATION, measured_z += xatc.compensation(npos + offset_xy));
if (verbose_level > 2 || DEBUGGING(LEVELING))
SERIAL_ECHOLNPGM("Bed X: ", LOGICAL_X_POSITION(rx), " Y: ", LOGICAL_Y_POSITION(ry), " Z: ", measured_z);
}
return measured_z; return measured_z;
#endif // !BD_SENSOR
} }
#if HAS_Z_SERVO_PROBE #if HAS_Z_SERVO_PROBE