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

@@ -392,7 +392,8 @@ class MCU:
self._custom = config.get('custom', '')
# Move command queuing
ffi_main, self._ffi_lib = chelper.get_ffi()
self._max_stepper_error = config.getfloat('max_stepper_error', 0.000025)
self._max_stepper_error = config.getfloat(
'max_stepper_error', 0.000025, minval=0.)
self._steppers = []
self._steppersync = None
# Print time to clock epoch calculations