aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
diff options
context:
space:
mode:
authorFrancois Chagnon <fc@francoischagnon.net>2023-12-30 11:34:21 -0500
committerGitHub <noreply@github.com>2023-12-30 11:34:21 -0500
commitd7f6348ae6e45e4b566d10974b10ab4bb111222b (patch)
tree8499e6a9404c0240f44a70f15d4c547db498d993 /klippy/toolhead.py
parentb502558052f40339baa04fcfcbbeb65aa77dc1d8 (diff)
downloadkutter-d7f6348ae6e45e4b566d10974b10ab4bb111222b.tar.gz
kutter-d7f6348ae6e45e4b566d10974b10ab4bb111222b.tar.xz
kutter-d7f6348ae6e45e4b566d10974b10ab4bb111222b.zip
toolhead: Keep stepcompress move history relative to current time (#6439)
Expire history relative to current time rather than last move in history queue Signed-off-by: Francois Chagnon <fc@francoischagnon.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r--klippy/toolhead.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index 125ad282..051a2c30 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -195,6 +195,7 @@ MIN_KIN_TIME = 0.100
MOVE_BATCH_TIME = 0.500
STEPCOMPRESS_FLUSH_TIME = 0.050
SDS_CHECK_TIME = 0.001 # step+dir+step filter in stepcompress.c
+MOVE_HISTORY_EXPIRE = 30.
DRIP_SEGMENT_TIME = 0.050
DRIP_TIME = 0.100
@@ -289,13 +290,15 @@ class ToolHead:
for sg in self.step_generators:
sg(sg_flush_time)
self.last_sg_flush_time = sg_flush_time
+ clear_history_time = self.mcu.estimated_print_time(
+ self.reactor.monotonic() - MOVE_HISTORY_EXPIRE)
# Free trapq entries that are no longer needed
free_time = sg_flush_time - self.kin_flush_delay
- self.trapq_finalize_moves(self.trapq, free_time)
- self.extruder.update_move_time(free_time)
+ self.trapq_finalize_moves(self.trapq, free_time, clear_history_time)
+ self.extruder.update_move_time(free_time, clear_history_time)
# Flush stepcompress and mcu steppersync
for m in self.all_mcus:
- m.flush_moves(flush_time)
+ m.flush_moves(flush_time, clear_history_time)
self.last_flush_time = flush_time
def _advance_move_time(self, next_print_time):
pt_delay = self.kin_flush_delay + STEPCOMPRESS_FLUSH_TIME
@@ -522,7 +525,7 @@ class ToolHead:
self.move_queue.flush()
except DripModeEndSignal as e:
self.move_queue.reset()
- self.trapq_finalize_moves(self.trapq, self.reactor.NEVER)
+ self.trapq_finalize_moves(self.trapq, self.reactor.NEVER, 0)
# Exit "Drip" state
self.reactor.update_timer(self.flush_timer, self.reactor.NOW)
self.flush_step_generation()