toolhead: Make sure max_corner_v2 is fully calculated on a lazy flush

Make sure max_corner_v2 is fully calculated before proactively
flushing moves from the lookahead queue.  Without this, some moves
would do unnecessary pressure advance during cornering.

Also, handle the min/max_corner_v2 calculations correctly in the rare
case where a move that does only acceleration is immediately followed
by a move that does only deceleration.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-01-14 16:46:21 -05:00
parent fc6a31eac8
commit 9c1bf1387c
1 changed files with 7 additions and 3 deletions

View File

@ -120,13 +120,17 @@ class MoveQueue:
, move.max_cruise_v2)
move_info[i] = (start_v2, cruise_v2, next_end_v2
, min_corner_v2, max_corner_v2)
# Calculate min/max_corner_v2 - the speed the head will
# slow to due to junction cornering and the maximum speed
# the head will reach immediately afterwards.
if reachable_start_v2 > start_v2:
min_corner_v2 = start_v2
if start_v2 + move.delta_v2 > next_end_v2:
max_corner_v2 = cruise_v2
if lazy:
if (start_v2 + move.delta_v2 > next_end_v2
or next_end_v2 >= move_info[i+1][1]):
if lazy and max_corner_v2:
flush_count = i
lazy = False
max_corner_v2 = cruise_v2
next_end_v2 = start_v2
if lazy:
flush_count = 0