aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-10-12 15:15:14 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-10-12 16:28:53 -0400
commitf8750b142f56ebb1b9dd25a2fdfb5b28d33de57d (patch)
tree608ad8cd061845f705406e684d704cecdb8bd3ea /klippy/toolhead.py
parent3033b037893332b1175dfc1ed99bdeab50710e00 (diff)
downloadkutter-f8750b142f56ebb1b9dd25a2fdfb5b28d33de57d.tar.gz
kutter-f8750b142f56ebb1b9dd25a2fdfb5b28d33de57d.tar.xz
kutter-f8750b142f56ebb1b9dd25a2fdfb5b28d33de57d.zip
klippy: Rework shutdown handling
If an MCU signals a shutdown from the background thread, notify the main thread and handle the shutdown there. Dispatch shutdown handling from the main Printer() class instead of from the Toolhead class. This simplifies the shutdown logic. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r--klippy/toolhead.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index 6df5e17f..50fea974 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -292,7 +292,7 @@ class ToolHead:
self.last_flush_from_idle = True
except:
logging.exception("Exception in flush_handler")
- self.force_shutdown()
+ self.printer.invoke_shutdown("Exception in flush_handler")
return self.reactor.NEVER
# Motor off timer
def _motor_off_handler(self, eventtime):
@@ -305,7 +305,7 @@ class ToolHead:
self.motor_off()
except:
logging.exception("Exception in motor_off_handler")
- self.force_shutdown()
+ self.printer.invoke_shutdown("Exception in motor_off_handler")
return eventtime + self.motor_off_time
# Movement commands
def get_position(self):
@@ -371,14 +371,12 @@ class ToolHead:
buffer_time = max(0., self.print_time - est_print_time)
return "print_time=%.3f buffer_time=%.3f print_stall=%d" % (
self.print_time, buffer_time, self.print_stall)
- def force_shutdown(self):
+ def do_shutdown(self):
try:
- for m in self.all_mcus:
- m.force_shutdown()
self.move_queue.reset()
self.reset_print_time()
except:
- logging.exception("Exception in force_shutdown")
+ logging.exception("Exception in do_shutdown")
def get_max_velocity(self):
return self.max_velocity, self.max_accel
def get_max_axis_halt(self):