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
+2 -7
View File
@@ -134,7 +134,7 @@ OpenTxSim::OpenTxSim(FXApp* a):
sliders[i]->setValue(2047);
}
auto max_pots = adcGetMaxInputs(ADC_INPUT_POT);
auto max_pots = adcGetMaxInputs(ADC_INPUT_FLEX);
memset(knobs, 0, sizeof(knobs));
for (int i = 0; i < max_pots; i++) {
@@ -673,15 +673,10 @@ uint16_t simu_get_analog(uint8_t idx)
idx -= max_sticks;
auto max_pots = adcGetMaxInputs(ADC_INPUT_POT);
auto max_pots = adcGetMaxInputs(ADC_INPUT_FLEX);
if (idx < max_pots)
return opentxSim->knobs[idx]->getValue();
idx -= max_pots;
auto max_axes = adcGetMaxInputs(ADC_INPUT_AXIS);
if (idx < max_axes) return 0;
// probably RTC_BAT
return 0;
}