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 <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2017-04-11 11:37:09 -04:00
parent 7a7b98cc31
commit 7b03b04c78
10 changed files with 97 additions and 50 deletions

View File

@@ -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):