From f706c4146f9ea3ea5326a1eedaf3eebb6ee547cf Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 16 Dec 2024 17:45:22 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20Enabled=20probe=20clearance=20in?= =?UTF-8?q?=20do=5Fmove=5Fafter=5Fz=5Fhoming?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/motion.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 820089d7eeda..dc218290a027 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1309,12 +1309,16 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f* void do_move_after_z_homing() { DEBUG_SECTION(mzah, "do_move_after_z_homing", DEBUGGING(LEVELING)); #ifdef Z_POST_CLEARANCE - do_z_clearance(Z_POST_CLEARANCE, true, true); + do_z_clearance( + Z_POST_CLEARANCE, + ALL(HOMING_Z_WITH_PROBE, HAS_STOWABLE_PROBE) && TERN0(HAS_BED_PROBE, endstops.z_probe_enabled), + true + ); #elif ENABLED(USE_PROBE_FOR_Z_HOMING) probe.move_z_after_probing(); #endif } -#endif +#endif // HAS_Z_AXIS #if HAS_I_AXIS void do_blocking_move_to_xyz_i(const xyze_pos_t &raw, const_float_t i, const_feedRate_t fr_mm_s/*=0.0f*/) { @@ -2681,12 +2685,10 @@ void prepare_line_to_destination() { // // Homing Z with a probe? Raise Z (maybe) and deploy the Z probe. + // Return early if probe deployment fails. // #if HOMING_Z_WITH_PROBE - if (axis == Z_AXIS && probe.deploy()) { - probe.stow(); - return; - } + if (axis == Z_AXIS && probe.deploy()) { probe.stow(); return; } #endif // Set flags for X, Y, Z motor locking @@ -2705,16 +2707,17 @@ void prepare_line_to_destination() { // #if HOMING_Z_WITH_PROBE if (axis == Z_AXIS) { + #if ENABLED(BLTOUCH) - if (bltouch.deploy()) { // BLTouch was deployed above, but get the alarm state. - bltouch.stow(); - return; - } + // BLTouch was deployed above, but get the alarm state. + // Stow and return early if there is a deploy alarm. + if (bltouch.deploy()) { bltouch.stow(); return; } #endif - if (TERN0(PROBE_TARE, probe.tare())) { - probe.stow(); - return; - } + + // Tare the probe. Stow and return early if it fails + if (TERN0(PROBE_TARE, probe.tare())) { probe.stow(); return; } + + // Tell the Bed Distance Sensor we're Z homing TERN_(BD_SENSOR, bdl.config_state = BDS_HOMING_Z); } #endif @@ -2987,7 +2990,7 @@ void prepare_line_to_destination() { if (axis == Z_AXIS) bdl.config_state = BDS_IDLE; #endif - // Put away the Z probe + // Put away the Z probe. Return early if it fails. if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && probe.stow())) return; #if DISABLED(DELTA) && defined(HOMING_BACKOFF_POST_MM)