homing: Move homing offset adjustment logic to generic homing code

Move the "stepper phase" adjustment logic from the kinematic classes
to the generic homing.py code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-10-09 12:53:01 -04:00
parent 770b92863f
commit d32506bd2e
4 changed files with 8 additions and 11 deletions

View File

@ -123,6 +123,14 @@ class Homing:
self.toolhead.set_position(forcepos)
self.homing_move(movepos, endstops, second_homing_speed,
verify_movement=self.verify_retract)
# Apply homing offsets
for rail in rails:
cp = rail.get_commanded_position()
rail.set_commanded_position(cp + rail.get_homed_offset())
adjustpos = self.toolhead.get_kinematics().calc_position()
for axis in homing_axes:
movepos[axis] = adjustpos[axis]
self.toolhead.set_position(movepos)
def home_axes(self, axes):
self.changed_axes = axes
try:

View File

@ -70,9 +70,6 @@ class CartKinematics:
if axis == 2:
limit_speed = self.max_z_velocity
homing_state.home_rails([rail], forcepos, homepos, limit_speed)
# Set final homed position
forcepos[axis] = hi.position_endstop + rail.get_homed_offset()
homing_state.set_homed_position(forcepos)
def home(self, homing_state):
# Each axis is homed independently and in order
for axis in homing_state.get_axes():

View File

@ -63,10 +63,6 @@ class CoreXYKinematics:
if axis == 2:
limit_speed = self.max_z_velocity
homing_state.home_rails([rail], forcepos, homepos, limit_speed)
if axis == 2:
# Support endstop phase detection on Z axis
forcepos[axis] = hi.position_endstop + rail.get_homed_offset()
homing_state.set_homed_position(forcepos)
def motor_off(self, print_time):
self.limits = [(1.0, -1.0)] * 3
for rail in self.rails:

View File

@ -103,10 +103,6 @@ class DeltaKinematics:
forcepos[2] = -1.5 * math.sqrt(max(self.arm2)-self.max_xy2)
homing_state.home_rails(self.rails, forcepos, self.home_position,
limit_speed=self.max_z_velocity)
# Set final homed position
spos = [ep + rail.get_homed_offset()
for ep, rail in zip(self.abs_endstops, self.rails)]
homing_state.set_homed_position(self._actuator_to_cartesian(spos))
def motor_off(self, print_time):
self.limit_xy2 = -1.
for rail in self.rails: