Automatically detect FlySky digital hall sticks on X10-class radios without necessity of build-time CMake option FLYSKY_HALL_STICKS.

Added special UART4 init to sample if FlySky sticks are present or not.
Added boolean globalData.flyskygimbals to save the detection result.
Removed FLYSKY_HALL_STICKS and FLYSKY_HALL_STICKS_REVERSE CMake build options.

Tested on two RM TX16S radios, one with FlySky digital hall sticks and second with stock analog sticks.
This commit is contained in:
rotorman
2021-11-19 21:33:03 +01:00
committed by Risto
parent 1002fddd12
commit 80a51837c1
24 changed files with 248 additions and 217 deletions
+16 -2
View File
@@ -125,10 +125,24 @@ bool adcRead()
{
uint16_t temp[NUM_ANALOGS] = { 0 };
uint8_t first_analog_adc;
#if defined(RADIO_FAMILY_T16) || defined(PCBNV14)
if (globalData.flyskygimbals)
{
first_analog_adc = FIRST_ANALOG_ADC_FS;
} else
{
first_analog_adc = FIRST_ANALOG_ADC;
}
#else
first_analog_adc = FIRST_ANALOG_ADC;
#endif
for (int i=0; i<4; i++) {
if (!adcSingleRead())
return false;
for (uint8_t x=FIRST_ANALOG_ADC; x<NUM_ANALOGS; x++) {
for (uint8_t x=first_analog_adc; x<NUM_ANALOGS; x++) {
uint16_t val = adcValues[x];
#if defined(JITTER_MEASURE)
if (JITTER_MEASURE_ACTIVE()) {
@@ -139,7 +153,7 @@ bool adcRead()
}
}
for (uint8_t x=FIRST_ANALOG_ADC; x<NUM_ANALOGS; x++) {
for (uint8_t x=first_analog_adc; x<NUM_ANALOGS; x++) {
adcValues[x] = temp[x] >> 2;
}