mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-08 07:27:43 -06: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:
parent
b2d5a8e65b
commit
fb7fe282c8
6 changed files with 31 additions and 27 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue