diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-09-22 11:09:20 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-09-22 11:29:27 -0400 |
commit | 0685802cb8b72c44e3e87e1011ed99b43d3bca44 (patch) | |
tree | ffffe062070549ad41a8435da67f1e67b090b1ff /klippy/gcode.py | |
parent | c8ff439722eae62d3e3bbb11f77c987b8e594959 (diff) | |
download | kutter-0685802cb8b72c44e3e87e1011ed99b43d3bca44.tar.gz kutter-0685802cb8b72c44e3e87e1011ed99b43d3bca44.tar.xz kutter-0685802cb8b72c44e3e87e1011ed99b43d3bca44.zip |
homing: Support querying the current status of endstops
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/gcode.py')
-rw-r--r-- | klippy/gcode.py | 16 |
1 files changed, 15 insertions, 1 deletions
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) |