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>
This commit is contained in:
Kevin O'Connor 2018-02-05 13:52:05 -05:00
parent 08874b9c91
commit 0a5b07f9da
5 changed files with 12 additions and 20 deletions

View file

@ -77,7 +77,7 @@ class GCodeParser:
self.move_with_transform = transform.move
self.position_with_transform = transform.get_position
def stats(self, eventtime):
return "gcodein=%d" % (self.bytes_read,)
return False, "gcodein=%d" % (self.bytes_read,)
def printer_state(self, state):
if state == 'shutdown':
if not self.is_printer_ready: