From 99ae3129199b979106bc65073b1096c13222a826 Mon Sep 17 00:00:00 2001 From: classicrocker883 Date: Mon, 22 Jul 2024 07:57:49 -0400 Subject: [PATCH] Remove probe clearance in do_z_clearance --- Marlin/src/gcode/calibrate/G28.cpp | 4 +--- Marlin/src/module/motion.cpp | 12 +++--------- Marlin/src/module/motion.h | 4 ++-- Marlin/src/module/probe.cpp | 4 ++-- Marlin/src/module/probe.h | 2 +- Marlin/src/module/temperature.cpp | 2 +- 6 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 4a0ecffc4b..cd485ce794 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -383,18 +383,16 @@ void GcodeSuite::G28() { if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("R0 = No Z raise"); } else { - bool with_probe = ENABLED(HOMING_Z_WITH_PROBE); // Raise above the current Z (which should be synced in the planner) // The "height" for Z is a coordinate. But if Z is not trusted/homed make it relative. if (seenR || !(z_min_trusted || axis_should_home(Z_AXIS))) { z_homing_height += current_position.z; - with_probe = false; } if (may_skate) { // Apply Z clearance before doing any lateral motion if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Raise Z before homing:"); - do_z_clearance(z_homing_height, with_probe); + do_z_clearance(z_homing_height); } } diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 1012cc4150..f79988ccbc 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1060,10 +1060,8 @@ void do_blocking_move_to(const xyze_pos_t &raw, const feedRate_t fr_mm_s/*=0.0f* * - If lowering is not allowed then skip a downward move * - Execute the move at the probing (or homing) feedrate */ - void do_z_clearance(const float zclear, const bool with_probe/*=true*/, const bool lower_allowed/*=false*/) { - UNUSED(with_probe); + void do_z_clearance(const float zclear, const bool lower_allowed/*=false*/) { float zdest = zclear; - TERN_(HAS_BED_PROBE, if (with_probe && probe.offset.z < 0) zdest -= probe.offset.z); NOMORE(zdest, Z_MAX_POS); if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance(", zclear, " [", current_position.z, " to ", zdest, "], ", lower_allowed, ")"); if ((!lower_allowed && zdest < current_position.z) || zdest == current_position.z) return; @@ -1071,7 +1069,7 @@ void do_blocking_move_to(const xyze_pos_t &raw, const feedRate_t fr_mm_s/*=0.0f* } void do_z_clearance_by(const float zclear) { if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance_by(", zclear, ")"); - do_z_clearance(current_position.z + zclear, false); + do_z_clearance(current_position.z + zclear); } /** * Move Z to Z_POST_CLEARANCE, @@ -1080,11 +1078,7 @@ 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, - ALL(HOMING_Z_WITH_PROBE, HAS_STOWABLE_PROBE) && TERN0(HAS_BED_PROBE, endstops.z_probe_enabled), - true - ); + do_z_clearance(Z_POST_CLEARANCE, true); #elif ENABLED(USE_PROBE_FOR_Z_HOMING) probe.move_z_after_probing(); #endif diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 8050e66448..c3df16c137 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -422,12 +422,12 @@ void restore_feedrate_and_scaling(); #define Z_POST_CLEARANCE Z_CLEARANCE_FOR_HOMING #endif #endif - void do_z_clearance(const float zclear, const bool with_probe=true, const bool lower_allowed=false); + void do_z_clearance(const float zclear, const bool lower_allowed=false); void do_z_clearance_by(const float zclear); void do_move_after_z_homing(); inline void do_z_post_clearance() { do_z_clearance(Z_POST_CLEARANCE); } #else - inline void do_z_clearance(float, bool=true, bool=false) {} + inline void do_z_clearance(float, bool=false) {} inline void do_z_clearance_by(float) {} #endif diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 3a8bb2b6c6..ed21566938 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -825,7 +825,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/, const float z_min_poi if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("1st Probe Z:", z1); // Raise to give the probe clearance - do_z_clearance(z1 + (Z_CLEARANCE_MULTI_PROBE), false); + do_z_clearance(z1 + (Z_CLEARANCE_MULTI_PROBE)); #elif Z_PROBE_FEEDRATE_FAST != Z_PROBE_FEEDRATE_SLOW @@ -886,7 +886,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/, const float z_min_poi #if EXTRA_PROBING > 0 < TOTAL_PROBING - 1 #endif - ) do_z_clearance(z + (Z_CLEARANCE_MULTI_PROBE), false); + ) do_z_clearance(z + (Z_CLEARANCE_MULTI_PROBE)); #endif } diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index d0f0ada34c..c64f02205f 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -220,7 +220,7 @@ public: static void move_z_after_probing() { DEBUG_SECTION(mzah, "move_z_after_probing", DEBUGGING(LEVELING)); #ifdef Z_AFTER_PROBING - do_z_clearance(Z_AFTER_PROBING, true, true); // Move down still permitted + do_z_clearance(Z_AFTER_PROBING, true); // Move down still permitted #endif } diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index f0ca49ef66..e970dd3f1d 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1068,7 +1068,7 @@ void Temperature::factory_reset() { planner.sync_fan_speeds(fan_speed); #endif - do_z_clearance(MPC_TUNING_END_Z, false); + do_z_clearance(MPC_TUNING_END_Z); #ifdef EVENT_GCODE_AFTER_MPC_TUNE gcode.process_subcommands_now(F(EVENT_GCODE_AFTER_MPC_TUNE));