diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2024-06-17 13:49:05 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2024-06-17 13:49:05 -0400 |
commit | 11f04ba1bae774d32fd43bed4a0772c58d8df199 (patch) | |
tree | 7eec3a3fca5012f33602a9f0e434cd85ad1cb96b /klippy/extras | |
parent | 863a463cb2d07fce2ae09e2b0f925bdf201051dc (diff) | |
download | kutter-11f04ba1bae774d32fd43bed4a0772c58d8df199.tar.gz kutter-11f04ba1bae774d32fd43bed4a0772c58d8df199.tar.xz kutter-11f04ba1bae774d32fd43bed4a0772c58d8df199.zip |
configfile: Allow getchoice() to take a list
If a list is passed to getchoice(), seamlessly convert it to a dict.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras')
-rw-r--r-- | klippy/extras/bltouch.py | 2 | ||||
-rw-r--r-- | klippy/extras/display/hd44780.py | 2 | ||||
-rw-r--r-- | klippy/extras/display/hd44780_spi.py | 2 | ||||
-rw-r--r-- | klippy/extras/display/menu_keys.py | 2 | ||||
-rw-r--r-- | klippy/extras/probe.py | 2 | ||||
-rw-r--r-- | klippy/extras/replicape.py | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/klippy/extras/bltouch.py b/klippy/extras/bltouch.py index 58f66819..ae461f4b 100644 --- a/klippy/extras/bltouch.py +++ b/klippy/extras/bltouch.py @@ -42,7 +42,7 @@ class BLTouchProbe: # Create an "endstop" object to handle the sensor pin self.mcu_endstop = ppins.setup_pin('endstop', config.get('sensor_pin')) # output mode - omodes = {'5V': '5V', 'OD': 'OD', None: None} + omodes = ['5V', 'OD', None] self.output_mode = config.getchoice('set_output_mode', omodes, None) # Setup for sensor test self.next_test_time = 0. diff --git a/klippy/extras/display/hd44780.py b/klippy/extras/display/hd44780.py index 9adfa20f..2da49c51 100644 --- a/klippy/extras/display/hd44780.py +++ b/klippy/extras/display/hd44780.py @@ -8,7 +8,7 @@ import logging BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000 LINE_LENGTH_DEFAULT=20 -LINE_LENGTH_OPTIONS={16:16, 20:20} +LINE_LENGTH_OPTIONS=[16, 20] TextGlyphs = { 'right_arrow': b'\x7e' } diff --git a/klippy/extras/display/hd44780_spi.py b/klippy/extras/display/hd44780_spi.py index cd1d9e3e..f21accbb 100644 --- a/klippy/extras/display/hd44780_spi.py +++ b/klippy/extras/display/hd44780_spi.py @@ -9,7 +9,7 @@ import logging from .. import bus LINE_LENGTH_DEFAULT=20 -LINE_LENGTH_OPTIONS={16:16, 20:20} +LINE_LENGTH_OPTIONS=[16, 20] TextGlyphs = { 'right_arrow': b'\x7e' } diff --git a/klippy/extras/display/menu_keys.py b/klippy/extras/display/menu_keys.py index 91a96e19..8094c996 100644 --- a/klippy/extras/display/menu_keys.py +++ b/klippy/extras/display/menu_keys.py @@ -18,7 +18,7 @@ class MenuKeys: # Register rotary encoder encoder_pins = config.get('encoder_pins', None) encoder_steps_per_detent = config.getchoice('encoder_steps_per_detent', - {2: 2, 4: 4}, 4) + [2, 4], 4) if encoder_pins is not None: try: pin1, pin2 = encoder_pins.split(',') diff --git a/klippy/extras/probe.py b/klippy/extras/probe.py index 88aed25f..c467e181 100644 --- a/klippy/extras/probe.py +++ b/klippy/extras/probe.py @@ -252,7 +252,7 @@ class ProbeSessionHelper: self.sample_count = config.getint('samples', 1, minval=1) self.sample_retract_dist = config.getfloat('sample_retract_dist', 2., above=0.) - atypes = {'median': 'median', 'average': 'average'} + atypes = ['median', 'average'] self.samples_result = config.getchoice('samples_result', atypes, 'average') self.samples_tolerance = config.getfloat('samples_tolerance', 0.100, diff --git a/klippy/extras/replicape.py b/klippy/extras/replicape.py index ab501caf..f7f7bb64 100644 --- a/klippy/extras/replicape.py +++ b/klippy/extras/replicape.py @@ -160,7 +160,7 @@ class Replicape: printer = config.get_printer() ppins = printer.lookup_object('pins') ppins.register_chip('replicape', self) - revisions = {'B3': 'B3'} + revisions = ['B3'] config.getchoice('revision', revisions) self.host_mcu = mcu.get_printer_mcu(printer, config.get('host_mcu')) # Setup enable pin |