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>
This commit is contained in:
Kevin O'Connor 2019-07-11 18:00:21 -04:00
parent b2a8b0dd65
commit 7fefe52df7
1 changed files with 3 additions and 1 deletions

View File

@ -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);