mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-07 22:14:05 -06:00
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>
This commit is contained in:
parent
863a463cb2
commit
11f04ba1ba
11 changed files with 12 additions and 11 deletions
|
@ -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.
|
||||
|
|
|
@ -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' }
|
||||
|
||||
|
|
|
@ -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' }
|
||||
|
||||
|
|
|
@ -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(',')
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue