diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 39f0ea1e2..138db0e67 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1996,12 +1996,12 @@ static void clean_up_after_endstop_or_probe_move() { // Clear endstop flags endstops.hit_on_purpose(); + // Tell the planner where we actually are + planner.sync_from_steppers(); + // Get Z where the steppers were interrupted set_current_from_steppers_for_axis(Z_AXIS); - // Tell the planner where we actually are - SYNC_PLAN_POSITION_KINEMATIC(); - #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("<<< do_probe_move", current_position); #endif diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index a672cbfc5..c90f5571c 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -1210,6 +1210,13 @@ void Planner::set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) { LOOP_XYZE(i) previous_speed[i] = 0.0; } +/** + * Sync from the stepper positions. (e.g., after an interrupted move) + */ +void Planner::sync_from_steppers() { + LOOP_XYZE(i) position[i] = stepper.position((AxisEnum)i); +} + /** * Directly set the planner E position (hence the stepper E position). */ diff --git a/Marlin/planner.h b/Marlin/planner.h index e38e9e5f0..17408afca 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -242,6 +242,11 @@ class Planner { */ static void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float& e); + /** + * Sync from the stepper positions. (e.g., after an interrupted move) + */ + static void sync_from_steppers(); + /** * Set the E position (mm) of the planner (and the E stepper) */