diff --git a/Marlin/src/HAL/HAL_AVR/HAL.h b/Marlin/src/HAL/HAL_AVR/HAL.h index 3ce7d53ef..84cdc865f 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL.h +++ b/Marlin/src/HAL/HAL_AVR/HAL.h @@ -170,8 +170,6 @@ FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t freque #define _CAT(a, ...) a ## __VA_ARGS__ #define HAL_timer_set_compare(timer, compare) (_CAT(TIMER_OCR_, timer) = compare) -#define HAL_timer_restrain(timer, interval_ticks) NOLESS(_CAT(TIMER_OCR_, timer), _CAT(TIMER_COUNTER_, timer) + interval_ticks) - #define HAL_timer_get_compare(timer) _CAT(TIMER_OCR_, timer) #define HAL_timer_get_count(timer) _CAT(TIMER_COUNTER_, timer) diff --git a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h index 871ef995e..dd342f547 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h +++ b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h @@ -109,12 +109,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_CV; } -// if counter too high then bump up compare -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - void HAL_timer_enable_interrupt(const uint8_t timer_num); void HAL_timer_disable_interrupt(const uint8_t timer_num); bool HAL_timer_interrupt_enabled(const uint8_t timer_num); diff --git a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h index 2ddaf2dcf..a2d0c0b6d 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h @@ -98,12 +98,6 @@ void HAL_timer_set_compare(const uint8_t timer_num, const hal_timer_t count); hal_timer_t HAL_timer_get_compare(const uint8_t timer_num); hal_timer_t HAL_timer_get_count(const uint8_t timer_num); -// if counter too high then bump up compare -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - void HAL_timer_enable_interrupt(const uint8_t timer_num); void HAL_timer_disable_interrupt(const uint8_t timer_num); bool HAL_timer_interrupt_enabled(const uint8_t timer_num); diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h index 211333538..4257028fc 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h @@ -127,11 +127,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { return 0; } -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - FORCE_INLINE static void HAL_timer_enable_interrupt(const uint8_t timer_num) { switch (timer_num) { case 0: NVIC_EnableIRQ(TIMER0_IRQn); // Enable interrupt handler diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h index 132cf4d22..98542f837 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h @@ -151,11 +151,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_compare(const uint8_t timer_num) { } } -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) { switch (timer_num) { case STEP_TIMER_NUM: diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h index 943550d13..83081ed75 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h @@ -120,12 +120,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_compare(const uint8_t timer_num) { return __HAL_TIM_GET_AUTORELOAD(&TimerHandle[timer_num].handle); } -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) - HAL_timer_set_compare(timer_num, mincmp); -} - #ifdef STM32GENERIC FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) { if (__HAL_TIM_GET_FLAG(&TimerHandle[timer_num].handle, TIM_FLAG_UPDATE) == SET) diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp index c6b22fd44..8aaa1dbab 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp @@ -142,11 +142,6 @@ uint32_t HAL_timer_get_count(const uint8_t timer_num) { return __HAL_TIM_GetCounter(&timerConfig[timer_num].timerdef); } -void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - void HAL_timer_isr_prologue(const uint8_t timer_num) { if (__HAL_TIM_GET_FLAG(&timerConfig[timer_num].timerdef, TIM_FLAG_UPDATE) == SET) { __HAL_TIM_CLEAR_FLAG(&timerConfig[timer_num].timerdef, TIM_FLAG_UPDATE); diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h index a97bad75f..65bf5700e 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h @@ -96,8 +96,6 @@ void HAL_timer_disable_interrupt(const uint8_t timer_num); void HAL_timer_set_compare(const uint8_t timer_num, const uint32_t compare); hal_timer_t HAL_timer_get_compare(const uint8_t timer_num); uint32_t HAL_timer_get_count(const uint8_t timer_num); -void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks); - void HAL_timer_isr_prologue(const uint8_t timer_num); #define HAL_timer_isr_epilogue(TIMER_NUM) diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h index bef5e5a91..7a50b04c2 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h @@ -100,11 +100,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { return 0; } -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - void HAL_timer_enable_interrupt(const uint8_t timer_num); void HAL_timer_disable_interrupt(const uint8_t timer_num); bool HAL_timer_interrupt_enabled(const uint8_t timer_num); diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h index 5fed19e31..b44c31015 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h @@ -102,11 +102,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { return 0; } -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - void HAL_timer_enable_interrupt(const uint8_t timer_num); void HAL_timer_disable_interrupt(const uint8_t timer_num); bool HAL_timer_interrupt_enabled(const uint8_t timer_num);