aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-01-14 12:41:49 -0500
committerKevin O'Connor <kevin@koconnor.net>2017-01-14 12:48:16 -0500
commit064e8bdd8476d207bffab7a7ee4a97f890dbc107 (patch)
treeeb8952fdfd367fa77b89cbf98282e039f3e72271 /klippy/toolhead.py
parent262ccbcf302f8dae0baccd1747406b18be7cd60e (diff)
downloadkutter-064e8bdd8476d207bffab7a7ee4a97f890dbc107.tar.gz
kutter-064e8bdd8476d207bffab7a7ee4a97f890dbc107.tar.xz
kutter-064e8bdd8476d207bffab7a7ee4a97f890dbc107.zip
toolhead: Clear do_calc_junction if using non-default accel
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r--klippy/toolhead.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index 13294dbc..da391fc5 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -14,11 +14,11 @@ EXTRUDE_DIFF_IGNORE = 1.02
# Class to track each move request
class Move:
- def __init__(self, toolhead, start_pos, end_pos, speed, accel):
+ def __init__(self, toolhead, start_pos, end_pos, speed):
self.toolhead = toolhead
self.start_pos = tuple(start_pos)
self.end_pos = tuple(end_pos)
- self.accel = accel
+ self.accel = toolhead.max_accel
self.do_calc_junction = self.is_kinematic_move = True
self.axes_d = axes_d = [end_pos[i] - start_pos[i] for i in (0, 1, 2, 3)]
if axes_d[2]:
@@ -41,12 +41,14 @@ class Move:
# is the maximum amount of this squared-velocity that can
# change in this move.
self.junction_max = speed**2
- self.junction_delta = 2.0 * move_d * accel
+ self.junction_delta = 2.0 * move_d * self.accel
self.junction_start_max = 0.
def limit_speed(self, speed, accel):
self.junction_max = min(self.junction_max, speed**2)
- self.accel = min(self.accel, accel)
- self.junction_delta = 2.0 * self.move_d * self.accel
+ if accel < self.accel:
+ self.accel = accel
+ self.junction_delta = 2.0 * self.move_d * self.accel
+ self.do_calc_junction = False
def calc_junction(self, prev_move):
if not self.do_calc_junction or not prev_move.do_calc_junction:
return
@@ -266,7 +268,7 @@ class ToolHead:
self.kin.set_position(newpos)
def move(self, newpos, speed):
speed = min(speed, self.max_speed)
- move = Move(self, self.commanded_pos, newpos, speed, self.max_accel)
+ move = Move(self, self.commanded_pos, newpos, speed)
if not move.move_d:
return
if move.is_kinematic_move: