aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/statistics.py
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/extras/statistics.py')
-rw-r--r--klippy/extras/statistics.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/klippy/extras/statistics.py b/klippy/extras/statistics.py
index 639bcad3..84186ed1 100644
--- a/klippy/extras/statistics.py
+++ b/klippy/extras/statistics.py
@@ -11,13 +11,13 @@ class PrinterStats:
reactor = self.printer.get_reactor()
self.stats_timer = reactor.register_timer(self.generate_stats)
self.stats_cb = []
- def printer_state(self, state):
- if state == 'ready':
- self.stats_cb = [o.stats for n, o in self.printer.lookup_objects()
- if hasattr(o, 'stats')]
- if self.printer.get_start_args().get('debugoutput') is None:
- reactor = self.printer.get_reactor()
- reactor.update_timer(self.stats_timer, reactor.NOW)
+ self.printer.register_event_handler("klippy:ready", self.handle_ready)
+ def handle_ready(self):
+ self.stats_cb = [o.stats for n, o in self.printer.lookup_objects()
+ if hasattr(o, 'stats')]
+ if self.printer.get_start_args().get('debugoutput') is None:
+ reactor = self.printer.get_reactor()
+ reactor.update_timer(self.stats_timer, reactor.NOW)
def generate_stats(self, eventtime):
stats = [cb(eventtime) for cb in self.stats_cb]
if max([s[0] for s in stats]):