bed_mesh: lookup the toolhead object in "handle_connect"

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-04-01 06:33:14 -04:00 committed by KevinOConnor
parent d609753a6a
commit 74d527776e
1 changed files with 4 additions and 1 deletions

View File

@ -59,6 +59,8 @@ class BedMesh:
self.printer = config.get_printer() self.printer = config.get_printer()
self.printer.register_event_handler("klippy:ready", self.printer.register_event_handler("klippy:ready",
self.handle_ready) self.handle_ready)
self.printer.register_event_handler("klippy:connect",
self.handle_connect)
self.last_position = [0., 0., 0., 0.] self.last_position = [0., 0., 0., 0.]
self.bmc = BedMeshCalibrate(config, self) self.bmc = BedMeshCalibrate(config, self)
self.z_mesh = None self.z_mesh = None
@ -90,8 +92,9 @@ class BedMesh:
# Register transform # Register transform
gcode_move = self.printer.load_object(config, 'gcode_move') gcode_move = self.printer.load_object(config, 'gcode_move')
gcode_move.set_move_transform(self) gcode_move.set_move_transform(self)
def handle_ready(self): def handle_connect(self):
self.toolhead = self.printer.lookup_object('toolhead') self.toolhead = self.printer.lookup_object('toolhead')
def handle_ready(self):
self.bmc.print_generated_points(logging.info) self.bmc.print_generated_points(logging.info)
self.pmgr.initialize() self.pmgr.initialize()
def set_mesh(self, mesh): def set_mesh(self, mesh):