aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-11-04 14:01:59 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-11-05 10:59:36 -0400
commit6285cc6f66e2897a14059abaed14a3bbfa9e322e (patch)
treec1274e972be38584dd5810ae8bc6a3c95b3a7581 /klippy/toolhead.py
parent8e165fecc0e80d19d0bf4b3dfdde91d061de4c0d (diff)
downloadkutter-6285cc6f66e2897a14059abaed14a3bbfa9e322e.tar.gz
kutter-6285cc6f66e2897a14059abaed14a3bbfa9e322e.tar.xz
kutter-6285cc6f66e2897a14059abaed14a3bbfa9e322e.zip
toolhead: Simplify calculation of junction_cruise
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r--klippy/toolhead.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index 983e62bf..2bfc5db8 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -72,16 +72,12 @@ class Move:
, prev_move.junction_start_max + prev_move.junction_delta)
def process(self, junction_start, junction_end):
# Determine accel, cruise, and decel portions of the move distance
- junction_cruise = self.junction_max
+ junction_cruise = min((junction_start + junction_end
+ + self.junction_delta) * .5, self.junction_max)
inv_junction_delta = 1. / self.junction_delta
accel_r = (junction_cruise-junction_start) * inv_junction_delta
decel_r = (junction_cruise-junction_end) * inv_junction_delta
cruise_r = 1. - accel_r - decel_r
- if cruise_r < 0.:
- accel_r += 0.5 * cruise_r
- decel_r = 1.0 - accel_r
- cruise_r = 0.
- junction_cruise = junction_start + accel_r*self.junction_delta
self.accel_r, self.cruise_r, self.decel_r = accel_r, cruise_r, decel_r
# Determine move velocities
start_v = math.sqrt(junction_start)