mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-05 04:54:11 -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
|
@ -53,6 +53,8 @@ class BedMesh:
|
|||
FADE_DISABLE = 0x7FFFFFFF
|
||||
def __init__(self, config):
|
||||
self.printer = config.get_printer()
|
||||
self.printer.register_event_handler("klippy:connect",
|
||||
self.handle_connect)
|
||||
self.last_position = [0., 0., 0., 0.]
|
||||
self.calibrate = BedMeshCalibrate(config, self)
|
||||
self.z_mesh = None
|
||||
|
@ -74,10 +76,9 @@ class BedMesh:
|
|||
'BED_MESH_CLEAR', self.cmd_BED_MESH_CLEAR,
|
||||
desc=self.cmd_BED_MESH_CLEAR_help)
|
||||
self.gcode.set_move_transform(self)
|
||||
def printer_state(self, state):
|
||||
if state == 'connect':
|
||||
self.toolhead = self.printer.lookup_object('toolhead')
|
||||
self.calibrate.load_default_profile()
|
||||
def handle_connect(self):
|
||||
self.toolhead = self.printer.lookup_object('toolhead')
|
||||
self.calibrate.load_default_profile()
|
||||
def set_mesh(self, mesh):
|
||||
if mesh is not None:
|
||||
if self.base_fade_target is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue