aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-02-25 21:26:27 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-02-25 21:26:27 -0500
commitadf6040e9eeb09299379ad980f8382538c163750 (patch)
tree349aa2a0d5fd4ac6948f580acd6b1b62607552f5 /klippy/toolhead.py
parentff9605c082b79f4054d57ee660f909b5b2a90010 (diff)
downloadkutter-adf6040e9eeb09299379ad980f8382538c163750.tar.gz
kutter-adf6040e9eeb09299379ad980f8382538c163750.tar.xz
kutter-adf6040e9eeb09299379ad980f8382538c163750.zip
gcode: Use an event to handle restart request actions
Instead of directly turning off motors, heaters, and fans from gcode.py, raise a new event and allow the heater, fan, and toolhead to handle the event as needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r--klippy/toolhead.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index 32bda0fc..9629dc8f 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -205,6 +205,8 @@ class ToolHead:
self.mcu = self.all_mcus[0]
self.move_queue = MoveQueue()
self.commanded_pos = [0., 0., 0., 0.]
+ self.printer.register_event_handler("gcode:request_restart",
+ self._handle_request_restart)
self.printer.register_event_handler("klippy:shutdown",
self._handle_shutdown)
# Velocity and acceleration control
@@ -416,6 +418,8 @@ class ToolHead:
return { 'status': status, 'print_time': print_time,
'estimated_print_time': estimated_print_time,
'printing_time': print_time - last_print_start_time }
+ def _handle_request_restart(self, print_time):
+ self.motor_off()
def _handle_shutdown(self):
self.move_queue.reset()
self.reset_print_time()