Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix attempt for https://github.com/gin66/FastAccelStepper/issues/250 #252

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading