From 2616df66af8046630fe1488c4b1048e3a0d0f1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Tue, 30 Aug 2022 20:53:19 +0000 Subject: [PATCH] PFW-1386 st_get_position_mm() is more accurate when using endstops (not homed printer) If the endstops kick in, then st_get_position_mm shows the actual travel distance. current_position[Z-AXIS] does not get updated correctly thus we cannot use it when unhomed. current_position[Z-AXIS] is later set to Z_MAX_POS, we cannot use that either to calculate the travel distance --- Firmware/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3ade776fd..048344ffe 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2128,7 +2128,7 @@ float raise_z(float delta) st_synchronize(); // Get the final travel distance - travel_z = current_position[Z_AXIS] - travel_z; + travel_z = st_get_position_mm(Z_AXIS) - travel_z; #ifdef TMC2130 if (endstop_z_hit_on_purpose()) {