From 156de2e4c2e59c6ce122918abbaadfc583eef444 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 9 Jun 2017 19:45:44 -0400 Subject: [PATCH] delta: Fix support for different endstop_position settings on each stepper The endstop_position is intended to support different values for each stepper so that the individual tower heights can be configured. Signed-off-by: Kevin O'Connor --- klippy/delta.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/klippy/delta.py b/klippy/delta.py index 370b11e6..fd3705e3 100644 --- a/klippy/delta.py +++ b/klippy/delta.py @@ -24,7 +24,7 @@ class DeltaKinematics: self.arm_length2 = arm_length**2 self.limit_xy2 = -1. tower_height_at_zeros = math.sqrt(self.arm_length2 - radius**2) - self.max_z = max([s.position_endstop for s in self.steppers]) + self.max_z = min([s.position_endstop for s in self.steppers]) self.limit_z = self.max_z - (arm_length - tower_height_at_zeros) logging.info( "Delta max build height %.2fmm (radius tapered above %.2fmm)" % ( @@ -119,9 +119,11 @@ class DeltaKinematics: homing_state.home(list(coord), homepos, self.steppers , s.homing_speed/2.0, second_home=True) # Set final homed position - coord = [s.mcu_stepper.get_commanded_position() + s.get_homed_offset() - for s in self.steppers] - homing_state.set_homed_position(self._actuator_to_cartesian(coord)) + spos = self._cartesian_to_actuator(homepos) + spos = [spos[i] + self.steppers[i].position_endstop - self.max_z + + self.steppers[i].get_homed_offset() + for i in StepList] + homing_state.set_homed_position(self._actuator_to_cartesian(spos)) def motor_off(self, move_time): self.limit_xy2 = -1. for stepper in self.steppers: