From 0685802cb8b72c44e3e87e1011ed99b43d3bca44 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 22 Sep 2016 11:09:20 -0400 Subject: homing: Support querying the current status of endstops Signed-off-by: Kevin O'Connor --- klippy/gcode.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'klippy/gcode.py') diff --git a/klippy/gcode.py b/klippy/gcode.py index f6f64d1e..529bd1dc 100644 --- a/klippy/gcode.py +++ b/klippy/gcode.py @@ -44,7 +44,7 @@ class GCodeParser: def build_handlers(self): shutdown_handlers = ['M105', 'M110', 'M114'] handlers = ['G0', 'G1', 'G4', 'G20', 'G21', 'G28', 'G90', 'G91', 'G92', - 'M18', 'M82', 'M83', 'M84', 'M110', 'M114', 'M206'] + 'M18', 'M82', 'M83', 'M84', 'M110', 'M114', 'M119', 'M206'] if self.heater_nozzle is not None: handlers.extend(['M104', 'M105', 'M109', 'M303']) if self.heater_bed is not None: @@ -294,6 +294,20 @@ class GCodeParser: self.last_position[0], self.last_position[1], self.last_position[2], self.last_position[3], kinpos[0], kinpos[1], kinpos[2])) + def cmd_M119(self, params): + # Get Endstop Status + if self.inputfile: + return + # Wrapper class for check_busy() that responds with final status + class endstop_handler_wrapper: + gcode = self + state = self.toolhead.query_endstops() + def check_busy(self, eventtime): + busy = self.state.check_busy(eventtime) + if not busy: + self.gcode.respond(self.state.get_msg()) + return busy + self.set_busy(endstop_handler_wrapper()) def cmd_M140(self, params): # Set Bed Temperature self.set_temp(self.heater_bed, params) -- cgit v1.2.3-70-g09d2