Prechádzať zdrojové kódy

Always flush pending e_steps after the last stepper isr

During deceleration with LA, as soon as the last real stepper isr is
called, force-flush all pending steps by resetting the phase, since we
know there won't be another main/LA isr pair necessary to actually
perform them.

This caused too many retraction steps to be lost in some corner cases,
mostly visible in geared extruders and very short segments (such as the
small base in a solid infill U turn).

This could be checked for earlier (when LA_phase is initialized to 0),
but simply resetting the state without repeating the check on
steps_events_completed is faster.
Yuri D'Elia 3 rokov pred
rodič
commit
c190a047f8
1 zmenil súbory, kde vykonal 7 pridanie a 0 odobranie
  1. 7 0
      Firmware/stepper.cpp

+ 7 - 0
Firmware/stepper.cpp

@@ -914,6 +914,13 @@ FORCE_INLINE void isr() {
 
       current_block = NULL;
       plan_discard_current_block();
+
+#ifdef LIN_ADVANCE
+      // This is the last time the main isr is called for this block, meaning
+      // we should now always flush ALL accumulated e_steps during the advance_isr
+      // irregardless of the decompression phase and main stepping frequency
+      LA_phase = -1;
+#endif
     }
 #if !defined(LIN_ADVANCE) && defined(FILAMENT_SENSOR)
 	else if ((abs(fsensor_counter) >= fsensor_chunk_len))