feat: More flexible ADC inputs (#3870)

Co-authored-by: 3djc <lesitewebdejc@hotmail.com>
Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
Co-authored-by: philmoz <phil.a.mitchell@gmail.com>
This commit is contained in:
Raphael Coeffic
2023-11-02 11:07:53 +10:00
committed by GitHub
co-authored by 3djc Peter Feerick philmoz
parent f5593c44e8
commit b48e07026d
78 changed files with 1291 additions and 773 deletions
+8 -8
View File
@@ -12,7 +12,7 @@ def eprint(*args, **kwargs):
class ADCInput:
TYPE_STICK = 'STICK'
TYPE_POT = 'POT'
TYPE_FLEX = 'FLEX'
TYPE_SWITCH = 'SWITCH'
# TYPE_BATT = 'BATT'
@@ -60,25 +60,25 @@ class ADCInputParser:
},
{
'range': range(1, MAX_POTS + 1),
'type': ADCInput.TYPE_POT,
'type': ADCInput.TYPE_FLEX,
'suffix': 'POT{}',
'name': 'P{}',
},
{
'range': range(1, MAX_SLIDERS + 1),
'type': ADCInput.TYPE_POT,
'type': ADCInput.TYPE_FLEX,
'suffix': 'SLIDER{}',
'name': 'SL{}',
},
{
'range': range(1, MAX_EXTS + 1),
'type': ADCInput.TYPE_POT,
'type': ADCInput.TYPE_FLEX,
'suffix': 'EXT{}',
'name': 'EXT{}',
},
{
'range': range(1, 2 + 1),
'type': 'AXIS',
'type': ADCInput.TYPE_FLEX,
'suffix': 'MOUSE{}',
'name': MouseName(),
},
@@ -232,10 +232,10 @@ class ADCInputParser:
d = self.dirs[idx]
if d < 0:
adc_input.inverted = True
if adc_input.type == 'POT':
if adc_input.type == 'FLEX':
input_labels = self.labels[adc_input.name]
adc_input.label = input_labels['label']
adc_input.short_label = input_labels['short_label']
adc_input.label = input_labels.get('label')
adc_input.short_label = input_labels.get('short_label')
cfg = pot_cfg_by_target(self.target,adc_input.name)
if cfg:
adc_input.default = cfg.get('default')