stepper: Fix bug when using a non-zero CONFIG_STEP_DELAY on AVR

Make sure to explicitly cast to 32bit integers when doing math on
16bit integers that require the extra precision as the AVR uses a
16bit int.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-01-11 12:04:03 -05:00
parent 32632c8226
commit 8a6125c81c
1 changed files with 1 additions and 1 deletions

View File

@ -86,7 +86,7 @@ stepper_load_next(struct stepper *s, uint32_t min_next_time)
} else { } else {
s->time.waketime = s->next_step_time; s->time.waketime = s->next_step_time;
} }
s->count = m->count * 2; s->count = (uint32_t)m->count * 2;
} }
if (m->flags & MF_DIR) { if (m->flags & MF_DIR) {
s->position = -s->position + m->count; s->position = -s->position + m->count;