diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-11-30 15:50:28 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-11-30 21:19:44 -0500 |
commit | 2f97b2d7c250d4612654824633122b63d917a937 (patch) | |
tree | c43f5cb774c3c0e27349161826b8da8ff08857e7 /klippy/toolhead.py | |
parent | 57244de37d6b4e2247c09803d06728daacfdaa48 (diff) | |
download | kutter-2f97b2d7c250d4612654824633122b63d917a937.tar.gz kutter-2f97b2d7c250d4612654824633122b63d917a937.tar.xz kutter-2f97b2d7c250d4612654824633122b63d917a937.zip |
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>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r-- | klippy/toolhead.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py index 5248a589..681ebe73 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -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() |