stepper: Use a sane default for homing_positive_dir

Use the endstop position to determine a sane default for
homing_positive_dir.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-07-24 14:12:17 -04:00
parent 143b7cccf4
commit 981c53682f
9 changed files with 46 additions and 42 deletions

View File

@ -15,9 +15,9 @@ dir_pin: ar55
enable_pin: !ar38 enable_pin: !ar38
step_distance: .01 step_distance: .01
endstop_pin: ^ar3 endstop_pin: ^ar3
homing_speed: 50.0
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
homing_speed: 50
# The stepper_y section is used to describe the Y axis as well as the # The stepper_y section is used to describe the Y axis as well as the
# stepper controlling the X-Y movement. # stepper controlling the X-Y movement.
@ -27,9 +27,9 @@ dir_pin: ar61
enable_pin: !ar56 enable_pin: !ar56
step_distance: .01 step_distance: .01
endstop_pin: ^ar14 endstop_pin: ^ar14
homing_speed: 50.0
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
homing_speed: 50
[stepper_z] [stepper_z]
step_pin: ar46 step_pin: ar46

View File

@ -16,12 +16,12 @@ dir_pin: ar55
enable_pin: !ar38 enable_pin: !ar38
step_distance: .01 step_distance: .01
endstop_pin: ^ar2 endstop_pin: ^ar2
homing_speed: 50.0
position_endstop: 297.05 position_endstop: 297.05
#angle: #angle:
# This option specifies the angle (in degrees) that the tower is # This option specifies the angle (in degrees) that the tower is
# at. The default is 210 for stepper_a, 330 for stepper_b, and 90 # at. The default is 210 for stepper_a, 330 for stepper_b, and 90
# for stepper_c. # for stepper_c.
homing_speed: 50
# The stepper_b section describes the stepper controlling the front # The stepper_b section describes the stepper controlling the front
# right tower (at 330 degrees). # right tower (at 330 degrees).

View File

@ -35,15 +35,27 @@ step_distance: .0225
endstop_pin: ^ar3 endstop_pin: ^ar3
# Endstop switch detection pin. This parameter must be provided for # Endstop switch detection pin. This parameter must be provided for
# the X, Y, and Z steppers on cartesian style printers. # the X, Y, and Z steppers on cartesian style printers.
#position_min: 0
# Minimum valid distance (in mm) the user may command the stepper to
# move to. The default is 0mm.
position_endstop: 0
# Location of the endstop (in mm). This parameter must be provided
# for the X, Y, and Z steppers on cartesian style printers.
position_max: 200
# Maximum valid distance (in mm) the user may command the stepper to
# move to. This parameter must be provided for the X, Y, and Z
# steppers on cartesian style printers.
#homing_speed: 5.0 #homing_speed: 5.0
# Maximum velocity (in mm/s) of the stepper when homing. The default # Maximum velocity (in mm/s) of the stepper when homing. The default
# is 5mm/s. # is 5mm/s.
#homing_retract_dist: 5.0 #homing_retract_dist: 5.0
# Distance to backoff (in mm) before homing a second time during # Distance to backoff (in mm) before homing a second time during
# homing. The default is 5mm. # homing. The default is 5mm.
#homing_positive_dir: False #homing_positive_dir:
# If true, homes in a positive direction (away from zero). The # If true, homing will cause the stepper to move in a positive
# default is False. # direction (away from zero); if false, home towards zero. The
# default is true if position_endstop is near position_max and false
# if near position_min.
#homing_stepper_phases: 0 #homing_stepper_phases: 0
# One may optionally set this to the number of phases of the stepper # One may optionally set this to the number of phases of the stepper
# motor driver (which is the number of micro-steps multiplied by # motor driver (which is the number of micro-steps multiplied by
@ -64,16 +76,6 @@ endstop_pin: ^ar3
# reset. If this is not set, but homing_stepper_phases is set, then # reset. If this is not set, but homing_stepper_phases is set, then
# the stepper phase will be detected on the first home and that # the stepper phase will be detected on the first home and that
# phase will be used on all subsequent homes. # phase will be used on all subsequent homes.
#position_min: 0
# Minimum valid distance (in mm) the user may command the stepper to
# move to. The default is 0mm.
position_endstop: 0
# Location of the endstop (in mm). This parameter must be provided
# for the X, Y, and Z steppers on cartesian style printers.
position_max: 200
# Maximum valid distance (in mm) the user may command the stepper to
# move to. This parameter must be provided for the X, Y, and Z
# steppers on cartesian style printers.
# The stepper_y section is used to describe the stepper controlling # The stepper_y section is used to describe the stepper controlling
# the Y axis in a cartesian robot. It has the same settings as the # the Y axis in a cartesian robot. It has the same settings as the

