From 8500c80b337c1be96cadbd1fd465ad9987f0f9c9 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 30 Mar 2015 20:22:21 -0700 Subject: [PATCH] Apply Z_RAISE_BEFORE_HOMING before homing XY --- Marlin/Marlin_main.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 67821b46a8..0c2ee24024 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1803,7 +1803,19 @@ inline void gcode_G28() { home_all_axis = !homeX && !homeY && !homeZ; // No parameters means home all axes #if Z_HOME_DIR > 0 // If homing away from BED do Z first + if (home_all_axis || homeZ) HOMEAXIS(Z); + + #elif !defined(Z_SAFE_HOMING) && defined(Z_RAISE_BEFORE_HOMING) && Z_RAISE_BEFORE_HOMING > 0 + + // Raise Z before homing any other axes + if (home_all_axis || homeZ) { + destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed + feedrate = max_feedrate[Z_AXIS]; + line_to_destination(); + st_synchronize(); + } + #endif #ifdef QUICK_HOME @@ -1897,16 +1909,7 @@ inline void gcode_G28() { #ifndef Z_SAFE_HOMING - if (home_all_axis || homeZ) { - // Raise Z before homing Z? Shouldn't this happen before homing X or Y? - #if defined(Z_RAISE_BEFORE_HOMING) && Z_RAISE_BEFORE_HOMING > 0 - destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed - feedrate = max_feedrate[Z_AXIS]; - line_to_destination(); - st_synchronize(); - #endif - HOMEAXIS(Z); - } + if (home_all_axis || homeZ) HOMEAXIS(Z); #else // Z_SAFE_HOMING