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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user