|
@@ -120,9 +120,9 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even
|
120
|
120
|
|
121
|
121
|
#if ENABLED(LIN_ADVANCE)
|
122
|
122
|
|
123
|
|
- constexpr timer_t ADV_NEVER = HAL_TIMER_TYPE_MAX;
|
|
123
|
+ constexpr hal_timer_t ADV_NEVER = HAL_TIMER_TYPE_MAX;
|
124
|
124
|
|
125
|
|
- timer_t Stepper::nextMainISR = 0,
|
|
125
|
+ hal_timer_t Stepper::nextMainISR = 0,
|
126
|
126
|
Stepper::nextAdvanceISR = ADV_NEVER,
|
127
|
127
|
Stepper::eISR_Rate = ADV_NEVER;
|
128
|
128
|
|
|
@@ -137,9 +137,9 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even
|
137
|
137
|
* This fix isn't perfect and may lose steps - but better than locking up completely
|
138
|
138
|
* in future the planner should slow down if advance stepping rate would be too high
|
139
|
139
|
*/
|
140
|
|
- FORCE_INLINE timer_t adv_rate(const int steps, const timer_t timer, const uint8_t loops) {
|
|
140
|
+ FORCE_INLINE hal_timer_t adv_rate(const int steps, const hal_timer_t timer, const uint8_t loops) {
|
141
|
141
|
if (steps) {
|
142
|
|
- const timer_t rate = (timer * loops) / abs(steps);
|
|
142
|
+ const hal_timer_t rate = (timer * loops) / abs(steps);
|
143
|
143
|
//return constrain(rate, 1, ADV_NEVER - 1)
|
144
|
144
|
return rate ? rate : 1;
|
145
|
145
|
}
|
|
@@ -157,9 +157,9 @@ volatile signed char Stepper::count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
|
157
|
157
|
long Stepper::counter_m[MIXING_STEPPERS];
|
158
|
158
|
#endif
|
159
|
159
|
|
160
|
|
-timer_t Stepper::acc_step_rate; // needed for deceleration start point
|
|
160
|
+hal_timer_t Stepper::acc_step_rate; // needed for deceleration start point
|
161
|
161
|
uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
|
162
|
|
-timer_t Stepper::OCR1A_nominal;
|
|
162
|
+hal_timer_t Stepper::OCR1A_nominal;
|
163
|
163
|
|
164
|
164
|
volatile long Stepper::endstops_trigsteps[XYZ];
|
165
|
165
|
|
|
@@ -341,7 +341,7 @@ HAL_STEP_TIMER_ISR {
|
341
|
341
|
|
342
|
342
|
void Stepper::isr() {
|
343
|
343
|
|
344
|
|
- timer_t ocr_val;
|
|
344
|
+ hal_timer_t ocr_val;
|
345
|
345
|
|
346
|
346
|
#define ENDSTOP_NOMINAL_OCR_VAL 1500 * HAL_TICKS_PER_US // check endstops every 1.5ms to guarantee two stepper ISRs within 5ms for BLTouch
|
347
|
347
|
#define OCR_VAL_TOLERANCE 500 * HAL_TICKS_PER_US // First max delay is 2.0ms, last min delay is 0.5ms, all others 1.5ms
|
|
@@ -677,7 +677,7 @@ void Stepper::isr() {
|
677
|
677
|
NOMORE(acc_step_rate, current_block->nominal_rate);
|
678
|
678
|
|
679
|
679
|
// step_rate to timer interval
|
680
|
|
- const timer_t timer = calc_timer(acc_step_rate);
|
|
680
|
+ const hal_timer_t timer = calc_timer(acc_step_rate);
|
681
|
681
|
|
682
|
682
|
SPLIT(timer); // split step into multiple ISRs if larger than ENDSTOP_NOMINAL_OCR_VAL
|
683
|
683
|
_NEXT_ISR(ocr_val);
|
|
@@ -699,7 +699,7 @@ void Stepper::isr() {
|
699
|
699
|
#endif // LIN_ADVANCE
|
700
|
700
|
}
|
701
|
701
|
else if (step_events_completed > (uint32_t)current_block->decelerate_after) {
|
702
|
|
- timer_t step_rate;
|
|
702
|
+ hal_timer_t step_rate;
|
703
|
703
|
#ifdef CPU_32_BIT
|
704
|
704
|
MultiU32X24toH32(step_rate, deceleration_time, current_block->acceleration_rate);
|
705
|
705
|
#else
|
|
@@ -714,7 +714,7 @@ void Stepper::isr() {
|
714
|
714
|
step_rate = current_block->final_rate;
|
715
|
715
|
|
716
|
716
|
// step_rate to timer interval
|
717
|
|
- const timer_t timer = calc_timer(step_rate);
|
|
717
|
+ const hal_timer_t timer = calc_timer(step_rate);
|
718
|
718
|
|
719
|
719
|
SPLIT(timer); // split step into multiple ISRs if larger than ENDSTOP_NOMINAL_OCR_VAL
|
720
|
720
|
_NEXT_ISR(ocr_val);
|
|
@@ -754,7 +754,7 @@ void Stepper::isr() {
|
754
|
754
|
#if DISABLED(LIN_ADVANCE)
|
755
|
755
|
#ifdef CPU_32_BIT
|
756
|
756
|
// Make sure stepper interrupt does not monopolise CPU by adjusting count to give about 8 us room
|
757
|
|
- timer_t stepper_timer_count = HAL_timer_get_count(STEP_TIMER_NUM),
|
|
757
|
+ hal_timer_t stepper_timer_count = HAL_timer_get_count(STEP_TIMER_NUM),
|
758
|
758
|
stepper_timer_current_count = HAL_timer_get_current_count(STEP_TIMER_NUM) + 8 * HAL_TICKS_PER_US;
|
759
|
759
|
HAL_timer_set_count(STEP_TIMER_NUM, max(stepper_timer_count, stepper_timer_current_count));
|
760
|
760
|
#else
|