aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-02-20 12:37:43 -0500
committerKevin O'Connor <kevin@koconnor.net>2017-02-20 12:50:12 -0500
commit566699f68a6423a8bfc729d308b973def3347014 (patch)
tree3ac6198d54ee39f80b4592b968224a023127f0ef
parent29ba92a5514de0bb6ccdad6e95c8b54f3d8a5e92 (diff)
downloadkutter-566699f68a6423a8bfc729d308b973def3347014.tar.gz
kutter-566699f68a6423a8bfc729d308b973def3347014.tar.xz
kutter-566699f68a6423a8bfc729d308b973def3347014.zip
toolhead: Fix error in lookahead logic
Commit c24b7a7e reworked the way lookahead was done and it introduced a bug when a full acceleration move is immiedietly followed by a full deceleration move. In that situation, depending on when the lookahead queue was flushed, it was possible to call move.move() without calling move.set_junction(). This resulted in a "Move instance has no attribute 'accel_t'" internal error. Simplify and fix the logic for checking full accel moves followed by full decel moves. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--klippy/toolhead.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index 3ce846db..acc0658d 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -100,12 +100,10 @@ class MoveQueue:
self.extruder_lookahead = extruder_lookahead
self.queue = []
self.leftover = 0
- self.next_start_v2 = 0.
self.junction_flush = LOOKAHEAD_FLUSH_TIME
def reset(self):
del self.queue[:]
self.leftover = 0
- self.next_start_v2 = 0.
self.junction_flush = LOOKAHEAD_FLUSH_TIME
def set_flush_time(self, flush_time):
self.junction_flush = flush_time
@@ -128,8 +126,9 @@ class MoveQueue:
if smoothed_v2 < reachable_smoothed_v2:
# It's possible for this move to accelerate
if (smoothed_v2 + move.smooth_delta_v2 > next_smoothed_v2
- or next_smoothed_v2 >= peak_cruise_v2):
- # This move can both accelerate and decelerate
+ or delayed):
+ # This move can decelerate or this is a full accel
+ # move after a full decel move
if update_flush_count and peak_cruise_v2:
flush_count = i
update_flush_count = False
@@ -137,17 +136,18 @@ class MoveQueue:
smoothed_v2 + reachable_smoothed_v2) * .5)
if delayed:
# Propagate peak_cruise_v2 to any delayed moves
- for m, ms_v2, me_v2 in delayed:
- mc_v2 = min(peak_cruise_v2, ms_v2)
- m.set_junction(min(ms_v2, mc_v2), mc_v2
- , min(me_v2, mc_v2))
+ if not update_flush_count and i < flush_count:
+ for m, ms_v2, me_v2 in delayed:
+ mc_v2 = min(peak_cruise_v2, ms_v2)
+ m.set_junction(min(ms_v2, mc_v2), mc_v2
+ , min(me_v2, mc_v2))
del delayed[:]
- cruise_v2 = min((start_v2 + reachable_start_v2) * .5
- , move.max_cruise_v2, peak_cruise_v2)
if not update_flush_count and i < flush_count:
+ cruise_v2 = min((start_v2 + reachable_start_v2) * .5
+ , move.max_cruise_v2, peak_cruise_v2)
move.set_junction(min(start_v2, cruise_v2), cruise_v2
, min(next_end_v2, cruise_v2))
- elif not update_flush_count:
+ else:
# Delay calculating this move until peak_cruise_v2 is known
delayed.append((move, start_v2, next_end_v2))
next_end_v2 = start_v2