aboutsummaryrefslogtreecommitdiffstats
path: root/src/stepper.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-07-11 18:00:21 -0400
committerKevin O'Connor <kevin@koconnor.net>2019-07-12 07:54:24 -0400
commit7fefe52df7659599d40579c292845857fae216fc (patch)
treedfbe4cc5074db6c0d75d5f9d4556c6b0ce096887 /src/stepper.c
parentb2a8b0dd65c946f76f3de14c89258c504bd55748 (diff)
downloadkutter-7fefe52df7659599d40579c292845857fae216fc.tar.gz
kutter-7fefe52df7659599d40579c292845857fae216fc.tar.xz
kutter-7fefe52df7659599d40579c292845857fae216fc.zip
stepper: Don't update SF_LAST_DIR if SF_NEED_RESET
If the move is not added to the move queue, then the SF_LAST_DIR setting must not be changed. Otherwise, it could result in an incorrect direction being set on the stepper after a homing operation. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stepper.c')
-rw-r--r--src/stepper.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/stepper.c b/src/stepper.c
index 2b6575b3..dfab89df 100644
--- a/src/stepper.c
+++ b/src/stepper.c
@@ -221,8 +221,9 @@ command_queue_step(uint32_t *args)
if (m->count == 1 && (m->flags || flags & SF_LAST_RESET))
// count=1 moves after a reset or dir change can have small intervals
flags |= SF_NO_NEXT_CHECK;
- s->flags = flags & ~SF_LAST_RESET;
+ flags &= ~SF_LAST_RESET;
if (s->count) {
+ s->flags = flags;
if (s->first)
*s->plast = m;
else
@@ -231,6 +232,7 @@ command_queue_step(uint32_t *args)
} else if (flags & SF_NEED_RESET) {
move_free(m);
} else {
+ s->flags = flags;
s->first = m;
stepper_load_next(s, s->next_step_time + m->interval);
sched_add_timer(&s->time);