stepper: Default to a high direction pin meaning positive direction

Invert the default meaning of the stepper direction pin.  Instead of
treating a low value as position motion, treat a high value as
positive motion.  This matches what other firmwares do, and it matches
what common stepper motor drivers document.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-11-08 10:39:32 -05:00
parent 5e6127869a
commit afecf7ce36
5 changed files with 14 additions and 14 deletions

View file

@ -144,7 +144,7 @@ command_config_stepper(uint32_t *args)
s->step_pin = gpio_out_setup(args[1], s->flags & SF_INVERT_STEP ? 1 : 0);
s->dir_pin = gpio_out_setup(args[2], 0);
s->min_stop_interval = args[3];
s->position = STEPPER_POSITION_BIAS;
s->position = -STEPPER_POSITION_BIAS;
}
DECL_COMMAND(command_config_stepper,
"config_stepper oid=%c step_pin=%c dir_pin=%c"
@ -238,7 +238,7 @@ void
stepper_stop(struct stepper *s)
{
sched_del_timer(&s->time);
s->position = stepper_get_position(s);
s->position = -stepper_get_position(s);
s->count = 0;
s->flags &= SF_INVERT_STEP;
gpio_out_write(s->dir_pin, 0);