From 653eff3b31d38f2819ec55134831fdd5daf3e980 Mon Sep 17 00:00:00 2001
From: AnHardt <github@kitelab.de>
Date: Fri, 8 Jul 2016 13:40:38 +0200
Subject: [PATCH] Clean up `quick_home_xy()`

Since we do the actual homing now in the 'normal' routines `quick_home_xy()`
can be simplified to a relative simple diagonal move.
---
 Marlin/Marlin_main.cpp | 27 ++-------------------------
 1 file changed, 2 insertions(+), 25 deletions(-)

diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index 8b419b9e7e..0c35885768 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -2779,8 +2779,6 @@ inline void gcode_G4() {
       int x_axis_home_dir = home_dir(X_AXIS);
     #endif
 
-    SYNC_PLAN_POSITION_KINEMATIC();
-
     float mlx = max_length(X_AXIS), mly = max_length(Y_AXIS),
           mlratio = mlx > mly ? mly / mlx : mlx / mly;
 
@@ -2789,30 +2787,9 @@ inline void gcode_G4() {
     feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1);
     line_to_destination();
     stepper.synchronize();
-
-    set_axis_is_at_home(X_AXIS);
-    set_axis_is_at_home(Y_AXIS);
-    SYNC_PLAN_POSITION_KINEMATIC();
-
-    #if ENABLED(DEBUG_LEVELING_FEATURE)
-      if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 1", current_position);
-    #endif
-
-    destination[X_AXIS] = current_position[X_AXIS];
-    destination[Y_AXIS] = current_position[Y_AXIS];
-    line_to_destination();
-    stepper.synchronize();
     endstops.hit_on_purpose(); // clear endstop hit flags
 
-    current_position[X_AXIS] = destination[X_AXIS];
-    current_position[Y_AXIS] = destination[Y_AXIS];
-    #if DISABLED(SCARA)
-      current_position[Z_AXIS] = destination[Z_AXIS];
-    #endif
-
-    #if ENABLED(DEBUG_LEVELING_FEATURE)
-      if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 2", current_position);
-    #endif
+    destination[X_AXIS] = destination[Y_AXIS] = 0;
   }
 
 #endif // QUICK_HOME
@@ -2917,8 +2894,8 @@ inline void gcode_G28() {
 
     #elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0
 
-      // Raise Z before homing X or Y, if specified
       if (home_all_axis || homeX || homeY) {
+        // Raise Z before homing any other axes and z is not already high enough (never lower z)
         float z_dest = home_offset[Z_AXIS] + MIN_Z_HEIGHT_FOR_HOMING;
         if (z_dest > current_position[Z_AXIS]) {