mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-06 21:44:13 -06:00
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 <kevin@koconnor.net>
This commit is contained in:
parent
797367b9f5
commit
857e7ed5f1
8 changed files with 32 additions and 37 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue