diff --git a/config/example-delta.cfg b/config/example-delta.cfg index dbd6f191..bd2859c1 100644 --- a/config/example-delta.cfg +++ b/config/example-delta.cfg @@ -16,7 +16,13 @@ dir_pin: ar55 enable_pin: !ar38 step_distance: .01 endstop_pin: ^ar2 +homing_speed: 50 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 # Length (in mm) of the diagonal rod that connects this tower to the # 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 # at. The default is 210 for stepper_a, 330 for stepper_b, and 90 # for stepper_c. -homing_speed: 50 # The stepper_b section describes the stepper controlling the front # right tower (at 330 degrees). @@ -36,7 +41,6 @@ dir_pin: ar61 enable_pin: !ar56 step_distance: .01 endstop_pin: ^ar15 -position_endstop: 297.05 # The stepper_c section describes the stepper controlling the rear # tower (at 90 degrees). @@ -46,7 +50,6 @@ dir_pin: ar48 enable_pin: !ar62 step_distance: .01 endstop_pin: ^ar19 -position_endstop: 297.05 [extruder] step_pin: ar26 diff --git a/klippy/delta.py b/klippy/delta.py index 5900a183..e2bb971a 100644 --- a/klippy/delta.py +++ b/klippy/delta.py @@ -15,8 +15,14 @@ class DeltaKinematics: def __init__(self, toolhead, printer, config): stepper_configs = [config.getsection('stepper_' + n) for n in ['a', 'b', 'c']] - self.steppers = [stepper.PrinterHomingStepper(printer, sconfig) - for sconfig in stepper_configs] + stepper_a = stepper.PrinterHomingStepper(printer, stepper_configs[0]) + 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 radius = config.getfloat('delta_radius', above=0.) arm_length_a = stepper_configs[0].getfloat('arm_length', above=radius) diff --git a/klippy/stepper.py b/klippy/stepper.py index 07798a1d..109d0904 100644 --- a/klippy/stepper.py +++ b/klippy/stepper.py @@ -51,13 +51,17 @@ class PrinterStepper: # Support for stepper controlled linear axis with an endstop class PrinterHomingStepper(PrinterStepper): - def __init__(self, printer, config): + def __init__(self, printer, config, default_position=None): PrinterStepper.__init__(self, printer, config) # Endstop and its position self.mcu_endstop = pins.setup_pin( printer, 'endstop', config.get('endstop_pin')) self.mcu_endstop.add_stepper(self.mcu_stepper) - self.position_endstop = config.getfloat('position_endstop') + if default_position is None: + self.position_endstop = config.getfloat('position_endstop') + else: + self.position_endstop = config.getfloat( + 'position_endstop', default_position) # Axis range self.position_min = config.getfloat('position_min', 0.) self.position_max = config.getfloat(