homing: Directly interact with the kinematic class on query_endstops()

Move the query_endstop logic out of toolhead.py and into homing.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-12-06 10:13:58 -05:00
parent 8d9ca6f2dd
commit f6d4284d5c
6 changed files with 15 additions and 21 deletions

View file

@ -87,11 +87,9 @@ class Homing:
self.toolhead.motor_off()
raise
def query_endstops(print_time, query_flags, steppers):
if query_flags == "get_mcu_position":
# Only the commanded position is requested
return [(s.name.upper(), s.mcu_stepper.get_mcu_position())
for s in steppers]
def query_endstops(toolhead):
print_time = toolhead.get_last_move_time()
steppers = toolhead.get_kinematics().get_steppers()
out = []
for s in steppers:
for mcu_endstop, name in s.get_endstops():
@ -101,6 +99,10 @@ def query_endstops(print_time, query_flags, steppers):
out.append((name, mcu_endstop.query_endstop_wait()))
return out
def query_position(toolhead):
steppers = toolhead.get_kinematics().get_steppers()
return [(s.name.upper(), s.mcu_stepper.get_mcu_position()) for s in steppers]
class EndstopError(Exception):
pass