From a6de1db94d108f401f7f3e67f735743106e16837 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 8 Dec 2016 12:42:12 -0500 Subject: gcode: Rework endstop query to use greenlets Signed-off-by: Kevin O'Connor --- klippy/homing.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'klippy/homing.py') diff --git a/klippy/homing.py b/klippy/homing.py index 384da3dd..b1126b57 100644 --- a/klippy/homing.py +++ b/klippy/homing.py @@ -90,40 +90,6 @@ class Homing: def do_calc_position(self, callback): self.toolhead.set_position(self.fill_coord(callback(self))) -# Helper code for querying and reporting the status of the endstops -class QueryEndstops: - def __init__(self, print_time, respond_cb): - self.print_time = print_time - self.respond_cb = respond_cb - self.endstops = [] - self.busy = [] - def set_steppers(self, steppers): - for stepper in steppers: - es = stepper.query_endstop(self.print_time) - if es is None: - continue - self.endstops.append((stepper.name, es)) - self.busy.append((stepper.name, es)) - def check_busy(self, eventtime): - # Check if all endstop queries have been received - while self.busy: - try: - if self.busy[0][1].check_busy(eventtime): - return True - except mcu.error, e: - raise EndstopError("Failed to query endstop %s: %s" % ( - self.busy[0][0], str(e))) - self.busy.pop(0) - # All responses received - report status - msgs = [] - for name, es in self.endstops: - msg = "open" - if es.get_last_triggered(): - msg = "TRIGGERED" - msgs.append("%s:%s" % (name, msg)) - self.respond_cb(" ".join(msgs)) - return False - class EndstopError(Exception): pass -- cgit v1.2.3-70-g09d2