aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2023-10-21 15:45:47 -0400
committerKevin O'Connor <kevin@koconnor.net>2023-10-21 15:46:08 -0400
commitf7567a0db954eabe4c6b8da3f73ce68693698646 (patch)
tree0c3fdca33f47cae492cded24cd427ea37399f307 /klippy/toolhead.py
parent6749985302fe002a9cb5672dab9badb11e4e3c36 (diff)
downloadkutter-f7567a0db954eabe4c6b8da3f73ce68693698646.tar.gz
kutter-f7567a0db954eabe4c6b8da3f73ce68693698646.tar.xz
kutter-f7567a0db954eabe4c6b8da3f73ce68693698646.zip
Revert "toolhead: Use dict for step generation flush times. (#6303)"
This reverts commit 6749985302fe002a9cb5672dab9badb11e4e3c36. A defect was found in the above commit (the input shaper code calls note_step_generateion_scan_time() for many steppers, so the input_shaper class can't be used as the index). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r--klippy/toolhead.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index 8334291e..d8b93825 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -239,8 +239,7 @@ class ToolHead:
self.drip_completion = None
# Kinematic step generation scan window time tracking
self.kin_flush_delay = SDS_CHECK_TIME
- # Map from requester to requested time
- self.kin_flush_times = {self: SDS_CHECK_TIME}
+ self.kin_flush_times = []
self.force_flush_time = self.last_kin_move_time = 0.
# Setup iterative solver
ffi_main, ffi_lib = chelper.get_ffi()
@@ -527,15 +526,15 @@ class ToolHead:
return self.trapq
def register_step_generator(self, handler):
self.step_generators.append(handler)
- def note_step_generation_scan_time(self, requester, delay):
+ def note_step_generation_scan_time(self, delay, old_delay=0.):
self.flush_step_generation()
- if delay == self.kin_flush_times.get(requester, None):
- return
+ cur_delay = self.kin_flush_delay
+ if old_delay:
+ self.kin_flush_times.pop(self.kin_flush_times.index(old_delay))
if delay:
- self.kin_flush_times[requester] = delay
- elif requester in self.kin_flush_times:
- del self.kin_flush_times[requester]
- self.kin_flush_delay = max(self.kin_flush_times.values())
+ self.kin_flush_times.append(delay)
+ new_delay = max(self.kin_flush_times + [SDS_CHECK_TIME])
+ self.kin_flush_delay = new_delay
def register_lookahead_callback(self, callback):
last_move = self.move_queue.get_last()
if last_move is None: