From c39873759f1602e30343369bab2a0de7d5165058 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 15 Mar 2020 18:14:58 -0500 Subject: [PATCH] Fix Z after ABL Bilinear G29 with fade Co-Authored-By: Alan T --- Marlin/src/gcode/bedlevel/abl/G29.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 2d782e9e3..de6954598 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -934,7 +934,12 @@ G29_TYPE GcodeSuite::G29() { // Unapply the offset because it is going to be immediately applied // and cause compensation movement in Z - current_position.z -= 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); + #else + constexpr float fade_scaling_factor = 1.0f; + #endif + current_position.z -= fade_scaling_factor * bilinear_z_offset(current_position); if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(" corrected Z:", current_position.z); }