aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-01-11 12:04:03 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-01-11 12:04:03 -0500
commit8a6125c81c20aaa5e2fc38ac4981a00e1b21eeef (patch)
tree27be354082c0759f5ab8fd8e51c13b18ccd7cdfa
parent32632c8226139896e1becf87c0cdd47a8c0b89ed (diff)
downloadkutter-8a6125c81c20aaa5e2fc38ac4981a00e1b21eeef.tar.gz
kutter-8a6125c81c20aaa5e2fc38ac4981a00e1b21eeef.tar.xz
kutter-8a6125c81c20aaa5e2fc38ac4981a00e1b21eeef.zip
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>
-rw-r--r--src/stepper.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stepper.c b/src/stepper.c
index 8356ff24..a296914d 100644
--- a/src/stepper.c
+++ b/src/stepper.c
@@ -86,7 +86,7 @@ stepper_load_next(struct stepper *s, uint32_t min_next_time)
} else {
s->time.waketime = s->next_step_time;
}
- s->count = m->count * 2;
+ s->count = (uint32_t)m->count * 2;
}
if (m->flags & MF_DIR) {
s->position = -s->position + m->count;