homing: Create Homing class from gcode

Create the Homing class in the gcode handler instead of in the
kinematic classes.  This will make it easier to pass error messages
back to the user.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-11-18 11:27:16 -05:00
parent 9e1059afb4
commit 781cf608d7
5 changed files with 20 additions and 19 deletions

View file

@ -31,10 +31,9 @@ class CartKinematics:
def get_homed_position(self):
return [s.position_endstop + s.get_homed_offset()*s.step_dist
for s in self.steppers]
def home(self, toolhead, axes):
def home(self, homing_state):
# Each axis is homed independently and in order
homing_state = homing.Homing(toolhead, axes)
for axis in axes:
for axis in homing_state.get_axes():
s = self.steppers[axis]
self.limits[axis] = (s.position_min, s.position_max)
# Determine moves
@ -60,7 +59,6 @@ class CartKinematics:
# Home again
coord[axis] = r2pos
homing_state.plan_home(list(coord), homepos, [s], s.homing_speed/2.0)
return homing_state
def motor_off(self, move_time):
self.limits = [(1.0, -1.0)] * 3
for stepper in self.steppers: