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:
Kevin O'Connor 2019-01-08 09:15:40 -05:00
parent b2d5a8e65b
commit fb7fe282c8
6 changed files with 31 additions and 27 deletions

View file

@ -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()