mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-07 22:14:05 -06:00
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:
parent
7a7b98cc31
commit
7b03b04c78
10 changed files with 97 additions and 50 deletions
|
@ -19,8 +19,8 @@ class DeltaKinematics:
|
|||
for n in ['a', 'b', 'c']]
|
||||
self.need_motor_enable = self.need_home = True
|
||||
self.max_velocity = self.max_z_velocity = self.max_accel = 0.
|
||||
radius = config.getfloat('delta_radius')
|
||||
arm_length = config.getfloat('delta_arm_length')
|
||||
radius = config.getfloat('delta_radius', above=0.)
|
||||
arm_length = config.getfloat('delta_arm_length', above=radius)
|
||||
self.arm_length2 = arm_length**2
|
||||
self.limit_xy2 = -1.
|
||||
tower_height_at_zeros = math.sqrt(self.arm_length2 - radius**2)
|
||||
|
@ -53,7 +53,8 @@ class DeltaKinematics:
|
|||
self.set_position([0., 0., 0.])
|
||||
def set_max_jerk(self, max_xy_halt_velocity, max_velocity, max_accel):
|
||||
self.max_velocity = max_velocity
|
||||
max_z_velocity = self.config.getfloat('max_z_velocity', max_velocity)
|
||||
max_z_velocity = self.config.getfloat(
|
||||
'max_z_velocity', max_velocity, above=0.)
|
||||
self.max_z_velocity = min(max_velocity, max_z_velocity)
|
||||
self.max_accel = max_accel
|
||||
for stepper in self.steppers:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue