diff options
Diffstat (limited to 'klippy/extras/virtual_sdcard.py')
-rw-r--r-- | klippy/extras/virtual_sdcard.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/klippy/extras/virtual_sdcard.py b/klippy/extras/virtual_sdcard.py index 1a0fc2a8..e99e7cf4 100644 --- a/klippy/extras/virtual_sdcard.py +++ b/klippy/extras/virtual_sdcard.py @@ -8,6 +8,7 @@ import os, logging class VirtualSD: def __init__(self, config): printer = config.get_printer() + printer.register_event_handler("klippy:shutdown", self.handle_shutdown) # sdcard state sd = config.get('path') self.sdcard_dirname = os.path.normpath(os.path.expanduser(sd)) @@ -24,8 +25,8 @@ class VirtualSD: self.gcode.register_command(cmd, getattr(self, 'cmd_' + cmd)) for cmd in ['M28', 'M29', 'M30']: self.gcode.register_command(cmd, self.cmd_error) - def printer_state(self, state): - if state == 'shutdown' and self.work_timer is not None: + def handle_shutdown(self): + if self.work_timer is not None: self.must_pause_work = True try: readpos = max(self.file_position - 1024, 0) |