From 770adcfa1589a15746bc1ae8f26071ce5cd7ebbb Mon Sep 17 00:00:00 2001
From: Jason Smith <jason.inet@gmail.com>
Date: Sun, 10 Nov 2019 14:21:20 -0800
Subject: [PATCH] Raise Z before homing X/Y on unknown Z (#15859)

---
 Marlin/src/gcode/calibrate/G28.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp
index 63408515fb..9ce7938420 100644
--- a/Marlin/src/gcode/calibrate/G28.cpp
+++ b/Marlin/src/gcode/calibrate/G28.cpp
@@ -308,7 +308,7 @@ void GcodeSuite::G28(const bool always_home_all) {
 
     if (z_homing_height && (doX || doY)) {
       // Raise Z before homing any other axes and z is not already high enough (never lower z)
-      destination.z = z_homing_height;
+      destination.z = z_homing_height + (TEST(axis_known_position, Z_AXIS) ? 0.0f : current_position.z);
       if (destination.z > current_position.z) {
         if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before homing) to ", destination.z);
         do_blocking_move_to_z(destination.z);
-- 
GitLab