Browse Source

Remove clear_current_adv_vars()

The pressure state is already reset implicitly at the end of each block,
meaning an extruder switch will never have to reset the internal state
anyway.

We clear the internal backpressure in the following conditions:

- when switching to a non-LA block
- when quickStop is called
- when the scheduler is idling (losing pressure)
Yuri D'Elia 5 years ago
parent
commit
048628083a
3 changed files with 7 additions and 21 deletions
  1. 0 7
      Firmware/Marlin_main.cpp
  2. 7 10
      Firmware/stepper.cpp
  3. 0 4
      Firmware/stepper.h

+ 0 - 7
Firmware/Marlin_main.cpp

@@ -7086,15 +7086,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
           else
           {
 #ifdef SNMM
-
-#ifdef LIN_ADVANCE
-              if (mmu_extruder != tmp_extruder)
-                  clear_current_adv_vars(); //Check if the selected extruder is not the active one and reset LIN_ADVANCE variables if so.
-#endif
-
               mmu_extruder = tmp_extruder;
 
-
               _delay(100);
 
               disable_e0();

+ 7 - 10
Firmware/stepper.cpp

@@ -426,10 +426,13 @@ FORCE_INLINE void stepper_next_block()
       _NEXT_ISR(2000); // 1kHz.
 
 #ifdef LIN_ADVANCE
-      // reset LA state and pressure when there's no block
+      // reset LA state when there's no block
       nextAdvanceISR = ADV_NEVER;
       e_steps = 0;
-      current_adv_steps = 0;
+
+      // incrementally lose pressure
+      if(current_adv_steps)
+          --current_adv_steps;
 #endif
   }
   //WRITE_NC(LOGIC_ANALYZER_CH2, false);
@@ -985,13 +988,6 @@ FORCE_INLINE void advance_isr_scheduler() {
     else
         OCR1A = nextMainISR;
 }
-
-void clear_current_adv_vars() {
-    nextAdvanceISR = ADV_NEVER;
-    e_steps = 0;
-    current_adv_steps = 0;
-}
-
 #endif // LIN_ADVANCE
 
 void st_init()
@@ -1343,7 +1339,8 @@ void quickStop()
   while (blocks_queued()) plan_discard_current_block(); 
   current_block = NULL;
 #ifdef LIN_ADVANCE
-  clear_current_adv_vars();
+  nextAdvanceISR = ADV_NEVER;
+  current_adv_steps = 0;
 #endif
   st_reset_timer();
   ENABLE_STEPPER_DRIVER_INTERRUPT();

+ 0 - 4
Firmware/stepper.h

@@ -37,10 +37,6 @@ void st_init();
 
 void isr();
 
-#ifdef LIN_ADVANCE
-void clear_current_adv_vars(); // Used to reset the built up pretension and remaining esteps on filament change.
-#endif
-
 // Block until all buffered steps are executed
 void st_synchronize();