浏览代码

Updates for stepper parity with 2.0.x

Matching changes from #8725
Scott Lahteine 7 年前
父节点
当前提交
55acb65e27
共有 2 个文件被更改,包括 17 次插入16 次删除
  1. 11
    10
      Marlin/stepper.cpp
  2. 6
    6
      Marlin/stepper.h

+ 11
- 10
Marlin/stepper.cpp 查看文件

141
   long Stepper::counter_m[MIXING_STEPPERS];
141
   long Stepper::counter_m[MIXING_STEPPERS];
142
 #endif
142
 #endif
143
 
143
 
144
-unsigned short Stepper::acc_step_rate; // needed for deceleration start point
145
 uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
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
 volatile long Stepper::endstops_trigsteps[XYZ];
149
 volatile long Stepper::endstops_trigsteps[XYZ];
149
 
150
 
711
     NOMORE(acc_step_rate, current_block->nominal_rate);
712
     NOMORE(acc_step_rate, current_block->nominal_rate);
712
 
713
 
713
     // step_rate to timer interval
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
     _NEXT_ISR(ocr_val);
718
     _NEXT_ISR(ocr_val);
718
 
719
 
719
-    acceleration_time += timer;
720
+    acceleration_time += interval;
720
 
721
 
721
     #if ENABLED(LIN_ADVANCE)
722
     #if ENABLED(LIN_ADVANCE)
722
 
723
 
728
           current_estep_rate[TOOL_E_INDEX] = ((uint32_t)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
729
           current_estep_rate[TOOL_E_INDEX] = ((uint32_t)acc_step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
729
         #endif
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
     #endif // LIN_ADVANCE
734
     #endif // LIN_ADVANCE
734
   }
735
   }
744
       step_rate = current_block->final_rate;
745
       step_rate = current_block->final_rate;
745
 
746
 
746
     // step_rate to timer interval
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
     _NEXT_ISR(ocr_val);
751
     _NEXT_ISR(ocr_val);
751
 
752
 
752
-    deceleration_time += timer;
753
+    deceleration_time += interval;
753
 
754
 
754
     #if ENABLED(LIN_ADVANCE)
755
     #if ENABLED(LIN_ADVANCE)
755
 
756
 
761
           current_estep_rate[TOOL_E_INDEX] = ((uint32_t)step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
762
           current_estep_rate[TOOL_E_INDEX] = ((uint32_t)step_rate * current_block->abs_adv_steps_multiplier8) >> 17;
762
         #endif
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
     #endif // LIN_ADVANCE
767
     #endif // LIN_ADVANCE
767
   }
768
   }

+ 6
- 6
Marlin/stepper.h 查看文件

138
     #endif // !LIN_ADVANCE
138
     #endif // !LIN_ADVANCE
139
 
139
 
140
     static long acceleration_time, deceleration_time;
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
     static uint8_t step_loops, step_loops_nominal;
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
     static volatile long endstops_trigsteps[XYZ];
146
     static volatile long endstops_trigsteps[XYZ];
147
     static volatile long endstops_stepsTotal, endstops_stepsDone;
147
     static volatile long endstops_stepsTotal, endstops_stepsDone;
302
 
302
 
303
   private:
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
       unsigned short timer;
306
       unsigned short timer;
307
 
307
 
308
       NOMORE(step_rate, MAX_STEP_FREQUENCY);
308
       NOMORE(step_rate, MAX_STEP_FREQUENCY);
356
 
356
 
357
       deceleration_time = 0;
357
       deceleration_time = 0;
358
       // step_rate to timer interval
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
       // make a note of the number of step loops required at nominal speed
360
       // make a note of the number of step loops required at nominal speed
361
       step_loops_nominal = step_loops;
361
       step_loops_nominal = step_loops;
362
       acc_step_rate = current_block->initial_rate;
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
       _NEXT_ISR(acceleration_time);
364
       _NEXT_ISR(acceleration_time);
365
 
365
 
366
       #if ENABLED(LIN_ADVANCE)
366
       #if ENABLED(LIN_ADVANCE)

正在加载...
取消
保存