delta: Default stepper_b/c position_endstop to stepper_a's

If the position_endstop is not set for stepper_b or stepper_c then use
the value from stepper_a.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-11-01 21:21:37 -04:00
parent bc5d900e61
commit f8acf0f54f
3 changed files with 20 additions and 7 deletions

View File

@ -16,7 +16,13 @@ dir_pin: ar55
enable_pin: !ar38 enable_pin: !ar38
step_distance: .01 step_distance: .01
endstop_pin: ^ar2 endstop_pin: ^ar2
homing_speed: 50
position_endstop: 297.05 position_endstop: 297.05
# Distance (in mm) between the nozzle and the bed when the nozzle is
# in the center of the build area and the endstop triggers. This
# parameter must be provided for stepper_a; for stepper_b and
# stepper_c this parameter defaults to the value specified for
# stepper_a.
arm_length: 333.0 arm_length: 333.0
# Length (in mm) of the diagonal rod that connects this tower to the # Length (in mm) of the diagonal rod that connects this tower to the
# print head. This parameter must be provided for stepper_a; for # print head. This parameter must be provided for stepper_a; for
@ -26,7 +32,6 @@ arm_length: 333.0
# 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).
@ -36,7 +41,6 @@ dir_pin: ar61
enable_pin: !ar56 enable_pin: !ar56
step_distance: .01 step_distance: .01
endstop_pin: ^ar15 endstop_pin: ^ar15
position_endstop: 297.05
# The stepper_c section describes the stepper controlling the rear # The stepper_c section describes the stepper controlling the rear
# tower (at 90 degrees). # tower (at 90 degrees).
@ -46,7 +50,6 @@ dir_pin: ar48
enable_pin: !ar62 enable_pin: !ar62
step_distance: .01 step_distance: .01
endstop_pin: ^ar19 endstop_pin: ^ar19
position_endstop: 297.05
[extruder] [extruder]
step_pin: ar26 step_pin: ar26

View File

@ -15,8 +15,14 @@ class DeltaKinematics:
def __init__(self, toolhead, printer, config): def __init__(self, toolhead, printer, config):
stepper_configs = [config.getsection('stepper_' + n) stepper_configs = [config.getsection('stepper_' + n)
for n in ['a', 'b', 'c']] for n in ['a', 'b', 'c']]
self.steppers = [stepper.PrinterHomingStepper(printer, sconfig) stepper_a = stepper.PrinterHomingStepper(printer, stepper_configs[0])
for sconfig in stepper_configs] stepper_b = stepper.PrinterHomingStepper(
printer, stepper_configs[1],
default_position=stepper_a.position_endstop)
stepper_c = stepper.PrinterHomingStepper(
printer, stepper_configs[2],
default_position=stepper_a.position_endstop)
self.steppers = [stepper_a, stepper_b, stepper_c]
self.need_motor_enable = self.need_home = True self.need_motor_enable = self.need_home = True
radius = config.getfloat('delta_radius', above=0.) radius = config.getfloat('delta_radius', above=0.)
arm_length_a = stepper_configs[0].getfloat('arm_length', above=radius) arm_length_a = stepper_configs[0].getfloat('arm_length', above=radius)

View File

@ -51,13 +51,17 @@ class PrinterStepper:
# Support for stepper controlled linear axis with an endstop # Support for stepper controlled linear axis with an endstop
class PrinterHomingStepper(PrinterStepper): class PrinterHomingStepper(PrinterStepper):
def __init__(self, printer, config): def __init__(self, printer, config, default_position=None):
PrinterStepper.__init__(self, printer, config) PrinterStepper.__init__(self, printer, config)
# Endstop and its position # Endstop and its position
self.mcu_endstop = pins.setup_pin( self.mcu_endstop = pins.setup_pin(
printer, 'endstop', config.get('endstop_pin')) printer, 'endstop', config.get('endstop_pin'))
self.mcu_endstop.add_stepper(self.mcu_stepper) self.mcu_endstop.add_stepper(self.mcu_stepper)
if default_position is None:
self.position_endstop = config.getfloat('position_endstop') self.position_endstop = config.getfloat('position_endstop')
else:
self.position_endstop = config.getfloat(
'position_endstop', default_position)
# Axis range # Axis range
self.position_min = config.getfloat('position_min', 0.) self.position_min = config.getfloat('position_min', 0.)
self.position_max = config.getfloat( self.position_max = config.getfloat(