aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/klippy.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-02-05 13:52:05 -0500
committerKevin O'Connor <kevin@koconnor.net>2018-02-05 13:52:05 -0500
commit0a5b07f9dafb19fca4305aa141dbae9e7571977b (patch)
treec04804beb5c21220ec31328a395ad4ba6f2eab62 /klippy/klippy.py
parent08874b9c91544c012763766c51b6a0c279972140 (diff)
downloadkutter-0a5b07f9dafb19fca4305aa141dbae9e7571977b.tar.gz
kutter-0a5b07f9dafb19fca4305aa141dbae9e7571977b.tar.xz
kutter-0a5b07f9dafb19fca4305aa141dbae9e7571977b.zip
klippy: Allow any stats producer to determine when stats are needed
Instead of using the toolhead class to determine if stats should be reported, allow every printer object with a stats() callback to determine if stats are needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/klippy.py')
-rw-r--r--klippy/klippy.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/klippy/klippy.py b/klippy/klippy.py
index fba527a2..90370f6d 100644
--- a/klippy/klippy.py
+++ b/klippy/klippy.py
@@ -173,14 +173,10 @@ class Printer:
if self.bglogger is not None:
self.bglogger.set_rollover_info(name, info)
def _stats(self, eventtime, force_output=False):
- toolhead = self.objects.get('toolhead')
- if toolhead is None:
- return eventtime + 1.
- is_active = toolhead.check_active(eventtime)
- if not is_active and not force_output:
- return eventtime + 1.
stats = [cb(eventtime) for cb in self.stats_cb]
- logging.info("Stats %.1f: %s", eventtime, ' '.join(stats))
+ if max([s[0] for s in stats] + [force_output]):
+ logging.info("Stats %.1f: %s", eventtime,
+ ' '.join([s[1] for s in stats]))
return eventtime + 1.
def _try_load_module(self, config, section):
if section in self.objects: