mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-05 04:54:11 -06:00
klippy: Add ConfigWrapper.getchoice method
Add helper function that ensures a config option is one of several choices. This helps ensure that a proper error is raised if an invalid choice is made. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
57244de37d
commit
2f97b2d7c2
3 changed files with 10 additions and 5 deletions
|
@ -161,8 +161,7 @@ class ToolHead:
|
|||
self.extruder = printer.objects.get('extruder')
|
||||
kintypes = {'cartesian': cartesian.CartKinematics,
|
||||
'delta': delta.DeltaKinematics}
|
||||
kin = config.get('kinematics', 'cartesian')
|
||||
self.kin = kintypes[kin](printer, config)
|
||||
self.kin = config.getchoice('kinematics', kintypes)(printer, config)
|
||||
self.max_speed, self.max_accel = self.kin.get_max_speed()
|
||||
self.junction_deviation = config.getfloat('junction_deviation', 0.02)
|
||||
self.move_queue = MoveQueue()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue