mirror of https://github.com/Desuuuu/klipper.git
toolhead: Separate is_active() code from stats() code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
593741919f
commit
2089f19670
|
@ -151,12 +151,12 @@ class Printer:
|
|||
toolhead = self.objects.get('toolhead')
|
||||
if toolhead is None or self.mcu is None:
|
||||
return eventtime + 1.
|
||||
is_active, thstats = toolhead.stats(eventtime)
|
||||
is_active = toolhead.check_active(eventtime)
|
||||
if not is_active and not force_output:
|
||||
return eventtime + 1.
|
||||
out = []
|
||||
out.append(self.gcode.stats(eventtime))
|
||||
out.append(thstats)
|
||||
out.append(toolhead.stats(eventtime))
|
||||
out.append(self.mcu.stats(eventtime))
|
||||
logging.info("Stats %.1f: %s" % (eventtime, ' '.join(out)))
|
||||
return eventtime + 1.
|
||||
|
|
|
@ -356,14 +356,15 @@ class ToolHead:
|
|||
self.move_queue.set_extruder(extruder)
|
||||
self.commanded_pos[3] = extrude_pos
|
||||
# Misc commands
|
||||
def check_active(self, eventtime):
|
||||
if not self.sync_print_time:
|
||||
return True
|
||||
return self.print_time + 60. > self.mcu.estimated_print_time(eventtime)
|
||||
def stats(self, eventtime):
|
||||
buffer_time = 0.
|
||||
print_time = self.print_time
|
||||
est_print_time = self.mcu.estimated_print_time(eventtime)
|
||||
is_active = not self.sync_print_time or print_time + 60. > est_print_time
|
||||
buffer_time = max(0., print_time - est_print_time)
|
||||
return is_active, "print_time=%.3f buffer_time=%.3f print_stall=%d" % (
|
||||
print_time, buffer_time, self.print_stall)
|
||||
buffer_time = max(0., self.print_time - est_print_time)
|
||||
return "print_time=%.3f buffer_time=%.3f print_stall=%d" % (
|
||||
self.print_time, buffer_time, self.print_stall)
|
||||
def force_shutdown(self):
|
||||
try:
|
||||
self.mcu.force_shutdown()
|
||||
|
|
Loading…
Reference in New Issue