virtual_sdcard: Move shutdown debugging to "klippy:analyze_shutdown" event

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2025-10-08 14:03:33 -04:00
parent e672391dbc
commit c64c5e891c

View File

@@ -16,8 +16,6 @@ DEFAULT_ERROR_GCODE = """
class VirtualSD:
def __init__(self, config):
self.printer = config.get_printer()
self.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))
@@ -46,7 +44,9 @@ class VirtualSD:
self.gcode.register_command(
"SDCARD_PRINT_FILE", self.cmd_SDCARD_PRINT_FILE,
desc=self.cmd_SDCARD_PRINT_FILE_help)
def handle_shutdown(self):
self.printer.register_event_handler("klippy:analyze_shutdown",
self._handle_analyze_shutdown)
def _handle_analyze_shutdown(self, msg, details):
if self.work_timer is not None:
self.must_pause_work = True
try: