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