aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/klippy.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-04-14 10:29:39 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-04-14 10:38:37 -0400
commitb9623c112833aa94bf82921187f135357a9f3cd0 (patch)
treed61223f6d92e0b1f1b2a8154146c308875fd7775 /klippy/klippy.py
parent7a386cff7d83dbe8b26801b9f8cab4b075aa5acd (diff)
downloadkutter-b9623c112833aa94bf82921187f135357a9f3cd0.tar.gz
kutter-b9623c112833aa94bf82921187f135357a9f3cd0.tar.xz
kutter-b9623c112833aa94bf82921187f135357a9f3cd0.zip
klippy: Don't log stats when the printer is idle
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/klippy.py')
-rw-r--r--klippy/klippy.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/klippy/klippy.py b/klippy/klippy.py
index a352663f..685d4d61 100644
--- a/klippy/klippy.py
+++ b/klippy/klippy.py
@@ -136,18 +136,21 @@ class Printer:
def set_fileoutput(self, debugoutput, dictionary):
self.debugoutput = debugoutput
self.dictionary = dictionary
- def stats(self, eventtime):
+ def stats(self, eventtime, force_output=False):
if self.need_dump_debug:
# Call dump_debug here so it is executed in the main thread
self.gcode.dump_debug()
self.need_dump_debug = False
+ toolhead = self.objects.get('toolhead')
+ if toolhead is None or self.mcu is None:
+ return
+ is_active, thstats = toolhead.stats(eventtime)
+ if not is_active and not force_output:
+ return
out = []
out.append(self.gcode.stats(eventtime))
- toolhead = self.objects.get('toolhead')
- if toolhead is not None:
- out.append(toolhead.stats(eventtime))
- if self.mcu is not None:
- out.append(self.mcu.stats(eventtime))
+ out.append(thstats)
+ out.append(self.mcu.stats(eventtime))
logging.info("Stats %.1f: %s" % (eventtime, ' '.join(out)))
return eventtime + 1.
def load_config(self):
@@ -238,14 +241,14 @@ class Printer:
def disconnect(self):
try:
if self.mcu is not None:
- self.stats(self.reactor.monotonic())
+ self.stats(self.reactor.monotonic(), force_output=True)
self.mcu.disconnect()
except:
logging.exception("Unhandled exception during disconnect")
def firmware_restart(self):
try:
if self.mcu is not None:
- self.stats(self.reactor.monotonic())
+ self.stats(self.reactor.monotonic(), force_output=True)
self.mcu.microcontroller_restart()
self.mcu.disconnect()
except: