diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-05-28 11:07:11 -0400 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2019-06-04 09:50:30 -0400 |
commit | 4ccc218b065897ab4d0e5eebe6a5a92e1a3af28d (patch) | |
tree | 94446e369af36a0708775fabd60195eed7de466a /klippy | |
parent | ac8f6dfe20cbd59d6c6f5a187e430e16afaee9a8 (diff) | |
download | kutter-4ccc218b065897ab4d0e5eebe6a5a92e1a3af28d.tar.gz kutter-4ccc218b065897ab4d0e5eebe6a5a92e1a3af28d.tar.xz kutter-4ccc218b065897ab4d0e5eebe6a5a92e1a3af28d.zip |
gcode: Add action_x() callables to get_status()
Add action_respond_info(), action_respond_error(), and
action_emergency_stop() callables to the get_status() return
dictionary. This allows gcode macros to directly invoke these
actions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/gcode.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/klippy/gcode.py b/klippy/gcode.py index 975bfcfe..c66008a7 100644 --- a/klippy/gcode.py +++ b/klippy/gcode.py @@ -103,6 +103,15 @@ class GCodeParser: self.position_with_transform = transform.get_position def stats(self, eventtime): return False, "gcodein=%d" % (self.bytes_read,) + def _action_emergency_stop(self, msg="action_emergency_stop"): + self.printer.invoke_shutdown("Shutdown due to %s" % (msg,)) + return "" + def _action_respond_info(self, msg): + self.respond_info(msg) + return "" + def _action_respond_error(self, msg): + self.respond_error(msg) + return "" def _get_gcode_position(self): p = [lp - bp for lp, bp in zip(self.last_position, self.base_position)] p[3] /= self.extrude_factor @@ -134,7 +143,10 @@ class GCodeParser: 'base_epos': self.base_position[3], 'homing_xpos': self.homing_position[0], 'homing_ypos': self.homing_position[1], - 'homing_zpos': self.homing_position[2] + 'homing_zpos': self.homing_position[2], + 'action_respond_info': self._action_respond_info, + 'action_respond_error': self._action_respond_error, + 'action_emergency_stop': self._action_emergency_stop, } def _handle_shutdown(self): if not self.is_printer_ready: |