diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-11-08 10:39:32 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-11-08 10:39:32 -0500 |
commit | afecf7ce36d4d712413d8c90ac055baa51cb26bd (patch) | |
tree | c4e19f68b397932ad608bb862ced3ba1412ecf97 /src/stepper.c | |
parent | 5e6127869ab767dcc39642af09e08c79efc84888 (diff) | |
download | kutter-afecf7ce36d4d712413d8c90ac055baa51cb26bd.tar.gz kutter-afecf7ce36d4d712413d8c90ac055baa51cb26bd.tar.xz kutter-afecf7ce36d4d712413d8c90ac055baa51cb26bd.zip |
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>
Diffstat (limited to 'src/stepper.c')
-rw-r--r-- | src/stepper.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stepper.c b/src/stepper.c index 0ef81904..57b0dd93 100644 --- a/src/stepper.c +++ b/src/stepper.c @@ -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); |