extruder: Remove support for lookahead() method

Now that the extruder lookahead method is no longer used it can be
removed from the toolhead and extruder classes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-11-02 21:08:07 -04:00
parent 5f5896ad71
commit 89d1ab7c04
2 changed files with 4 additions and 20 deletions

View File

@ -135,8 +135,6 @@ class PrinterExtruder:
if diff_r: if diff_r:
return (self.instant_corner_v / abs(diff_r))**2 return (self.instant_corner_v / abs(diff_r))**2
return move.max_cruise_v2 return move.max_cruise_v2
def lookahead(self, moves, flush_count, lazy):
return flush_count
def move(self, print_time, move): def move(self, print_time, move):
axis_r = move.axes_r[3] axis_r = move.axes_r[3]
accel = move.accel * axis_r accel = move.accel * axis_r
@ -183,8 +181,6 @@ class DummyExtruder:
move.end_pos, "Extrude when no extruder present") move.end_pos, "Extrude when no extruder present")
def calc_junction(self, prev_move, move): def calc_junction(self, prev_move, move):
return move.max_cruise_v2 return move.max_cruise_v2
def lookahead(self, moves, flush_count, lazy):
return flush_count
def get_heater(self): def get_heater(self):
raise homing.CommandError("Extruder not configured") raise homing.CommandError("Extruder not configured")

View File

@ -105,18 +105,13 @@ LOOKAHEAD_FLUSH_TIME = 0.250
class MoveQueue: class MoveQueue:
def __init__(self, toolhead): def __init__(self, toolhead):
self.toolhead = toolhead self.toolhead = toolhead
self.extruder_lookahead = None
self.queue = [] self.queue = []
self.leftover = 0
self.junction_flush = LOOKAHEAD_FLUSH_TIME self.junction_flush = LOOKAHEAD_FLUSH_TIME
def reset(self): def reset(self):
del self.queue[:] del self.queue[:]
self.leftover = 0
self.junction_flush = LOOKAHEAD_FLUSH_TIME self.junction_flush = LOOKAHEAD_FLUSH_TIME
def set_flush_time(self, flush_time): def set_flush_time(self, flush_time):
self.junction_flush = flush_time self.junction_flush = flush_time
def set_extruder(self, extruder):
self.extruder_lookahead = extruder.lookahead
def flush(self, lazy=False): def flush(self, lazy=False):
self.junction_flush = LOOKAHEAD_FLUSH_TIME self.junction_flush = LOOKAHEAD_FLUSH_TIME
update_flush_count = lazy update_flush_count = lazy
@ -127,7 +122,7 @@ class MoveQueue:
# after the last move. # after the last move.
delayed = [] delayed = []
next_end_v2 = next_smoothed_v2 = peak_cruise_v2 = 0. next_end_v2 = next_smoothed_v2 = peak_cruise_v2 = 0.
for i in range(flush_count-1, self.leftover-1, -1): for i in range(flush_count-1, -1, -1):
move = queue[i] move = queue[i]
reachable_start_v2 = next_end_v2 + move.delta_v2 reachable_start_v2 = next_end_v2 + move.delta_v2
start_v2 = min(move.max_start_v2, reachable_start_v2) start_v2 = min(move.max_start_v2, reachable_start_v2)
@ -163,17 +158,12 @@ class MoveQueue:
delayed.append((move, start_v2, next_end_v2)) delayed.append((move, start_v2, next_end_v2))
next_end_v2 = start_v2 next_end_v2 = start_v2
next_smoothed_v2 = smoothed_v2 next_smoothed_v2 = smoothed_v2
if update_flush_count: if update_flush_count or not flush_count:
return
# Allow extruder to do its lookahead
move_count = self.extruder_lookahead(queue, flush_count, lazy)
self.leftover = flush_count - move_count
if not move_count:
return return
# Generate step times for all moves ready to be flushed # Generate step times for all moves ready to be flushed
self.toolhead._process_moves(queue[:move_count]) self.toolhead._process_moves(queue[:flush_count])
# Remove processed moves from the queue # Remove processed moves from the queue
del queue[:move_count] del queue[:flush_count]
def add_move(self, move): def add_move(self, move):
self.queue.append(move) self.queue.append(move)
if len(self.queue) == 1: if len(self.queue) == 1:
@ -250,7 +240,6 @@ class ToolHead:
self.step_generators = [] self.step_generators = []
# Create kinematics class # Create kinematics class
self.extruder = kinematics.extruder.DummyExtruder() self.extruder = kinematics.extruder.DummyExtruder()
self.move_queue.set_extruder(self.extruder)
kin_name = config.get('kinematics') kin_name = config.get('kinematics')
try: try:
mod = importlib.import_module('kinematics.' + kin_name) mod = importlib.import_module('kinematics.' + kin_name)
@ -427,7 +416,6 @@ class ToolHead:
eventtime = self.reactor.pause(eventtime + 0.100) eventtime = self.reactor.pause(eventtime + 0.100)
def set_extruder(self, extruder, extrude_pos): def set_extruder(self, extruder, extrude_pos):
self.extruder = extruder self.extruder = extruder
self.move_queue.set_extruder(extruder)
self.commanded_pos[3] = extrude_pos self.commanded_pos[3] = extrude_pos
def get_extruder(self): def get_extruder(self):
return self.extruder return self.extruder