|
@@ -365,8 +365,8 @@ void Stepper::isr() {
|
365
|
365
|
_NEXT_ISR(ocr_val);
|
366
|
366
|
|
367
|
367
|
#if DISABLED(LIN_ADVANCE)
|
368
|
|
- HAL_timer_restrain(STEP_TIMER_NUM, STEP_TIMER_MIN_INTERVAL);
|
369
|
|
- HAL_ENABLE_ISRs(); // re-enable ISRs
|
|
368
|
+ HAL_timer_restrain(STEP_TIMER_NUM, STEP_TIMER_MIN_INTERVAL * HAL_TICKS_PER_US);
|
|
369
|
+ HAL_ENABLE_ISRs();
|
370
|
370
|
#endif
|
371
|
371
|
|
372
|
372
|
return;
|
|
@@ -419,14 +419,14 @@ void Stepper::isr() {
|
419
|
419
|
if (current_block->steps[Z_AXIS] > 0) {
|
420
|
420
|
enable_Z();
|
421
|
421
|
_NEXT_ISR(HAL_STEPPER_TIMER_RATE / 1000); // Run at slow speed - 1 KHz
|
422
|
|
- HAL_ENABLE_ISRs(); // re-enable ISRs
|
|
422
|
+ HAL_ENABLE_ISRs();
|
423
|
423
|
return;
|
424
|
424
|
}
|
425
|
425
|
#endif
|
426
|
426
|
}
|
427
|
427
|
else {
|
428
|
428
|
_NEXT_ISR(HAL_STEPPER_TIMER_RATE / 1000); // Run at slow speed - 1 KHz
|
429
|
|
- HAL_ENABLE_ISRs(); // re-enable ISRs
|
|
429
|
+ HAL_ENABLE_ISRs();
|
430
|
430
|
return;
|
431
|
431
|
}
|
432
|
432
|
}
|
|
@@ -727,7 +727,8 @@ void Stepper::isr() {
|
727
|
727
|
}
|
728
|
728
|
|
729
|
729
|
#if DISABLED(LIN_ADVANCE)
|
730
|
|
- HAL_timer_restrain(STEP_TIMER_NUM, STEP_TIMER_MIN_INTERVAL);
|
|
730
|
+ // Make sure stepper ISR doesn't monopolize the CPU
|
|
731
|
+ HAL_timer_restrain(STEP_TIMER_NUM, STEP_TIMER_MIN_INTERVAL * HAL_TICKS_PER_US);
|
731
|
732
|
#endif
|
732
|
733
|
|
733
|
734
|
// If current block is finished, reset pointer
|
|
@@ -736,7 +737,7 @@ void Stepper::isr() {
|
736
|
737
|
planner.discard_current_block();
|
737
|
738
|
}
|
738
|
739
|
#if DISABLED(LIN_ADVANCE)
|
739
|
|
- HAL_ENABLE_ISRs(); // re-enable ISRs
|
|
740
|
+ HAL_ENABLE_ISRs();
|
740
|
741
|
#endif
|
741
|
742
|
}
|
742
|
743
|
|
|
@@ -889,9 +890,8 @@ void Stepper::isr() {
|
889
|
890
|
nextMainISR = 0;
|
890
|
891
|
}
|
891
|
892
|
|
892
|
|
- // Don't run the ISR faster than possible
|
893
|
|
- // Make sure stepper interrupt does not monopolise CPU by adjusting compare to give about 8µs room
|
894
|
|
- HAL_timer_restrain(STEP_TIMER_NUM, STEP_TIMER_MIN_INTERVAL);
|
|
893
|
+ // Make sure stepper ISR doesn't monopolize the CPU
|
|
894
|
+ HAL_timer_restrain(STEP_TIMER_NUM, STEP_TIMER_MIN_INTERVAL * HAL_TICKS_PER_US);
|
895
|
895
|
|
896
|
896
|
// Restore original ISR settings
|
897
|
897
|
HAL_ENABLE_ISRs();
|