Use 32-bit int always.
This commit is contained in:
+1
-11
@@ -1020,11 +1020,7 @@ void checkTrims()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(SIMU)
|
#if !defined(SIMU)
|
||||||
#if defined(FLYSKY_HALL_STICKS)
|
|
||||||
uint32_t s_anaFilt[NUM_ANALOGS];
|
uint32_t s_anaFilt[NUM_ANALOGS];
|
||||||
#else
|
|
||||||
uint16_t s_anaFilt[NUM_ANALOGS];
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(JITTER_MEASURE)
|
#if defined(JITTER_MEASURE)
|
||||||
@@ -1068,8 +1064,8 @@ void getADC()
|
|||||||
DEBUG_TIMER_STOP(debugTimerAdcRead);
|
DEBUG_TIMER_STOP(debugTimerAdcRead);
|
||||||
|
|
||||||
for (uint8_t x=0; x<NUM_ANALOGS; x++) {
|
for (uint8_t x=0; x<NUM_ANALOGS; x++) {
|
||||||
#if defined(FLYSKY_HALL_STICKS)
|
|
||||||
uint32_t v;
|
uint32_t v;
|
||||||
|
#if defined(FLYSKY_HALL_STICKS)
|
||||||
if (x < 4) {
|
if (x < 4) {
|
||||||
v = get_flysky_hall_adc_value(x) >> (1 - ANALOG_SCALE);
|
v = get_flysky_hall_adc_value(x) >> (1 - ANALOG_SCALE);
|
||||||
} else {
|
} else {
|
||||||
@@ -1088,7 +1084,6 @@ void getADC()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
uint16_t v;
|
|
||||||
v = getAnalogValue(x) >> (1 - ANALOG_SCALE);
|
v = getAnalogValue(x) >> (1 - ANALOG_SCALE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1126,13 +1121,8 @@ void getADC()
|
|||||||
// Variables mapping:
|
// Variables mapping:
|
||||||
// * <in> = v
|
// * <in> = v
|
||||||
// * <out> = s_anaFilt[x]
|
// * <out> = s_anaFilt[x]
|
||||||
#if defined(FLYSKY_HALL_STICKS)
|
|
||||||
uint32_t previous = s_anaFilt[x] / JITTER_ALPHA;
|
uint32_t previous = s_anaFilt[x] / JITTER_ALPHA;
|
||||||
uint32_t diff = (v > previous) ? (v - previous) : (previous - v);
|
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
|
if (!g_eeGeneral.jitterFilter && diff < (10*ANALOG_MULTIPLIER)) { // g_eeGeneral.jitterFilter is inverted, 0 - active
|
||||||
// apply jitter filter
|
// apply jitter filter
|
||||||
s_anaFilt[x] = (s_anaFilt[x] - previous) + v;
|
s_anaFilt[x] = (s_anaFilt[x] - previous) + v;
|
||||||
|
|||||||
@@ -1280,11 +1280,7 @@ extern Clipboard clipboard;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(SIMU)
|
#if !defined(SIMU)
|
||||||
#if defined(FLYSKY_HALL_STICKS)
|
|
||||||
extern uint32_t s_anaFilt[NUM_ANALOGS];
|
extern uint32_t s_anaFilt[NUM_ANALOGS];
|
||||||
#else
|
|
||||||
extern uint16_t s_anaFilt[NUM_ANALOGS];
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(JITTER_MEASURE)
|
#if defined(JITTER_MEASURE)
|
||||||
|
|||||||
Reference in New Issue
Block a user