aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-01-04 12:35:42 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-01-04 12:47:40 -0500
commita2f0c36e7d896dd9495379d6fa493e5fac35d8ab (patch)
treeb9564a1b45c9f5c2ca8c05b5f21ff009b82acd7f
parent7fe14f05e69f450092be7bf2d931f96918a04652 (diff)
downloadkutter-a2f0c36e7d896dd9495379d6fa493e5fac35d8ab.tar.gz
kutter-a2f0c36e7d896dd9495379d6fa493e5fac35d8ab.tar.xz
kutter-a2f0c36e7d896dd9495379d6fa493e5fac35d8ab.zip
toolhead: Don't report an error if request too high in SET_VELOCITY_LIMIT
If a requested value is higher than the configured maximum, then just limit the value to the configured maximum instead of raising an error. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--klippy/toolhead.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index e1683451..440b88a1 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -436,20 +436,18 @@ class ToolHead:
def cmd_SET_VELOCITY_LIMIT(self, params):
print_time = self.get_last_move_time()
gcode = self.printer.lookup_object('gcode')
- max_velocity = gcode.get_float(
- 'VELOCITY', params, self.max_velocity,
- above=0., maxval=self.config_max_velocity)
- max_accel = gcode.get_float(
- 'ACCEL', params, self.max_accel,
- above=0., maxval=self.config_max_accel)
+ max_velocity = gcode.get_float('VELOCITY', params, self.max_velocity,
+ above=0.)
+ max_accel = gcode.get_float('ACCEL', params, self.max_accel, above=0.)
square_corner_velocity = gcode.get_float(
'SQUARE_CORNER_VELOCITY', params, self.square_corner_velocity,
- minval=0., maxval=self.config_square_corner_velocity)
+ minval=0.)
self.requested_accel_to_decel = gcode.get_float(
'ACCEL_TO_DECEL', params, self.requested_accel_to_decel, above=0.)
- self.max_velocity = max_velocity
- self.max_accel = max_accel
- self.square_corner_velocity = square_corner_velocity
+ self.max_velocity = min(max_velocity, self.config_max_velocity)
+ self.max_accel = min(max_accel, self.config_max_accel)
+ self.square_corner_velocity = min(square_corner_velocity,
+ self.config_square_corner_velocity)
self._calc_junction_deviation()
msg = ("max_velocity: %.6f\n"
"max_accel: %.6f\n"