diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2024-01-18 12:16:47 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2024-01-18 12:16:47 -0500 |
commit | 6cc409f6fb9f62226c56adcf80be32a0d2601ab1 (patch) | |
tree | ed28eee9614e3c91aeb8a8f6242a0254ee363e36 /klippy/toolhead.py | |
parent | d633ef2cfc6cd48e55f4c1ab5ae058d8adc5b970 (diff) | |
download | kutter-6cc409f6fb9f62226c56adcf80be32a0d2601ab1.tar.gz kutter-6cc409f6fb9f62226c56adcf80be32a0d2601ab1.tar.xz kutter-6cc409f6fb9f62226c56adcf80be32a0d2601ab1.zip |
toolhead: Rename MoveQueue class to LookAheadQueue
Rename this class so that is is not confused with the mcu "move
queue".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r-- | klippy/toolhead.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py index 0d609a4a..64189ca2 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -110,7 +110,7 @@ LOOKAHEAD_FLUSH_TIME = 0.250 # Class to track a list of pending move requests and to facilitate # "look-ahead" across moves to reduce acceleration between moves. -class MoveQueue: +class LookAheadQueue: def __init__(self, toolhead): self.toolhead = toolhead self.queue = [] @@ -211,8 +211,8 @@ class ToolHead: self.all_mcus = [ m for n, m in self.printer.lookup_objects(module='mcu')] self.mcu = self.all_mcus[0] - self.move_queue = MoveQueue(self) - self.move_queue.set_flush_time(BUFFER_TIME_HIGH) + self.lookahead = LookAheadQueue(self) + self.lookahead.set_flush_time(BUFFER_TIME_HIGH) self.commanded_pos = [0., 0., 0., 0.] # Velocity and acceleration control self.max_velocity = config.getfloat('max_velocity', above=0.) @@ -354,10 +354,10 @@ class ToolHead: self._advance_move_time(next_move_time) def _flush_lookahead(self): # Transit from "NeedPrime"/"Priming"/"Drip"/main state to "NeedPrime" - self.move_queue.flush() + self.lookahead.flush() self.special_queuing_state = "NeedPrime" self.need_check_pause = -1. - self.move_queue.set_flush_time(BUFFER_TIME_HIGH) + self.lookahead.set_flush_time(BUFFER_TIME_HIGH) self.check_stall_time = 0. def flush_step_generation(self): self._flush_lookahead() @@ -368,7 +368,7 @@ class ToolHead: self._flush_lookahead() self._calc_print_time() else: - self.move_queue.flush() + self.lookahead.flush() return self.print_time def _check_pause(self): eventtime = self.reactor.monotonic() @@ -462,7 +462,7 @@ class ToolHead: if move.axes_d[3]: self.extruder.check_move(move) self.commanded_pos[:] = move.end_pos - self.move_queue.add_move(move) + self.lookahead.add_move(move) if self.print_time > self.need_check_pause: self._check_pause() def manual_move(self, coord, speed): @@ -509,12 +509,12 @@ class ToolHead: def drip_move(self, newpos, speed, drip_completion): self.dwell(self.kin_flush_delay) # Transition from "NeedPrime"/"Priming"/main state to "Drip" state - self.move_queue.flush() + self.lookahead.flush() self.special_queuing_state = "Drip" self.need_check_pause = self.reactor.NEVER self.reactor.update_timer(self.flush_timer, self.reactor.NEVER) self.do_kick_flush_timer = False - self.move_queue.set_flush_time(BUFFER_TIME_HIGH) + self.lookahead.set_flush_time(BUFFER_TIME_HIGH) self.check_stall_time = 0. self.drip_completion = drip_completion # Submit move @@ -526,9 +526,9 @@ class ToolHead: raise # Transmit move in "drip" mode try: - self.move_queue.flush() + self.lookahead.flush() except DripModeEndSignal as e: - self.move_queue.reset() + self.lookahead.reset() self.trapq_finalize_moves(self.trapq, self.reactor.NEVER, 0) # Exit "Drip" state self.reactor.update_timer(self.flush_timer, self.reactor.NOW) @@ -548,7 +548,7 @@ class ToolHead: 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 + lookahead_empty = not self.lookahead.queue return self.print_time, est_print_time, lookahead_empty def get_status(self, eventtime): print_time = self.print_time @@ -566,7 +566,7 @@ class ToolHead: return res def _handle_shutdown(self): self.can_pause = False - self.move_queue.reset() + self.lookahead.reset() def get_kinematics(self): return self.kin def get_trapq(self): @@ -583,7 +583,7 @@ class ToolHead: 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() + last_move = self.lookahead.get_last() if last_move is None: callback(self.get_last_move_time()) return |