aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-10-18 12:04:50 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-10-28 18:39:45 -0400
commitd25e02144c3163f55419fbc247e51d4c0856187e (patch)
treecbf21f0762b2377da9d3520493984237ba27ad3e /klippy/toolhead.py
parenta5e55c2acc2650c70acd6bf852810e30fb959f96 (diff)
downloadkutter-d25e02144c3163f55419fbc247e51d4c0856187e.tar.gz
kutter-d25e02144c3163f55419fbc247e51d4c0856187e.tar.xz
kutter-d25e02144c3163f55419fbc247e51d4c0856187e.zip
idle_timeout: Add printing/ready/idle tracking
Internally track the overall printer state. Generate events on state transitions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r--klippy/toolhead.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index dff6e3fa..e1683451 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -265,10 +265,13 @@ class ToolHead:
for m in self.all_mcus:
m.flush_moves(flush_to_time)
def _calc_print_time(self):
- est_print_time = self.mcu.estimated_print_time(self.reactor.monotonic())
+ curtime = self.reactor.monotonic()
+ est_print_time = self.mcu.estimated_print_time(curtime)
if est_print_time + self.buffer_time_start > self.print_time:
self.print_time = est_print_time + self.buffer_time_start
self.last_print_start_time = self.print_time
+ self.printer.send_event("toolhead:sync_print_time",
+ curtime, est_print_time, self.print_time)
def get_next_move_time(self):
if self.sync_print_time:
self.sync_print_time = False
@@ -391,6 +394,10 @@ class ToolHead:
is_active = buffer_time > -60. or not self.sync_print_time
return is_active, "print_time=%.3f buffer_time=%.3f print_stall=%d" % (
self.print_time, max(buffer_time, 0.), self.print_stall)
+ def check_busy(self, eventtime):
+ est_print_time = self.mcu.estimated_print_time(eventtime)
+ lookahead_empty = not self.move_queue.queue
+ return self.print_time, est_print_time, lookahead_empty
def get_status(self, eventtime):
print_time = self.print_time
estimated_print_time = self.mcu.estimated_print_time(eventtime)