aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/mcu.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-09-19 13:18:55 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-09-22 11:15:17 -0400
commita7b81dc05cebc593ac4be2012142fbca9180e199 (patch)
tree0f3f4cc8591d2a59350fb5cee3bb58dd689ef6c3 /klippy/mcu.py
parent0824d3231975428429141dbd06cd6b04a4a74e14 (diff)
downloadkutter-a7b81dc05cebc593ac4be2012142fbca9180e199.tar.gz
kutter-a7b81dc05cebc593ac4be2012142fbca9180e199.tar.xz
kutter-a7b81dc05cebc593ac4be2012142fbca9180e199.zip
toolhead: Force a firmware shutdown on an unhandled exception
Check for unhandled exceptions and force the MCU to shutdown in that case. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/mcu.py')
-rw-r--r--klippy/mcu.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/klippy/mcu.py b/klippy/mcu.py
index 143b4042..884adbe5 100644
--- a/klippy/mcu.py
+++ b/klippy/mcu.py
@@ -252,6 +252,7 @@ class MCU:
self.is_shutdown = False
self.output_file_mode = False
# Config building
+ self._emergency_stop_cmd = None
self._num_oids = 0
self._config_cmds = []
self._config_crc = None
@@ -328,6 +329,8 @@ class MCU:
if err:
stats += " step_errors=%d" % (err,)
return stats
+ def force_shutdown(self):
+ self.send(self._emergency_stop_cmd.encode())
# Configuration phase
def _add_custom(self):
data = self._config.get('custom', '')
@@ -340,6 +343,7 @@ class MCU:
continue
self.add_config_cmd(line)
def build_config(self):
+ self._emergency_stop_cmd = self.lookup_command("emergency_stop")
# Build config commands
self._add_custom()
self._config_cmds.insert(0, "allocate_oids count=%d" % (
@@ -504,6 +508,8 @@ class DummyMCU:
pass
def stats(self, eventtime):
return ""
+ def force_shutdown(self):
+ pass
def build_config(self):
pass
def create_stepper(self, step_pin, dir_pin, min_stop_interval, max_error):