stepper: Support stepper phase adjustments when homing

Add support for enhancing the precision of endstop switches by also
inspecting the phase of the stepper motor when the endstop triggers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2016-07-26 22:06:14 -04:00
parent 170389ef14
commit 654546e338
6 changed files with 81 additions and 2 deletions

View File

@@ -11,7 +11,7 @@
# available pin and board names.)
# Pin names may be preceded by an '!' to indicate that a reverse
# polarity should be used (eg, trigger on low instead of high). Input
# pins may be prceded by an '^' to indicate that a hardware pull-up
# pins may be preceded by a '^' to indicate that a hardware pull-up
# resistor should be enabled for the pin.
@@ -38,6 +38,26 @@ homing_retract_dist: 5.0
# Distance to backoff (in mm) before homing a second time during homing
homing_positive_dir: False
# If true, homes in a positive direction (away from zero)
homing_stepper_phases: 0
# One may optionally set this to the number of phases of the stepper
# motor driver (which is the number of micro-steps multiplied by
# four). When set, the phase of the stepper driver will be used
# during homing to improve the accuracy of the endstop switch.
homing_endstop_accuracy: 0.200
# Sets the expected accuracy (in mm) of the endstop. This represents
# the maximum error distance the endstop may trigger (eg, if an
# endstop may occasionally trigger 100um early or up to 100um late
# then set this to 0.200 for 200um). This setting is used with
# homing_stepper_phases and is only useful if that parameter is also
# configured.
#homing_endstop_phase: 0
# This specifies the phase of the stepper motor driver to expect
# when hitting the endstop. This setting is only meaningful if
# homing_stepper_phases is also set. Only set this value if one is
# sure the stepper motor driver is reset every time the mcu is
# 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
# phase will be used on all subsequent homes.
position_min: -0.25
# Minimum valid distance (in mm) the user may command the stepper to
# move to (not currently enforced)

View File

@@ -12,6 +12,8 @@ max_velocity: 500
max_accel: 3000
endstop_pin: ^PB6
homing_speed: 50.0
homing_stepper_phases: 32
homing_endstop_accuracy: .200
position_min: -0.25
position_endstop: 0.0
position_max: 200
@@ -25,6 +27,8 @@ max_velocity: 500
max_accel: 3000
endstop_pin: ^PB5
homing_speed: 50.0
homing_stepper_phases: 32
homing_endstop_accuracy: .200
position_min: -0.25
position_endstop: 0.0
position_max: 250
@@ -39,6 +43,8 @@ max_accel: 30
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_endstop: 0.7
position_max: 200