mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-11-02 03:16:02 +01:00
klippy: Convert printer_state("shutdown") to an event handler
Convert all users of the printer_state("shutdown") handler to register
a "klippy:shutdown" event handler instead.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -422,6 +422,7 @@ class MCU:
|
||||
self._name = config.get_name()
|
||||
if self._name.startswith('mcu '):
|
||||
self._name = self._name[4:]
|
||||
self._printer.register_event_handler("klippy:shutdown", self._shutdown)
|
||||
# Serial port
|
||||
self._serialport = config.get('serial', '/dev/ttyS0')
|
||||
baud = 0
|
||||
@@ -769,8 +770,6 @@ class MCU:
|
||||
self._connect()
|
||||
elif state == 'disconnect':
|
||||
self._disconnect()
|
||||
elif state == 'shutdown':
|
||||
self._shutdown()
|
||||
def __del__(self):
|
||||
self._disconnect()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user