aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2023-12-11 12:42:11 -0500
committerKevin O'Connor <kevin@koconnor.net>2023-12-16 15:42:39 -0500
commit19862bc3b71437770ac8b847b106c50308e99fb9 (patch)
tree13c4ecd2fcb42ea073fc245e1b2254458782aa66 /klippy
parentf0753bd3381a86826082d5bf7a349c1f0b9f7e48 (diff)
downloadkutter-19862bc3b71437770ac8b847b106c50308e99fb9.tar.gz
kutter-19862bc3b71437770ac8b847b106c50308e99fb9.tar.xz
kutter-19862bc3b71437770ac8b847b106c50308e99fb9.zip
toolhead: Track separate time for flush_step_generation() and need_flush_time
Introduce a new step_gen_time variable for flush_step_generation(). This allows need_flush_time to be set to future times without interfering with flush_step_generation(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/toolhead.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index a04451c6..3e9b339a 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -238,7 +238,7 @@ class ToolHead:
# Flush tracking
self.flush_timer = self.reactor.register_timer(self._flush_handler)
self.do_kick_flush_timer = True
- self.last_flush_time = self.need_flush_time = 0.
+ self.last_flush_time = self.need_flush_time = self.step_gen_time = 0.
# Kinematic step generation scan window time tracking
self.kin_flush_delay = SDS_CHECK_TIME
self.kin_flush_times = []
@@ -341,7 +341,8 @@ class ToolHead:
# Generate steps for moves
if self.special_queuing_state:
self._update_drip_move_time(next_move_time)
- self.note_kinematic_activity(next_move_time + self.kin_flush_delay)
+ self.note_kinematic_activity(next_move_time + self.kin_flush_delay,
+ set_step_gen_time=True)
self._advance_move_time(next_move_time)
def _flush_lookahead(self):
# Transit from "NeedPrime"/"Priming"/"Drip"/main state to "NeedPrime"
@@ -352,7 +353,7 @@ class ToolHead:
self.check_stall_time = 0.
def flush_step_generation(self):
self._flush_lookahead()
- self._advance_flush_time(self.need_flush_time)
+ self._advance_flush_time(self.step_gen_time)
def get_last_move_time(self):
if self.special_queuing_state:
self._flush_lookahead()
@@ -492,7 +493,8 @@ class ToolHead:
self.drip_completion.wait(curtime + wait_time)
continue
npt = min(self.print_time + DRIP_SEGMENT_TIME, next_print_time)
- self.note_kinematic_activity(npt + self.kin_flush_delay)
+ self.note_kinematic_activity(npt + self.kin_flush_delay,
+ set_step_gen_time=True)
self._advance_move_time(npt)
def drip_move(self, newpos, speed, drip_completion):
self.dwell(self.kin_flush_delay)
@@ -574,8 +576,10 @@ class ToolHead:
callback(self.get_last_move_time())
return
last_move.timing_callbacks.append(callback)
- def note_kinematic_activity(self, kin_time):
+ def note_kinematic_activity(self, kin_time, set_step_gen_time=False):
self.need_flush_time = max(self.need_flush_time, kin_time)
+ if set_step_gen_time:
+ self.step_gen_time = max(self.step_gen_time, kin_time)
if self.do_kick_flush_timer:
self.do_kick_flush_timer = False
self.reactor.update_timer(self.flush_timer, self.reactor.NOW)