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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user