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:
parent
b2a8b0dd65
commit
7fefe52df7
|
@ -221,8 +221,9 @@ command_queue_step(uint32_t *args)
|
||||||
if (m->count == 1 && (m->flags || flags & SF_LAST_RESET))
|
if (m->count == 1 && (m->flags || flags & SF_LAST_RESET))
|
||||||
// count=1 moves after a reset or dir change can have small intervals
|
// count=1 moves after a reset or dir change can have small intervals
|
||||||
flags |= SF_NO_NEXT_CHECK;
|
flags |= SF_NO_NEXT_CHECK;
|
||||||
s->flags = flags & ~SF_LAST_RESET;
|
flags &= ~SF_LAST_RESET;
|
||||||
if (s->count) {
|
if (s->count) {
|
||||||
|
s->flags = flags;
|
||||||
if (s->first)
|
if (s->first)
|
||||||
*s->plast = m;
|
*s->plast = m;
|
||||||
else
|
else
|
||||||
|
@ -231,6 +232,7 @@ command_queue_step(uint32_t *args)
|
||||||
} else if (flags & SF_NEED_RESET) {
|
} else if (flags & SF_NEED_RESET) {
|
||||||
move_free(m);
|
move_free(m);
|
||||||
} else {
|
} else {
|
||||||
|
s->flags = flags;
|
||||||
s->first = m;
|
s->first = m;
|
||||||
stepper_load_next(s, s->next_step_time + m->interval);
|
stepper_load_next(s, s->next_step_time + m->interval);
|
||||||
sched_add_timer(&s->time);
|
sched_add_timer(&s->time);
|
||||||
|
|
Loading…
Reference in New Issue