@@ -225,11 +225,11 @@ uint32_t Stepper::advance_divisor = 0,
225
225
#endif
226
226
227
227
#if ENABLED(LIN_ADVANCE)
228
- uint32_t Stepper::nextAdvanceISR = LA_ADV_NEVER,
229
- Stepper::la_interval = LA_ADV_NEVER;
230
- int32_t Stepper::la_delta_error = 0 ,
231
- Stepper::la_dividend = 0 ,
232
- Stepper::la_advance_steps = 0 ;
228
+ hal_timer_t Stepper::nextAdvanceISR = LA_ADV_NEVER,
229
+ Stepper::la_interval = LA_ADV_NEVER;
230
+ int32_t Stepper::la_delta_error = 0 ,
231
+ Stepper::la_dividend = 0 ,
232
+ Stepper::la_advance_steps = 0 ;
233
233
#endif
234
234
235
235
#if HAS_SHAPING
@@ -255,14 +255,14 @@ uint32_t Stepper::advance_divisor = 0,
255
255
#endif
256
256
257
257
#if ENABLED(INTEGRATED_BABYSTEPPING)
258
- uint32_t Stepper::nextBabystepISR = BABYSTEP_NEVER;
258
+ hal_timer_t Stepper::nextBabystepISR = BABYSTEP_NEVER;
259
259
#endif
260
260
261
261
#if ENABLED(DIRECT_STEPPING)
262
262
page_step_state_t Stepper::page_step_state;
263
263
#endif
264
264
265
- int32_t Stepper::ticks_nominal = - 1 ;
265
+ hal_timer_t Stepper::ticks_nominal = 0 ;
266
266
#if DISABLED(S_CURVE_ACCELERATION)
267
267
uint32_t Stepper::acc_step_rate; // needed for deceleration start point
268
268
#endif
@@ -1462,7 +1462,7 @@ HAL_STEP_TIMER_ISR() {
1462
1462
1463
1463
void Stepper::isr () {
1464
1464
1465
- static uint32_t nextMainISR = 0 ; // Interval until the next main Stepper Pulse phase (0 = Now)
1465
+ static hal_timer_t nextMainISR = 0 ; // Interval until the next main Stepper Pulse phase (0 = Now)
1466
1466
1467
1467
#ifndef __AVR__
1468
1468
// Disable interrupts, to avoid ISR preemption while we reprogram the period
@@ -1518,8 +1518,8 @@ void Stepper::isr() {
1518
1518
#endif
1519
1519
1520
1520
// Get the interval to the next ISR call
1521
- const uint32_t interval = _MIN (
1522
- uint32_t (HAL_TIMER_TYPE_MAX), // Come back in a very long time
1521
+ const hal_timer_t interval = _MIN (
1522
+ hal_timer_t (HAL_TIMER_TYPE_MAX), // Come back in a very long time
1523
1523
nextMainISR // Time until the next Pulse / Block phase
1524
1524
OPTARG (INPUT_SHAPING_X, ShapingQueue::peek_x ()) // Time until next input shaping echo for X
1525
1525
OPTARG (INPUT_SHAPING_Y, ShapingQueue::peek_y ()) // Time until next input shaping echo for Y
@@ -1598,7 +1598,7 @@ void Stepper::isr() {
1598
1598
// sure that the time has not arrived yet - Warrantied by the scheduler
1599
1599
1600
1600
// Set the next ISR to fire at the proper time
1601
- HAL_timer_set_compare (MF_TIMER_STEP, hal_timer_t ( next_isr_ticks) );
1601
+ HAL_timer_set_compare (MF_TIMER_STEP, next_isr_ticks);
1602
1602
1603
1603
// Don't forget to finally reenable interrupts on non-AVR.
1604
1604
// AVR automatically calls sei() for us on Return-from-Interrupt.
@@ -2046,7 +2046,7 @@ void Stepper::pulse_phase_isr() {
2046
2046
#endif // HAS_SHAPING
2047
2047
2048
2048
// Calculate timer interval, with all limits applied.
2049
- uint32_t Stepper::calc_timer_interval (uint32_t step_rate) {
2049
+ hal_timer_t Stepper::calc_timer_interval (uint32_t step_rate) {
2050
2050
2051
2051
#ifdef CPU_32_BIT
2052
2052
@@ -2078,7 +2078,7 @@ uint32_t Stepper::calc_timer_interval(uint32_t step_rate) {
2078
2078
}
2079
2079
2080
2080
// Get the timer interval and the number of loops to perform per tick
2081
- uint32_t Stepper::calc_timer_interval (uint32_t step_rate, uint8_t &loops) {
2081
+ hal_timer_t Stepper::calc_timer_interval (uint32_t step_rate, uint8_t &loops) {
2082
2082
uint8_t multistep = 1 ;
2083
2083
#if ENABLED(DISABLE_MULTI_STEPPING)
2084
2084
@@ -2118,10 +2118,10 @@ uint32_t Stepper::calc_timer_interval(uint32_t step_rate, uint8_t &loops) {
2118
2118
* schedules planner blocks. This is executed after the step pulses
2119
2119
* have been done, so it is less time critical.
2120
2120
*/
2121
- uint32_t Stepper::block_phase_isr () {
2121
+ hal_timer_t Stepper::block_phase_isr () {
2122
2122
2123
2123
// If no queued movements, just wait 1ms for the next block
2124
- uint32_t interval = (STEPPER_TIMER_RATE) / 1000UL ;
2124
+ hal_timer_t interval = (STEPPER_TIMER_RATE) / 1000UL ;
2125
2125
2126
2126
// If there is a current block
2127
2127
if (current_block) {
@@ -2296,7 +2296,7 @@ uint32_t Stepper::block_phase_isr() {
2296
2296
else { // Must be in cruise phase otherwise
2297
2297
2298
2298
// Calculate the ticks_nominal for this nominal speed, if not done yet
2299
- if (ticks_nominal < 0 ) {
2299
+ if (ticks_nominal == 0 ) {
2300
2300
// step_rate to timer interval and loops for the nominal speed
2301
2301
ticks_nominal = calc_timer_interval (current_block->nominal_rate << oversampling_factor, steps_per_isr);
2302
2302
@@ -2604,7 +2604,7 @@ uint32_t Stepper::block_phase_isr() {
2604
2604
#endif
2605
2605
2606
2606
// Mark ticks_nominal as not-yet-calculated
2607
- ticks_nominal = - 1 ;
2607
+ ticks_nominal = 0 ;
2608
2608
2609
2609
#if ENABLED(S_CURVE_ACCELERATION)
2610
2610
// Initialize the Bézier speed curve
@@ -2671,7 +2671,7 @@ uint32_t Stepper::block_phase_isr() {
2671
2671
#if ENABLED(INTEGRATED_BABYSTEPPING)
2672
2672
2673
2673
// Timer interrupt for baby-stepping
2674
- uint32_t Stepper::babystepping_isr () {
2674
+ hal_timer_t Stepper::babystepping_isr () {
2675
2675
babystep.task ();
2676
2676
return babystep.has_steps () ? BABYSTEP_TICKS : BABYSTEP_NEVER;
2677
2677
}
0 commit comments