From 72b4d91d2e4d645c7b77eb7eb2aec2f5461f9728 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 2 Feb 2020 00:02:30 -0600 Subject: [PATCH] Add Z_AFTER_HOMING to raise Z more in G28 (#16755) --- Marlin/Configuration.h | 10 ++++++---- Marlin/src/gcode/calibrate/G28.cpp | 10 +++++++++- Marlin/src/module/motion.cpp | 7 +++---- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 550ea35467..998055b725 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1065,12 +1065,14 @@ // @section homing -//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed +//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed -//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. +//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... - // Be sure you have this distance over your Z_MAX_POS in case. +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... + // Be sure to have this much clearance over your Z_MAX_POS to prevent grinding. + +//#define Z_AFTER_HOMING 10 // (mm) Height to move to after homing Z // Direction of endstops when homing; 1=MAX, -1=MIN // :[-1,1] diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 0b29fbc4d6..2b8c150140 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -405,6 +405,7 @@ void GcodeSuite::G28(const bool always_home_all) { // Home Z last if homing towards the bed #if Z_HOME_DIR < 0 + if (doZ) { #if ENABLED(BLTOUCH) bltouch.init(); @@ -416,10 +417,17 @@ void GcodeSuite::G28(const bool always_home_all) { #endif #if HOMING_Z_WITH_PROBE && defined(Z_AFTER_PROBING) - probe.move_z_after_probing(); + #if Z_AFTER_HOMING > Z_AFTER_PROBING + do_blocking_move_to_z(Z_AFTER_HOMING); + #else + probe.move_z_after_probing(); + #endif + #elif defined(Z_AFTER_HOMING) + do_blocking_move_to_z(Z_AFTER_HOMING); #endif } // doZ + #endif // Z_HOME_DIR < 0 sync_plan_position(); diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index f63555d28c..4cb4d0a958 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1755,10 +1755,9 @@ void homeaxis(const AxisEnum axis) { #endif #if DISABLED(DELTA) && defined(HOMING_BACKOFF_MM) - constexpr xyz_float_t endstop_backoff = HOMING_BACKOFF_MM; - const float backoff_mm = endstop_backoff[axis]; - if (backoff_mm) { - current_position[axis] -= ABS(backoff_mm) * axis_home_dir; + const xyz_float_t endstop_backoff = HOMING_BACKOFF_MM; + if (endstop_backoff[axis]) { + current_position[axis] -= ABS(endstop_backoff[axis]) * axis_home_dir; line_to_current_position( #if HOMING_Z_WITH_PROBE (axis == Z_AXIS) ? MMM_TO_MMS(Z_PROBE_SPEED_FAST) :