From 7b03b04c786863bc32d3b790862857061f71f072 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 11 Apr 2017 11:37:09 -0400 Subject: klippy: Support minimum/maximum value checks on configuration variables Verify that numeric parameters are in a sane range when reading the config. Signed-off-by: Kevin O'Connor --- klippy/cartesian.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'klippy/cartesian.py') diff --git a/klippy/cartesian.py b/klippy/cartesian.py index ab95df5d..f69855f6 100644 --- a/klippy/cartesian.py +++ b/klippy/cartesian.py @@ -13,8 +13,10 @@ class CartKinematics: self.steppers = [stepper.PrinterStepper( printer, config.getsection('stepper_' + n), n) for n in ['x', 'y', 'z']] - self.max_z_velocity = config.getfloat('max_z_velocity', 9999999.9) - self.max_z_accel = config.getfloat('max_z_accel', 9999999.9) + self.max_z_velocity = config.getfloat( + 'max_z_velocity', 9999999.9, above=0.) + self.max_z_accel = config.getfloat( + 'max_z_accel', 9999999.9, above=0.) self.need_motor_enable = True self.limits = [(1.0, -1.0)] * 3 def set_max_jerk(self, max_xy_halt_velocity, max_velocity, max_accel): -- cgit v1.2.3-70-g09d2