diff --git a/config/example.cfg b/config/example.cfg index ec383d75..a8f7aee4 100644 --- a/config/example.cfg +++ b/config/example.cfg @@ -19,8 +19,8 @@ [stepper_x] step_pin: ar29 # Step GPIO pin (triggered high) -dir_pin: ar28 -# Direction GPIO pin (low indicates positive direction) +dir_pin: !ar28 +# Direction GPIO pin (high indicates positive direction) enable_pin: !ar25 # Enable pin (default is enable high; use ! to indicate enable low) step_distance: .0225 @@ -86,7 +86,7 @@ position_max: 200 # stepper_x section [stepper_z] step_pin: ar23 -dir_pin: ar22 +dir_pin: !ar22 enable_pin: !ar25 step_distance: .005 max_velocity: 250 diff --git a/config/makergear-m2-2012.cfg b/config/makergear-m2-2012.cfg index 1db7ee1b..5634c580 100644 --- a/config/makergear-m2-2012.cfg +++ b/config/makergear-m2-2012.cfg @@ -5,7 +5,7 @@ [stepper_x] step_pin: PC0 -dir_pin: PL1 +dir_pin: !PL1 enable_pin: !PA7 step_distance: .0225 max_velocity: 500 @@ -20,7 +20,7 @@ position_max: 200 [stepper_y] step_pin: PC1 -dir_pin: !PL0 +dir_pin: PL0 enable_pin: !PA6 step_distance: .0225 max_velocity: 500 @@ -35,7 +35,7 @@ position_max: 250 [stepper_z] step_pin: PC2 -dir_pin: PL2 +dir_pin: !PL2 enable_pin: !PA5 step_distance: .005 max_velocity: 250 @@ -51,7 +51,7 @@ position_max: 200 [extruder] step_pin: PC3 -dir_pin: !PL6 +dir_pin: PL6 enable_pin: !PA4 step_distance: .004242 max_velocity: 200000 diff --git a/klippy/cartesian.py b/klippy/cartesian.py index 16db25d2..0a5f7961 100644 --- a/klippy/cartesian.py +++ b/klippy/cartesian.py @@ -105,9 +105,9 @@ class CartKinematics: self.stepper_pos[i] = new_step_pos steps = move.axes_d[i] * inv_step_dist step_offset = step_pos - move.start_pos[i] * inv_step_dist + 0.5 - sdir = 0 + sdir = 1 if steps < 0: - sdir = 1 + sdir = 0 steps = -steps step_offset = 1. - step_offset mcu_time, so = self.steppers[i].prep_move(move_time, sdir) diff --git a/klippy/extruder.py b/klippy/extruder.py index 12f43141..e7f1b40c 100644 --- a/klippy/extruder.py +++ b/klippy/extruder.py @@ -97,9 +97,9 @@ class PrinterExtruder: steps = forward_d * inv_step_dist step_offset = self.stepper_pos - start_pos * inv_step_dist + 0.5 self.stepper_pos = new_step_pos - sdir = 0 + sdir = 1 if steps < 0: - sdir = 1 + sdir = 0 steps = -steps step_offset = 1. - step_offset mcu_time, so = self.stepper.prep_move(move_time, sdir) @@ -142,7 +142,7 @@ class PrinterExtruder: step_offset = start_pos * inv_step_dist - self.stepper_pos + 0.5 self.stepper_pos = new_step_pos mcu_time, so = self.stepper.prep_move( - move_time+accel_t+cruise_t+decel_t, 1) + move_time+accel_t+cruise_t+decel_t, 0) move_step_d = retract_d / steps 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);