From 039d3f05239e48f0ddfae5fb14cde00d817b9ed2 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 11 May 2017 14:01:06 -0400 Subject: [PATCH] stepper: It is not necessary to ensure gpio_out_write value is 0 or 1 The gpio_out_write() and gpio_out_setup() calls will check for zero and non-zero, so it is not necessary to explicitly convert to 0/1 in the stepper.c code. Signed-off-by: Kevin O'Connor --- src/stepper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stepper.c b/src/stepper.c index 749d470e..258ecfda 100644 --- a/src/stepper.c +++ b/src/stepper.c @@ -150,7 +150,7 @@ command_config_stepper(uint32_t *args) if (!CONFIG_INLINE_STEPPER_HACK) s->time.func = stepper_event; s->flags = args[4] ? SF_INVERT_STEP : 0; - s->step_pin = gpio_out_setup(args[1], s->flags & SF_INVERT_STEP ? 1 : 0); + s->step_pin = gpio_out_setup(args[1], s->flags & SF_INVERT_STEP); s->dir_pin = gpio_out_setup(args[2], 0); s->min_stop_interval = args[3]; s->position = -POSITION_BIAS; @@ -276,7 +276,7 @@ stepper_stop(struct stepper *s) s->count = 0; s->flags &= SF_INVERT_STEP; gpio_out_write(s->dir_pin, 0); - gpio_out_write(s->step_pin, s->flags & SF_INVERT_STEP ? 1 : 0); + gpio_out_write(s->step_pin, s->flags & SF_INVERT_STEP); while (s->first) { struct stepper_move *next = s->first->next; move_free(s->first);