Removed FlySky digital hall gimbal double value conversion (first using the FlySky factory calibration values min,mid and max to convert to 0 to 4095 and second to convert this value again into EdgeTX internal 11-bit range 0 to 2047).

This has the added benefit of precision increase and also avoiding unnecessary computation. Needed to change to uint32_t, as the jitter removal computation would otherwise go over the 16-bit range. As 16-bit computation can be left for "normal" sticks, added a special define just for FLYSKY_HALL_STICKS.

In addition this PR changes back the radio analogs diagnose page second column also for FlySky digital hall sticks to show +/- 100 again, as now with first and second column we already cover all internal ranges used.

Tested on RM TX16S with FlySky digital hall sticks.
This commit is contained in:
rotorman
2021-09-21 08:11:26 +02:00
committed by Risto
parent e51ffb110a
commit 9570f8595a
5 changed files with 25 additions and 110 deletions
+11 -2
View File
@@ -1020,8 +1020,12 @@ void checkTrims()
}
#if !defined(SIMU)
#if defined(FLYSKY_HALL_STICKS)
uint32_t s_anaFilt[NUM_ANALOGS];
#else
uint16_t s_anaFilt[NUM_ANALOGS];
#endif
#endif
#if defined(JITTER_MEASURE)
JitterMeter<uint16_t> rawJitter[NUM_ANALOGS];
@@ -1064,9 +1068,8 @@ void getADC()
DEBUG_TIMER_STOP(debugTimerAdcRead);
for (uint8_t x=0; x<NUM_ANALOGS; x++) {
uint16_t v;
#if defined(FLYSKY_HALL_STICKS)
uint32_t v;
if (x < 4) {
v = get_flysky_hall_adc_value(x) >> (1 - ANALOG_SCALE);
} else {
@@ -1085,6 +1088,7 @@ void getADC()
#endif
}
#else
uint16_t v;
v = getAnalogValue(x) >> (1 - ANALOG_SCALE);
#endif
@@ -1122,8 +1126,13 @@ void getADC()
// Variables mapping:
// * <in> = v
// * <out> = s_anaFilt[x]
#if defined(FLYSKY_HALL_STICKS)
uint32_t previous = s_anaFilt[x] / JITTER_ALPHA;
uint32_t diff = (v > previous) ? (v - previous) : (previous - v);
#else
uint16_t previous = s_anaFilt[x] / JITTER_ALPHA;
uint16_t diff = (v > previous) ? (v - previous) : (previous - v);
#endif
if (!g_eeGeneral.jitterFilter && diff < (10*ANALOG_MULTIPLIER)) { // g_eeGeneral.jitterFilter is inverted, 0 - active
// apply jitter filter
s_anaFilt[x] = (s_anaFilt[x] - previous) + v;