View File

@ -11,9 +11,9 @@ dir_pin: P8_12
enable_pin: !P9_14 enable_pin: !P9_14
step_distance: .0125 step_distance: .0125
endstop_pin: ^P8_8 endstop_pin: ^P8_8
homing_speed: 50
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
homing_speed: 50
[stepper_y] [stepper_y]
step_pin: P8_15 step_pin: P8_15
@ -21,9 +21,9 @@ dir_pin: P8_14
enable_pin: !P9_14 enable_pin: !P9_14
step_distance: .0125 step_distance: .0125
endstop_pin: ^P8_10 endstop_pin: ^P8_10
homing_speed: 50
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
homing_speed: 50
[stepper_z] [stepper_z]
step_pin: P8_19 step_pin: P8_19
@ -31,7 +31,6 @@ dir_pin: P8_18
enable_pin: !P9_14 enable_pin: !P9_14
step_distance: 0.00025 step_distance: 0.00025
endstop_pin: ^P9_13 endstop_pin: ^P9_13
homing_speed: 5
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200

View File

@ -10,9 +10,9 @@ enable_pin: !PA7
step_distance: .0125 step_distance: .0125
endstop_pin: ^PB6 endstop_pin: ^PB6
#endstop_pin: ^PA2 #endstop_pin: ^PA2
homing_speed: 50
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
homing_speed: 50
[stepper_y] [stepper_y]
step_pin: PC1 step_pin: PC1
@ -21,9 +21,9 @@ enable_pin: !PA6
step_distance: .0125 step_distance: .0125
endstop_pin: ^PB5 endstop_pin: ^PB5
#endstop_pin: ^PA1 #endstop_pin: ^PA1
homing_speed: 50
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
homing_speed: 50
[stepper_z] [stepper_z]
step_pin: PC2 step_pin: PC2
@ -32,7 +32,6 @@ enable_pin: !PA5
step_distance: 0.00025 step_distance: 0.00025
endstop_pin: ^PB4 endstop_pin: ^PB4
#endstop_pin: ^PC7 #endstop_pin: ^PC7
homing_speed: 5
position_endstop: 0.5 position_endstop: 0.5
position_max: 200 position_max: 200

View File

@ -11,9 +11,9 @@ enable_pin: !ar38
step_distance: .0125 step_distance: .0125
endstop_pin: ^ar3 endstop_pin: ^ar3
#endstop_pin: ^ar2 #endstop_pin: ^ar2
homing_speed: 50
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
homing_speed: 50
[stepper_y] [stepper_y]
step_pin: ar60 step_pin: ar60
@ -22,9 +22,9 @@ enable_pin: !ar56
step_distance: .0125 step_distance: .0125
endstop_pin: ^ar14 endstop_pin: ^ar14
#endstop_pin: ^ar15 #endstop_pin: ^ar15
homing_speed: 50
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
homing_speed: 50
[stepper_z] [stepper_z]
step_pin: ar46 step_pin: ar46
@ -33,7 +33,6 @@ enable_pin: !ar62
step_distance: 0.00025 step_distance: 0.00025
endstop_pin: ^ar18 endstop_pin: ^ar18
#endstop_pin: ^ar19 #endstop_pin: ^ar19
homing_speed: 5
position_endstop: 0.5 position_endstop: 0.5
position_max: 200 position_max: 200

View File

