Skip to content

Commit

Permalink
aver: SetTimerCompareRelative() in ISR is not correct
Browse files Browse the repository at this point in the history
  • Loading branch information
gin66 committed Apr 28, 2024
1 parent 071557b commit efe5589
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/StepperISR_avr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void StepperQueue::init(uint8_t queue_num, uint8_t step_pin) {
else { \
e->steps--; \
} \
SetTimerCompareRelative(T, CHANNEL, ticks); \
OCR##T##CHANNEL += ticks; \
exitStepperISR(); \
}

Expand Down Expand Up @@ -231,7 +231,9 @@ AVR_CYCLIC_ISR_GEN(FAS_TIMER_MODULE)
/* enable compare interrupt */ \
EnableCompareInterrupt(T, CHANNEL); \
/* start */ \
SetTimerCompareRelative(T, CHANNEL, 10);
noInterrupts(); \
SetTimerCompareRelative(T, CHANNEL, 10); \
interrupts();

void StepperQueue::startQueue() {
uint8_t rp;
Expand Down

0 comments on commit efe5589

Please sign in to comment.