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:
parent
770b92863f
commit
d32506bd2e
|
@ -123,6 +123,14 @@ class Homing:
|
||||||
self.toolhead.set_position(forcepos)
|
self.toolhead.set_position(forcepos)
|
||||||
self.homing_move(movepos, endstops, second_homing_speed,
|
self.homing_move(movepos, endstops, second_homing_speed,
|
||||||
verify_movement=self.verify_retract)
|
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):
|
def home_axes(self, axes):
|
||||||
self.changed_axes = axes
|
self.changed_axes = axes
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -70,9 +70,6 @@ class CartKinematics:
|
||||||
if axis == 2:
|
if axis == 2:
|
||||||
limit_speed = self.max_z_velocity
|
limit_speed = self.max_z_velocity
|
||||||
homing_state.home_rails([rail], forcepos, homepos, limit_speed)
|
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):
|
def home(self, homing_state):
|
||||||
# Each axis is homed independently and in order
|
# Each axis is homed independently and in order
|
||||||
for axis in homing_state.get_axes():
|
for axis in homing_state.get_axes():
|
||||||
|
|
|
@ -63,10 +63,6 @@ class CoreXYKinematics:
|
||||||
if axis == 2:
|
if axis == 2:
|
||||||
limit_speed = self.max_z_velocity
|
limit_speed = self.max_z_velocity
|
||||||
homing_state.home_rails([rail], forcepos, homepos, limit_speed)
|
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):
|
def motor_off(self, print_time):
|
||||||
self.limits = [(1.0, -1.0)] * 3
|
self.limits = [(1.0, -1.0)] * 3
|
||||||
for rail in self.rails:
|
for rail in self.rails:
|
||||||
|
|
|
@ -103,10 +103,6 @@ class DeltaKinematics:
|
||||||
forcepos[2] = -1.5 * math.sqrt(max(self.arm2)-self.max_xy2)
|
forcepos[2] = -1.5 * math.sqrt(max(self.arm2)-self.max_xy2)
|
||||||
homing_state.home_rails(self.rails, forcepos, self.home_position,
|
homing_state.home_rails(self.rails, forcepos, self.home_position,
|
||||||
limit_speed=self.max_z_velocity)
|
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):
|
def motor_off(self, print_time):
|
||||||
self.limit_xy2 = -1.
|
self.limit_xy2 = -1.
|
||||||
for rail in self.rails:
|
for rail in self.rails:
|
||||||
|
|
Loading…
Reference in New Issue