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/gcode.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'klippy/gcode.py') diff --git a/klippy/gcode.py b/klippy/gcode.py index 0d5e832a..f280b43e 100644 --- a/klippy/gcode.py +++ b/klippy/gcode.py @@ -345,10 +345,13 @@ class GCodeParser: # Get Endstop Status if self.is_fileinput: return - print_time = self.toolhead.get_last_move_time() - query_state = homing.QueryEndstops(print_time, self.respond) - self.toolhead.query_endstops(query_state) - self.set_busy(query_state) + try: + res = self.toolhead.query_endstops() + except self.printer.mcu.error, e: + self.respond_error(str(e)) + return + self.respond(" ".join(["%s:%s" % (name, ["open", "TRIGGERED"][not not t]) + for name, t in res])) cmd_PID_TUNE_help = "Run PID Tuning" cmd_PID_TUNE_aliases = ["M303"] def cmd_PID_TUNE(self, params): -- cgit v1.2.3-70-g09d2