From 9c1bf1387c90ab7d5937bb210730acad10a4ba19 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 14 Jan 2017 16:46:21 -0500 Subject: [PATCH] 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 --- klippy/toolhead.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/klippy/toolhead.py b/klippy/toolhead.py index 977cd7de..76f548cc 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -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