From 1894b981af30c29c895064c6056d8b58ae536288 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 21 Apr 2018 16:04:41 -0500 Subject: [PATCH] Add R parameter to G28 to specify pre-raise --- Marlin/Marlin_main.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index e91933c88..8b8a0d97a 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3994,6 +3994,8 @@ inline void gcode_G4() { * None Home to all axes with no parameters. * With QUICK_HOME enabled XY will home together, then Z. * + * Rn Raise by n mm/inches before homing + * * Cartesian parameters * * X Home to the X endstop @@ -4068,11 +4070,12 @@ inline void gcode_G28(const bool always_home_all) { #endif - #if ENABLED(UNKNOWN_Z_NO_RAISE) - const float z_homing_height = axis_known_position[Z_AXIS] ? Z_HOMING_HEIGHT : 0; - #else - constexpr float z_homing_height = Z_HOMING_HEIGHT; - #endif + const float z_homing_height = ( + #if ENABLED(UNKNOWN_Z_NO_RAISE) + !axis_known_position[Z_AXIS] ? 0 : + #endif + (parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT) + ); if (z_homing_height && (home_all || homeX || homeY)) { // Raise Z before homing any other axes and z is not already high enough (never lower z)