From 857e7ed5f1a725e1342359b6c071586a3d495702 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 8 Jan 2019 11:09:55 -0500 Subject: klippy: Convert printer_state("connect") to an event handler Convert all users of the printer_state("connect") handler to register a "klippy:connect" event handler instead. Signed-off-by: Kevin O'Connor --- klippy/extras/z_tilt.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'klippy/extras/z_tilt.py') diff --git a/klippy/extras/z_tilt.py b/klippy/extras/z_tilt.py index 4e748dd0..04b7d4c1 100644 --- a/klippy/extras/z_tilt.py +++ b/klippy/extras/z_tilt.py @@ -9,6 +9,8 @@ import probe, mathutil class ZTilt: def __init__(self, config): self.printer = config.get_printer() + self.printer.register_event_handler("klippy:connect", + self.handle_connect) z_positions = config.get('z_positions').split('\n') try: z_positions = [line.split(',', 1) @@ -27,9 +29,6 @@ class ZTilt: self.gcode.register_command( 'Z_TILT_ADJUST', self.cmd_Z_TILT_ADJUST, desc=self.cmd_Z_TILT_ADJUST_help) - def printer_state(self, state): - if state == 'connect': - self.handle_connect() def handle_connect(self): kin = self.printer.lookup_object('toolhead').get_kinematics() z_steppers = kin.get_steppers('Z') -- cgit v1.2.3-70-g09d2