Преглед на файлове

Reset LA state more carefully during stop conditions

Yuri D'Elia преди 5 години
родител
ревизия
cda9ed4a1d
променени са 1 файла, в които са добавени 12 реда и са изтрити 0 реда
  1. 12 0
      Firmware/stepper.cpp

+ 12 - 0
Firmware/stepper.cpp

@@ -426,6 +426,13 @@ FORCE_INLINE void stepper_next_block()
   }
   else {
       _NEXT_ISR(2000); // 1kHz.
+
+#ifdef LIN_ADVANCE
+      // reset LA state and pressure when there's no block
+      nextAdvanceISR = ADV_NEVER;
+      e_steps = 0;
+      current_adv_steps = 0;
+#endif
   }
   //WRITE_NC(LOGIC_ANALYZER_CH2, false);
 }
@@ -982,6 +989,8 @@ FORCE_INLINE void advance_isr_scheduler() {
 }
 
 void clear_current_adv_vars() {
+    nextAdvanceISR = ADV_NEVER;
+    e_steps = 0;
     current_adv_steps = 0;
 }
 
@@ -1336,6 +1345,9 @@ void quickStop()
   DISABLE_STEPPER_DRIVER_INTERRUPT();
   while (blocks_queued()) plan_discard_current_block(); 
   current_block = NULL;
+#ifdef LIN_ADVANCE
+  clear_current_adv_vars();
+#endif
   st_reset_timer();
   ENABLE_STEPPER_DRIVER_INTERRUPT();
 }