diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 661bc2d774..03fd2c80ed 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -205,6 +205,11 @@ * L Force leveling state ON (if possible) or OFF after homing (Requires RESTORE_LEVELING_AFTER_G28 or ENABLE_LEVELING_AFTER_G28) * O Home only if the position is not known and trusted * R Raise by n mm/inches before homing + * H Hold the current X/Y position when executing a home Z, or if + * multiple axes are homed, the position when Z home is executed. + * When using a probe for Z Home, positions close to the edge may + * fail with position unreachable due to probe/nozzle offset. This + * can be used to avoid a model. * * Cartesian/SCARA parameters * @@ -461,7 +466,12 @@ void GcodeSuite::G28() { #endif #if ENABLED(Z_SAFE_HOMING) - if (TERN1(POWER_LOSS_RECOVERY, !parser.seen_test('H'))) home_z_safely(); else homeaxis(Z_AXIS); + // H means hold the current X/Y position when probing. + // Otherwise move to the define safe X/Y position before homing Z. + if (!parser.seen_test('H')) + home_z_safely(); + else + homeaxis(Z_AXIS); #else homeaxis(Z_AXIS); #endif diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index abac117719..af26cfff02 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -2679,8 +2679,12 @@ void prepare_line_to_destination() { // // Homing Z with a probe? Raise Z (maybe) and deploy the Z probe. // - if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && probe.deploy())) - return; + #if HOMING_Z_WITH_PROBE + if (axis == Z_AXIS && probe.deploy()) { + probe.stow(); + return; + } + #endif // Set flags for X, Y, Z motor locking #if HAS_EXTRA_ENDSTOPS @@ -2698,8 +2702,16 @@ void prepare_line_to_destination() { // #if HOMING_Z_WITH_PROBE if (axis == Z_AXIS) { - if (TERN0(BLTOUCH, bltouch.deploy())) return; // BLTouch was deployed above, but get the alarm state. - if (TERN0(PROBE_TARE, probe.tare())) return; + #if ENABLED(BLTOUCH) + if (bltouch.deploy()) { // BLTouch was deployed above, but get the alarm state. + bltouch.stow(); + return; + } + #endif + if (TERN0(PROBE_TARE, probe.tare())) { + probe.stow(); + return; + } TERN_(BD_SENSOR, bdl.config_state = BDS_HOMING_Z); } #endif @@ -2781,8 +2793,10 @@ void prepare_line_to_destination() { #endif // DETECT_BROKEN_ENDSTOP #if ALL(HOMING_Z_WITH_PROBE, BLTOUCH) - if (axis == Z_AXIS && !bltouch.high_speed_mode && bltouch.deploy()) + if (axis == Z_AXIS && !bltouch.high_speed_mode && bltouch.deploy()) { + bltouch.stow(); return; // Intermediate DEPLOY (in LOW SPEED MODE) + } #endif // Slow move towards endstop until triggered diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 5e0fb65294..7c7bf3debd 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -961,11 +961,6 @@ float Probe::probe_at_point( DEBUG_POS("", current_position); } - #if ENABLED(BLTOUCH) - // 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, z_clearance); @@ -1003,6 +998,13 @@ float Probe::probe_at_point( #else // !BD_SENSOR + #if ENABLED(BLTOUCH) + // Now at the safe_z if it is still triggered it may be in an alarm + // condition. Reset to clear alarm has a side effect of stowing the probe, + // which the following deploy will handle. + if (bltouch.triggered()) bltouch._reset(); + #endif + measured_z = deploy() ? NAN : run_z_probe(sanity_check, z_min_point, z_clearance) + offset.z; // Deploy succeeded and a successful measurement was done.