From 4237c3d9f88b3b2b9d6c43e3e51964f404f154f0 Mon Sep 17 00:00:00 2001 From: Giuliano <3684609+GMagician@users.noreply.github.com> Date: Thu, 26 Jul 2018 12:04:09 +0200 Subject: [PATCH] [2.0.x] different bltouch init (#11135) --- Marlin/src/gcode/calibrate/G28.cpp | 3 +- Marlin/src/module/motion.cpp | 45 +++++++++++++----------------- Marlin/src/module/probe.h | 1 - 3 files changed, 21 insertions(+), 28 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index d88fd91bf..c512edde0 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -218,8 +218,7 @@ void GcodeSuite::G28(const bool always_home_all) { #endif #if ENABLED(BLTOUCH) - bltouch_command(BLTOUCH_RESET); - set_bltouch_deployed(false); + bltouch_init(); #endif // Always home with tool 0 active diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 53523f9b4..1cb57688e 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1117,16 +1117,9 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa if (is_home_dir) { - if (axis == Z_AXIS) { - #if HOMING_Z_WITH_PROBE - #if ENABLED(BLTOUCH) - set_bltouch_deployed(true); - #endif - #if QUIET_PROBING - probing_pause(true); - #endif - #endif - } + #if HOMING_Z_WITH_PROBE && QUIET_PROBING + if (axis == Z_AXIS) probing_pause(true); + #endif // Disable stealthChop if used. Enable diag1 pin on driver. #if ENABLED(SENSORLESS_HOMING) @@ -1152,16 +1145,9 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa if (is_home_dir) { - if (axis == Z_AXIS) { - #if HOMING_Z_WITH_PROBE - #if QUIET_PROBING - probing_pause(false); - #endif - #if ENABLED(BLTOUCH) - set_bltouch_deployed(false); - #endif - #endif - } + #if HOMING_Z_WITH_PROBE && QUIET_PROBING + if (axis == Z_AXIS) probing_pause(false); + #endif endstops.validate_homing_move(); @@ -1336,6 +1322,10 @@ void homeaxis(const AxisEnum axis) { if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Home 1 Fast:"); #endif do_homing_move(axis, 1.5f * max_length(axis) * axis_home_dir); + #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) + // BLTOUCH needs to be stowed after trigger to let rearm itself + if (axis == Z_AXIS) set_bltouch_deployed(false); + #endif // When homing Z with probe respect probe clearance const float bump = axis_home_dir * ( @@ -1361,9 +1351,19 @@ void homeaxis(const AxisEnum axis) { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Home 2 Slow:"); #endif + + #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) + // BLTOUCH needs to deploy everytime + if (axis == Z_AXIS && set_bltouch_deployed(true)) return; + #endif do_homing_move(axis, 2 * bump, get_homing_bump_feedrate(axis)); } + // Put away the Z probe + #if HOMING_Z_WITH_PROBE + if (axis == Z_AXIS && STOW_PROBE()) return; + #endif + #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS) const bool pos_dir = axis_home_dir > 0; #if ENABLED(X_DUAL_ENDSTOPS) @@ -1436,11 +1436,6 @@ void homeaxis(const AxisEnum axis) { #endif - // Put away the Z probe - #if HOMING_Z_WITH_PROBE - if (axis == Z_AXIS && STOW_PROBE()) return; - #endif - // Clear retracted status if homing the Z axis #if ENABLED(FWRETRACT) if (axis == Z_AXIS) fwretract.hop_amount = 0.0; diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index 3014a8966..fe4c17b79 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -71,7 +71,6 @@ FORCE_INLINE void bltouch_init() { // Make sure any BLTouch error condition is cleared bltouch_command(BLTOUCH_RESET); - set_bltouch_deployed(true); set_bltouch_deployed(false); } #endif