mirror of
git://soft.sys114.com/klipper
synced 2026-02-12 17:40:25 +09: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:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user