@ -11,9 +11,9 @@ dir_pin: P8_26
enable_pin: !P9_41 enable_pin: !P9_41
step_distance: .0125 step_distance: .0125
endstop_pin: ^P9_25 endstop_pin: ^P9_25
homing_speed: 50
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
homing_speed: 50
[stepper_y] [stepper_y]
step_pin: P8_12 step_pin: P8_12
@ -21,9 +21,9 @@ dir_pin: P8_19
enable_pin: !P9_41 enable_pin: !P9_41
step_distance: .0125 step_distance: .0125
endstop_pin: ^P9_23 endstop_pin: ^P9_23
homing_speed: 50
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200
homing_speed: 50
[stepper_z] [stepper_z]
step_pin: P8_13 step_pin: P8_13
@ -31,7 +31,6 @@ dir_pin: P8_14
enable_pin: !P9_41 enable_pin: !P9_41
step_distance: 0.00025 step_distance: 0.00025
endstop_pin: ^P9_13 endstop_pin: ^P9_13
homing_speed: 5
position_endstop: 0 position_endstop: 0
position_max: 200 position_max: 200

View File

@ -9,12 +9,11 @@ dir_pin: !PL1
enable_pin: !PA7 enable_pin: !PA7
step_distance: .0225 step_distance: .0225
endstop_pin: ^!PB6 endstop_pin: ^!PB6
homing_speed: 50.0
homing_stepper_phases: 32
homing_endstop_accuracy: .200
position_min: -0.25
position_endstop: 0.0 position_endstop: 0.0
position_max: 200 position_max: 200
homing_speed: 50
homing_stepper_phases: 32
homing_endstop_accuracy: .200
[stepper_y] [stepper_y]
step_pin: PC1 step_pin: PC1
@ -22,12 +21,11 @@ dir_pin: PL0
enable_pin: !PA6 enable_pin: !PA6
step_distance: .0225 step_distance: .0225
endstop_pin: ^!PB5 endstop_pin: ^!PB5
homing_speed: 50.0
homing_stepper_phases: 32
homing_endstop_accuracy: .200
position_min: -0.25
position_endstop: 0.0 position_endstop: 0.0
position_max: 250 position_max: 250
homing_speed: 50
homing_stepper_phases: 32
homing_endstop_accuracy: .200
[stepper_z] [stepper_z]
step_pin: PC2 step_pin: PC2
@ -35,13 +33,12 @@ dir_pin: !PL2
enable_pin: !PA5 enable_pin: !PA5
step_distance: .005 step_distance: .005
endstop_pin: ^!PB4 endstop_pin: ^!PB4
homing_speed: 4.0
homing_retract_dist: 2.0
homing_stepper_phases: 32
homing_endstop_accuracy: .050
position_min: 0.1 position_min: 0.1
position_endstop: 0.7 position_endstop: 0.7
position_max: 200 position_max: 200
homing_retract_dist: 2.0
homing_stepper_phases: 32
homing_endstop_accuracy: .070
[extruder] [extruder]
step_pin: PC3 step_pin: PC3

View File

@ -57,8 +57,17 @@ class PrinterHomingStepper(PrinterStepper):
self.position_endstop = config.getfloat('position_endstop') self.position_endstop = config.getfloat('position_endstop')
self.homing_speed = config.getfloat('homing_speed', 5.0, above=0.) self.homing_speed = config.getfloat('homing_speed', 5.0, above=0.)
self.homing_positive_dir = config.getboolean( self.homing_positive_dir = config.getboolean('homing_positive_dir', None)
'homing_positive_dir', False) if self.homing_positive_dir is None:
axis_len = self.position_max - self.position_min
if self.position_endstop <= self.position_min + axis_len / 4.:
self.homing_positive_dir = False
elif self.position_endstop >= self.position_max - axis_len / 4.:
self.homing_positive_dir = True
else:
raise config.error(
"Unable to infer homing_positive_dir in section '%s'" % (
config.section,))
self.homing_retract_dist = config.getfloat( self.homing_retract_dist = config.getfloat(
'homing_retract_dist', 5., above=0.) 'homing_retract_dist', 5., above=0.)
self.homing_stepper_phases = config.getint( self.homing_stepper_phases = config.getint(