From 10b332f9440e96e1011ca7ac4969e53c6dc1049e Mon Sep 17 00:00:00 2001 From: Alan T <35016524+interstellarmisfit@users.noreply.github.com> Date: Sun, 15 Mar 2020 17:11:43 -0600 Subject: [PATCH] Fix Z position after ABL bilinear G29 with fade (#17174) --- Marlin/Marlin_main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index fcd9d60665..6ca5a128e3 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5755,7 +5755,12 @@ void home_all_axes() { gcode_G28(true); } // Unapply the offset because it is going to be immediately applied // and cause compensation movement in Z - current_position[Z_AXIS] -= bilinear_z_offset(current_position); + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + const float fade_scaling_factor = planner.fade_scaling_factor_for_z(current_position[Z_AXIS]); + #else + constexpr float fade_scaling_factor = 1.0f; + #endif + current_position[Z_AXIS] -= fade_scaling_factor * bilinear_z_offset(current_position); #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR(" corrected Z:", current_position[Z_AXIS]);