aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-10-01 22:02:33 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-10-01 22:02:33 -0400
commit0820394e132888dd79689a68e918f17b500fa45f (patch)
treebd9489c80f68bdb9cf37eaac17ac20502c1f97b2
parent357b2f477c73037ea581a07b876a41c97c0e8670 (diff)
downloadkutter-0820394e132888dd79689a68e918f17b500fa45f.tar.gz
kutter-0820394e132888dd79689a68e918f17b500fa45f.tar.xz
kutter-0820394e132888dd79689a68e918f17b500fa45f.zip
toolhead: M204 must update max_accel_to_decel
The max_accel_to_decel variable must not be greater than the max_accel variable. Make sure to check this when M204 changes max_accel. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--klippy/toolhead.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index c10c29e4..ad1141f0 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -207,8 +207,7 @@ class ToolHead:
self.max_accel = config.getfloat('max_accel', above=0.)
self.requested_accel_to_decel = config.getfloat(
'max_accel_to_decel', self.max_accel * 0.5, above=0.)
- self.max_accel_to_decel = min(self.requested_accel_to_decel,
- self.max_accel)
+ self.max_accel_to_decel = self.requested_accel_to_decel
self.square_corner_velocity = config.getfloat(
'square_corner_velocity', 5., minval=0.)
self.config_max_velocity = self.max_velocity
@@ -421,6 +420,8 @@ class ToolHead:
def _calc_junction_deviation(self):
scv2 = self.square_corner_velocity**2
self.junction_deviation = scv2 * (math.sqrt(2.) - 1.) / self.max_accel
+ self.max_accel_to_decel = min(self.requested_accel_to_decel,
+ self.max_accel)
cmd_SET_VELOCITY_LIMIT_help = "Set printer velocity limits"
def cmd_SET_VELOCITY_LIMIT(self, params):
print_time = self.get_last_move_time()
@@ -438,7 +439,6 @@ class ToolHead:
'ACCEL_TO_DECEL', params, self.requested_accel_to_decel, above=0.)
self.max_velocity = max_velocity
self.max_accel = max_accel
- self.max_accel_to_decel = min(self.requested_accel_to_decel, max_accel)
self.square_corner_velocity = square_corner_velocity
self._calc_junction_deviation()
msg = ("max_velocity: %.6f\n"