diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-09-18 21:11:11 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-09-19 17:25:42 -0400 |
commit | 2089f196707e3889f1920238e2f1bc09912a5492 (patch) | |
tree | c22be90a4e9a5c6d8c038798f923779828dd662c /klippy/toolhead.py | |
parent | 593741919f25a26f4a8d7b10e1dfaba7a23604c8 (diff) | |
download | kutter-2089f196707e3889f1920238e2f1bc09912a5492.tar.gz kutter-2089f196707e3889f1920238e2f1bc09912a5492.tar.xz kutter-2089f196707e3889f1920238e2f1bc09912a5492.zip |
toolhead: Separate is_active() code from stats() code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r-- | klippy/toolhead.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py index 7611e0bf..c0889306 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -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() |