From a1be8b6784f7363dbf5436c2d212942d7d363ce8 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sun, 19 May 2019 14:26:23 +0200 Subject: [PATCH] Initialize current_adv_steps correctly Initialize at 0 both on startup and on reset on regular (non-LA) segments to avoid cumulating errors. --- Firmware/stepper.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index 8f0fef2ac..9339b4bf3 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -361,6 +361,7 @@ FORCE_INLINE void stepper_next_block() eISR_Rate = ADV_NEVER; e_step_loops = 1; LA_phase = -1; + current_adv_steps = 0; } #endif @@ -1165,6 +1166,7 @@ void st_init() e_steps = 0; e_step_loops = 1; LA_phase = -1; + current_adv_steps = 0; #endif enable_endstops(true); // Start with endstops active. After homing they can be disabled