aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-01-14 16:46:21 -0500
committerKevin O'Connor <kevin@koconnor.net>2017-01-16 15:32:35 -0500
commit9c1bf1387c90ab7d5937bb210730acad10a4ba19 (patch)
tree8aa02f0337a03f0b6f0af0509014eef649993f48
parentfc6a31eac8bcb3789187b2b4df49776fb8a2a86d (diff)
downloadkutter-9c1bf1387c90ab7d5937bb210730acad10a4ba19.tar.gz
kutter-9c1bf1387c90ab7d5937bb210730acad10a4ba19.tar.xz
kutter-9c1bf1387c90ab7d5937bb210730acad10a4ba19.zip
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>
-rw-r--r--klippy/toolhead.py10
1 files 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