From 89a2161cac4c6c0ad4d177dcee6dbd0b7cc21b08 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Wed, 4 Sep 2019 03:01:51 +0200 Subject: [PATCH] MINIMUM_STEPPER_DIR_DELAY in LA (#15154) Add missed MINIMUM_STEPPER_DIR_DELAY after dir change in LinearAdvance interrupt. --- Marlin/src/module/stepper.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 862c60877..cd868e7db 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -1879,19 +1879,24 @@ uint32_t Stepper::stepper_block_phase_isr() { else interval = LA_ADV_NEVER; - #if ENABLED(MIXING_EXTRUDER) - // We don't know which steppers will be stepped because LA loop follows, - // with potentially multiple steps. Set all. - if (LA_steps >= 0) - MIXER_STEPPER_LOOP(j) NORM_E_DIR(j); - else - MIXER_STEPPER_LOOP(j) REV_E_DIR(j); - #else - if (LA_steps >= 0) - NORM_E_DIR(stepper_extruder); - else - REV_E_DIR(stepper_extruder); - #endif + #if ENABLED(MIXING_EXTRUDER) + // We don't know which steppers will be stepped because LA loop follows, + // with potentially multiple steps. Set all. + if (LA_steps >= 0) + MIXER_STEPPER_LOOP(j) NORM_E_DIR(j); + else + MIXER_STEPPER_LOOP(j) REV_E_DIR(j); + #else + if (LA_steps >= 0) + NORM_E_DIR(stepper_extruder); + else + REV_E_DIR(stepper_extruder); + #endif + + // A small delay may be needed after changing direction + #if MINIMUM_STEPPER_DIR_DELAY > 0 + DELAY_NS(MINIMUM_STEPPER_DIR_DELAY); + #endif // Get the timer count and estimate the end of the pulse hal_timer_t pulse_end = HAL_timer_get_count(PULSE_TIMER_NUM) + hal_timer_t(MIN_PULSE_TICKS);