@@ -225,11 +225,11 @@ uint32_t Stepper::advance_divisor = 0,
225225#endif
226226
227227#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 ;
233233#endif
234234
235235#if HAS_SHAPING
@@ -255,14 +255,14 @@ uint32_t Stepper::advance_divisor = 0,
255255#endif
256256
257257#if ENABLED(INTEGRATED_BABYSTEPPING)
258- uint32_t Stepper::nextBabystepISR = BABYSTEP_NEVER;
258+ hal_timer_t Stepper::nextBabystepISR = BABYSTEP_NEVER;
259259#endif
260260
261261#if ENABLED(DIRECT_STEPPING)
262262 page_step_state_t Stepper::page_step_state;
263263#endif
264264
265- int32_t Stepper::ticks_nominal = - 1 ;
265+ hal_timer_t Stepper::ticks_nominal = 0 ;
266266#if DISABLED(S_CURVE_ACCELERATION)
267267 uint32_t Stepper::acc_step_rate; // needed for deceleration start point
268268#endif
@@ -1462,7 +1462,7 @@ HAL_STEP_TIMER_ISR() {
14621462
14631463void Stepper::isr () {
14641464
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)
14661466
14671467 #ifndef __AVR__
14681468 // Disable interrupts, to avoid ISR preemption while we reprogram the period
@@ -1518,8 +1518,8 @@ void Stepper::isr() {
15181518 #endif
15191519
15201520 // 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
15231523 nextMainISR // Time until the next Pulse / Block phase
15241524 OPTARG (INPUT_SHAPING_X, ShapingQueue::peek_x ()) // Time until next input shaping echo for X
15251525 OPTARG (INPUT_SHAPING_Y, ShapingQueue::peek_y ()) // Time until next input shaping echo for Y
@@ -1598,7 +1598,7 @@ void Stepper::isr() {
15981598 // sure that the time has not arrived yet - Warrantied by the scheduler
15991599
16001600 // 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);
16021602
16031603 // Don't forget to finally reenable interrupts on non-AVR.
16041604 // AVR automatically calls sei() for us on Return-from-Interrupt.
@@ -2046,7 +2046,7 @@ void Stepper::pulse_phase_isr() {
20462046#endif // HAS_SHAPING
20472047
20482048// 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) {
20502050
20512051 #ifdef CPU_32_BIT
20522052
@@ -2078,7 +2078,7 @@ uint32_t Stepper::calc_timer_interval(uint32_t step_rate) {
20782078}
20792079
20802080// 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) {
20822082 uint8_t multistep = 1 ;
20832083 #if ENABLED(DISABLE_MULTI_STEPPING)
20842084
@@ -2118,10 +2118,10 @@ uint32_t Stepper::calc_timer_interval(uint32_t step_rate, uint8_t &loops) {
21182118 * schedules planner blocks. This is executed after the step pulses
21192119 * have been done, so it is less time critical.
21202120 */
2121- uint32_t Stepper::block_phase_isr () {
2121+ hal_timer_t Stepper::block_phase_isr () {
21222122
21232123 // 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 ;
21252125
21262126 // If there is a current block
21272127 if (current_block) {
@@ -2296,7 +2296,7 @@ uint32_t Stepper::block_phase_isr() {
22962296 else { // Must be in cruise phase otherwise
22972297
22982298 // Calculate the ticks_nominal for this nominal speed, if not done yet
2299- if (ticks_nominal < 0 ) {
2299+ if (ticks_nominal == 0 ) {
23002300 // step_rate to timer interval and loops for the nominal speed
23012301 ticks_nominal = calc_timer_interval (current_block->nominal_rate << oversampling_factor, steps_per_isr);
23022302
@@ -2604,7 +2604,7 @@ uint32_t Stepper::block_phase_isr() {
26042604 #endif
26052605
26062606 // Mark ticks_nominal as not-yet-calculated
2607- ticks_nominal = - 1 ;
2607+ ticks_nominal = 0 ;
26082608
26092609 #if ENABLED(S_CURVE_ACCELERATION)
26102610 // Initialize the Bézier speed curve
@@ -2671,7 +2671,7 @@ uint32_t Stepper::block_phase_isr() {
26712671#if ENABLED(INTEGRATED_BABYSTEPPING)
26722672
26732673 // Timer interrupt for baby-stepping
2674- uint32_t Stepper::babystepping_isr () {
2674+ hal_timer_t Stepper::babystepping_isr () {
26752675 babystep.task ();
26762676 return babystep.has_steps () ? BABYSTEP_TICKS : BABYSTEP_NEVER;
26772677 }
0 commit comments