Skip to content

Commit

Permalink
Merge pull request #252 from SHWotever/BugFix250
Browse files Browse the repository at this point in the history
Fix attempt for #250
  • Loading branch information
gin66 authored Apr 26, 2024
2 parents a0da791 + c827ba2 commit da0c2a1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/StepperISR_avr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define Stepper_IsDisconnected(T, X) \
((TCCR##T##A & (_BV(COM##T##X##0) | _BV(COM##T##X##1))) == 0)
#define Stepper_IsOneIfOutput(T, X) ((TCCR##T##A & _BV(COM##T##X##0)) != 0)
#define Stepper_ToggleDirection(CHANNEL) *fas_queue_##CHANNEL._dirPinPort ^= fas_queue_##CHANNEL._dirPinMask

#ifdef SIMAVR_TIME_MEASUREMENT
#define prepareISRtimeMeasurement() DDRB |= 0x18
Expand Down Expand Up @@ -119,6 +120,8 @@ void StepperQueue::init(uint8_t queue_num, uint8_t step_pin) {
#endif
}



// The interrupt is called on compare event, which eventually
// generates a L->H transition. In any case, the current command's
// wait time has still to be executed for the next command, if any.
Expand Down Expand Up @@ -161,6 +164,9 @@ void StepperQueue::init(uint8_t queue_num, uint8_t step_pin) {
*/ \
fas_queue_##CHANNEL._prepareForStop = false; \
if (e->steps > 0) { \
if (e->toggle_dir) { \
Stepper_ToggleDirection(CHANNEL); \
} \
/* That's the problem, so generate a step */ \
Stepper_One(T, CHANNEL); \
ForceCompare(T, CHANNEL); \
Expand Down Expand Up @@ -188,7 +194,7 @@ void StepperQueue::init(uint8_t queue_num, uint8_t step_pin) {
Stepper_One(T, CHANNEL); \
} \
if (e->toggle_dir) { \
*fas_queue_##CHANNEL._dirPinPort ^= fas_queue_##CHANNEL._dirPinMask; \
Stepper_ToggleDirection(CHANNEL); \
} \
} else { \
fas_queue_##CHANNEL._prepareForStop = true; \
Expand Down

0 comments on commit da0c2a1

Please sign in to comment.