From ed7698efaa5d5b0bd1dae1e79b6605e687c3639a Mon Sep 17 00:00:00 2001 From: FanDjango <51046875+FanDjango@users.noreply.github.com> Date: Tue, 5 Jan 2021 03:32:52 +0100 Subject: [PATCH] Defer "quiet probing" till the last Z bump (#20610) --- Marlin/src/module/motion.cpp | 37 +++++++++++++++++------------------- Marlin/src/module/planner.h | 2 +- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 6ffb0576c4..6a6d7bf9eb 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1289,7 +1289,7 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) { /** * Home an individual linear axis */ -void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t fr_mm_s=0.0) { +void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t fr_mm_s=0.0, const bool final_approach=true) { DEBUG_SECTION(log_move, "do_homing_move", DEBUGGING(LEVELING)); const feedRate_t home_fr_mm_s = fr_mm_s ?: homing_feedrate(axis); @@ -1320,7 +1320,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t thermalManager.wait_for_bed_heating(); #endif - TERN_(HAS_QUIET_PROBING, probe.set_probing_paused(true)); + TERN_(HAS_QUIET_PROBING, if (final_approach) probe.set_probing_paused(true)); } // Disable stealthChop if used. Enable diag1 pin on driver. @@ -1359,7 +1359,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t if (is_home_dir) { #if HOMING_Z_WITH_PROBE && HAS_QUIET_PROBING - if (axis == Z_AXIS) probe.set_probing_paused(false); + if (axis == Z_AXIS && final_approach) probe.set_probing_paused(false); #endif endstops.validate_homing_move(); @@ -1608,32 +1608,29 @@ void homeaxis(const AxisEnum axis) { } #endif - // - // Fast move towards endstop until triggered - // - const float move_length = 1.5f * max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir; - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Home Fast: ", move_length, "mm"); - do_homing_move(axis, move_length); - - #if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH_SLOW_MODE) - if (axis == Z_AXIS) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE) - #endif - + // Determine if a homing bump will be done and the bumps distance // When homing Z with probe respect probe clearance const bool use_probe_bump = TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && home_bump_mm(Z_AXIS)); const float bump = axis_home_dir * ( use_probe_bump ? _MAX(TERN0(HOMING_Z_WITH_PROBE, Z_CLEARANCE_BETWEEN_PROBES), home_bump_mm(Z_AXIS)) : home_bump_mm(axis) ); + // + // Fast move towards endstop until triggered + // + const float move_length = 1.5f * max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir; + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Home Fast: ", move_length, "mm"); + do_homing_move(axis, move_length, 0.0, !use_probe_bump); + + #if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH_SLOW_MODE) + if (axis == Z_AXIS) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE) + #endif + // If a second homing move is configured... if (bump) { // Move away from the endstop by the axis HOMING_BUMP_MM if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Move Away: ", -bump, "mm"); - do_homing_move(axis, -bump - #if HOMING_Z_WITH_PROBE - , MMM_TO_MMS(axis == Z_AXIS ? Z_PROBE_SPEED_FAST : 0) - #endif - ); + do_homing_move(axis, -bump, TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS) ? MMM_TO_MMS(Z_PROBE_SPEED_FAST) : 0, false); #if ENABLED(DETECT_BROKEN_ENDSTOP) // Check for a broken endstop @@ -1657,7 +1654,7 @@ void homeaxis(const AxisEnum axis) { // Slow move towards endstop until triggered const float rebump = bump * 2; if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Re-bump: ", rebump, "mm"); - do_homing_move(axis, rebump, get_homing_bump_feedrate(axis)); + do_homing_move(axis, rebump, get_homing_bump_feedrate(axis), true); #if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH) if (axis == Z_AXIS) bltouch.stow(); // The final STOW diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 5050f060b0..cd906c5d13 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -712,7 +712,7 @@ class Planner { private: // Allow do_homing_move to access internal functions, such as buffer_segment. - friend void do_homing_move(const AxisEnum, const float, const feedRate_t); + friend void do_homing_move(const AxisEnum, const float, const feedRate_t, const bool); #endif /**