From a2f0c36e7d896dd9495379d6fa493e5fac35d8ab Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 4 Jan 2019 12:35:42 -0500 Subject: [PATCH] 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 --- klippy/toolhead.py | 18 ++++++++---------- 1 file 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"