|
|
@ -365,11 +365,7 @@ void Stepper::isr() { |
|
|
|
_NEXT_ISR(ocr_val); |
|
|
|
|
|
|
|
#if DISABLED(LIN_ADVANCE) |
|
|
|
#ifdef CPU_32_BIT |
|
|
|
HAL_timer_set_compare(STEP_TIMER_NUM, ocr_val); |
|
|
|
#else |
|
|
|
NOLESS(OCR1A, TCNT1 + 16); |
|
|
|
#endif |
|
|
|
HAL_timer_restrain(STEP_TIMER_NUM, STEP_TIMER_MIN_INTERVAL); |
|
|
|
HAL_ENABLE_ISRs(); // re-enable ISRs
|
|
|
|
#endif |
|
|
|
|
|
|
@ -731,14 +727,7 @@ void Stepper::isr() { |
|
|
|
} |
|
|
|
|
|
|
|
#if DISABLED(LIN_ADVANCE) |
|
|
|
#ifdef CPU_32_BIT |
|
|
|
// Make sure stepper interrupt does not monopolise CPU by adjusting count to give about 8 us room
|
|
|
|
hal_timer_t stepper_timer_count = HAL_timer_get_compare(STEP_TIMER_NUM), |
|
|
|
stepper_timer_current_count = HAL_timer_get_count(STEP_TIMER_NUM) + 8 * HAL_TICKS_PER_US; |
|
|
|
HAL_timer_set_compare(STEP_TIMER_NUM, max(stepper_timer_count, stepper_timer_current_count)); |
|
|
|
#else |
|
|
|
NOLESS(OCR1A, TCNT1 + 16); |
|
|
|
#endif |
|
|
|
HAL_timer_restrain(STEP_TIMER_NUM, STEP_TIMER_MIN_INTERVAL); |
|
|
|
#endif |
|
|
|
|
|
|
|
// If current block is finished, reset pointer
|
|
|
@ -901,14 +890,8 @@ void Stepper::isr() { |
|
|
|
} |
|
|
|
|
|
|
|
// Don't run the ISR faster than possible
|
|
|
|
#ifdef CPU_32_BIT |
|
|
|
// Make sure stepper interrupt does not monopolise CPU by adjusting count to give about 8 us room
|
|
|
|
uint32_t stepper_timer_count = HAL_timer_get_compare(STEP_TIMER_NUM), |
|
|
|
stepper_timer_current_count = HAL_timer_get_count(STEP_TIMER_NUM) + 8 * HAL_TICKS_PER_US; |
|
|
|
HAL_timer_set_compare(STEP_TIMER_NUM, max(stepper_timer_count, stepper_timer_current_count)); |
|
|
|
#else |
|
|
|
NOLESS(OCR1A, TCNT1 + 16); |
|
|
|
#endif |
|
|
|
// Make sure stepper interrupt does not monopolise CPU by adjusting compare to give about 8µs room
|
|
|
|
HAL_timer_restrain(STEP_TIMER_NUM, STEP_TIMER_MIN_INTERVAL); |
|
|
|
|
|
|
|
// Restore original ISR settings
|
|
|
|
HAL_ENABLE_ISRs(); |
|
|
|