mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-10-26 00:36:08 +02:00
load_cell: Only launch a callback in the klippy:ready event handler
It is not valid to pause in the klippy:ready callback, so perform the sensor startup process in a separate reactor task. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -383,7 +383,7 @@ class LoadCell:
|
||||
# startup, when klippy is ready, start capturing data
|
||||
printer.register_event_handler("klippy:ready", self._handle_ready)
|
||||
|
||||
def _handle_ready(self):
|
||||
def _handle_do_ready(self, eventtime):
|
||||
self.sensor.add_client(self._sensor_data_event)
|
||||
self.add_client(self._track_force)
|
||||
# announce calibration status on ready
|
||||
@@ -391,6 +391,8 @@ class LoadCell:
|
||||
self.printer.send_event("load_cell:calibrate", self)
|
||||
if self.is_tared():
|
||||
self.printer.send_event("load_cell:tare", self)
|
||||
def _handle_ready(self):
|
||||
self.printer.get_reactor().register_callback(self._handle_do_ready)
|
||||
|
||||
# convert raw counts to grams and broadcast to clients
|
||||
def _sensor_data_event(self, msg):
|
||||
|
||||
Reference in New Issue
Block a user