homing: Create QueryEndstops class from gcode

Create the QueryEndstops in the gcode handler instead of in the
kinematic classes.  This simplifies the gcode handler as it can
directly register its response callback.

Also, store the stepper name in the stepper class.  Also, propagate
the print_time of the query request to the mcu_endstop class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-11-17 17:24:03 -05:00
parent 7ef8c0442a
commit 9e1059afb4
8 changed files with 37 additions and 36 deletions

View file

@ -6,9 +6,10 @@
import math, logging
class PrinterStepper:
def __init__(self, printer, config):
def __init__(self, printer, config, name):
self.printer = printer
self.config = config
self.name = name
self.mcu_stepper = self.mcu_enable = self.mcu_endstop = None
self.step_dist = config.getfloat('step_distance')
@ -76,10 +77,11 @@ class PrinterStepper:
mcu_time = self.mcu_endstop.print_to_mcu_time(move_time)
self.mcu_endstop.home(mcu_time, step_time)
return self.mcu_endstop
def query_endstop(self):
def query_endstop(self, print_time):
if self.mcu_endstop is None:
return None
self.mcu_endstop.query_endstop()
mcu_time = self.mcu_endstop.print_to_mcu_time(print_time)
self.mcu_endstop.query_endstop(mcu_time)
return self.mcu_endstop
def get_homed_offset(self):
if not self.homing_stepper_phases or self.need_motor_enable: