Pārlūkot izejas kodu

Updates for stepper parity with 2.0.x

Matching changes from #8725
Scott Lahteine 6 gadus atpakaļ
vecāks
revīzija
55acb65e27
2 mainītis faili ar 17 papildinājumiem un 16 dzēšanām
  1. 11
    10
      Marlin/stepper.cpp
  2. 6
    6
      Marlin/stepper.h

+ 11
- 10
Marlin/stepper.cpp Parādīt failu

@@ -141,9 +141,10 @@ volatile signed char Stepper::count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
141 141
   long Stepper::counter_m[MIXING_STEPPERS];
142 142
 #endif
143 143
 
144
-unsigned short Stepper::acc_step_rate; // needed for deceleration start point
145 144
 uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
146
-unsigned short Stepper::OCR1A_nominal;
145
+
146
+uint16_t Stepper::OCR1A_nominal,
147
+         Stepper::acc_step_rate; // needed for deceleration start point
147 148
 
148 149
 volatile long Stepper::endstops_trigsteps[XYZ];
149 150
 
@@ -711,12 +712,12 @@ void Stepper::isr() {
711 712
     NOMORE(acc_step_rate, current_block->nominal_rate);
712 713
 
713 714
     // step_rate to timer interval
714
-    const uint16_t timer = calc_timer(acc_step_rate);
715
+    const uint16_t interval = calc_timer_interval(acc_step_rate);
715 716
 
716
-    SPLIT(timer);  // split step into multiple ISRs if larger than  ENDSTOP_NOMINAL_OCR_VAL
717
+    SPLIT(interval);  // split step into multiple ISRs if larger than  ENDSTOP_NOMINAL_OCR_VAL
717 718
     _NEXT_ISR(ocr_val);
718 719
 
719
-    acceleration_time += timer;
720
+    acceleration_time += interval;
720 721
 
721 722
     #if ENABLED(LIN_ADVANCE)
722 723
 
@@ -728,7 +729,7 @@ void Stepper::isr() {
728 729
           current_estep_rate[TOOL_E_INDEX] = ((uint32_t)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
729 730
         #endif
730 731
       }
731
-      eISR_Rate = adv_rate(e_steps[TOOL_E_INDEX], timer, step_loops);
732
+      eISR_Rate = adv_rate(e_steps[TOOL_E_INDEX], interval, step_loops);
732 733
 
733 734
     #endif // LIN_ADVANCE
734 735
   }
@@ -744,12 +745,12 @@ void Stepper::isr() {
744 745
       step_rate = current_block->final_rate;
745 746
 
746 747
     // step_rate to timer interval
747
-    const uint16_t timer = calc_timer(step_rate);
748
+    const uint16_t interval = calc_timer_interval(step_rate);
748 749
 
749
-    SPLIT(timer);  // split step into multiple ISRs if larger than  ENDSTOP_NOMINAL_OCR_VAL
750
+    SPLIT(interval);  // split step into multiple ISRs if larger than  ENDSTOP_NOMINAL_OCR_VAL
750 751
     _NEXT_ISR(ocr_val);
751 752
 
752
-    deceleration_time += timer;
753
+    deceleration_time += interval;
753 754
 
754 755
     #if ENABLED(LIN_ADVANCE)
755 756
 
@@ -761,7 +762,7 @@ void Stepper::isr() {
761 762
           current_estep_rate[TOOL_E_INDEX] = ((uint32_t)step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
762 763
         #endif
763 764
       }
764
-      eISR_Rate = adv_rate(e_steps[TOOL_E_INDEX], timer, step_loops);
765
+      eISR_Rate = adv_rate(e_steps[TOOL_E_INDEX], interval, step_loops);
765 766
 
766 767
     #endif // LIN_ADVANCE
767 768
   }

+ 6
- 6
Marlin/stepper.h Parādīt failu

@@ -138,10 +138,10 @@ class Stepper {
138 138
     #endif // !LIN_ADVANCE
139 139
 
140 140
     static long acceleration_time, deceleration_time;
141
-    //unsigned long accelerate_until, decelerate_after, acceleration_rate, initial_rate, final_rate, nominal_rate;
142
-    static unsigned short acc_step_rate; // needed for deceleration start point
143 141
     static uint8_t step_loops, step_loops_nominal;
144
-    static unsigned short OCR1A_nominal;
142
+
143
+    static uint16_t OCR1A_nominal,
144
+                    acc_step_rate; // needed for deceleration start point
145 145
 
146 146
     static volatile long endstops_trigsteps[XYZ];
147 147
     static volatile long endstops_stepsTotal, endstops_stepsDone;
@@ -302,7 +302,7 @@ class Stepper {
302 302
 
303 303
   private:
304 304
 
305
-    FORCE_INLINE static unsigned short calc_timer(unsigned short step_rate) {
305
+    FORCE_INLINE static unsigned short calc_timer_interval(unsigned short step_rate) {
306 306
       unsigned short timer;
307 307
 
308 308
       NOMORE(step_rate, MAX_STEP_FREQUENCY);
@@ -356,11 +356,11 @@ class Stepper {
356 356
 
357 357
       deceleration_time = 0;
358 358
       // step_rate to timer interval
359
-      OCR1A_nominal = calc_timer(current_block->nominal_rate);
359
+      OCR1A_nominal = calc_timer_interval(current_block->nominal_rate);
360 360
       // make a note of the number of step loops required at nominal speed
361 361
       step_loops_nominal = step_loops;
362 362
       acc_step_rate = current_block->initial_rate;
363
-      acceleration_time = calc_timer(acc_step_rate);
363
+      acceleration_time = calc_timer_interval(acc_step_rate);
364 364
       _NEXT_ISR(acceleration_time);
365 365
 
366 366
       #if ENABLED(LIN_ADVANCE)

Notiek ielāde…
Atcelt
Saglabāt