diff --git a/src/general_menus.cpp b/src/general_menus.cpp index 4bd52ab22..8440e7577 100644 --- a/src/general_menus.cpp +++ b/src/general_menus.cpp @@ -369,7 +369,7 @@ void menuGeneralSetup(uint8_t event) #endif case ITEM_SETUP_FILTER_ADC: - g_eeGeneral.filterInput = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_FILTERADC, STR_VFILTERADC, g_eeGeneral.filterInput, 0, 2, attr, event); + g_eeGeneral.filterInput = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_FILTERADC, STR_VFILTERADC, g_eeGeneral.filterInput, 0, 1, attr, event); break; case ITEM_SETUP_BEEP_LABEL: diff --git a/src/open9x.cpp b/src/open9x.cpp index ab79d97db..15aebf730 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -1172,8 +1172,7 @@ void doSplash() lcdSetRefVolt(contrast); #endif - for (uint8_t i=0; i<32; i++) - getADC_filt(); // init ADC array + getADC_single(); // init ADC array uint16_t inacSum = stickMoveValue(); @@ -1186,7 +1185,7 @@ void doSplash() CoTickDelay(1); #endif - getADC_filt(); + getADC_single(); uint16_t tsum = stickMoveValue(); @@ -1540,20 +1539,7 @@ uint16_t anaIn(uint8_t chan) } #if defined(PCBSKY9X) -void getADC_filt() -{ - register uint32_t x ; - static uint16_t t_ana[2][NUMBER_ANALOG] ; - - read_9_adc() ; - for( x = 0 ; x < NUMBER_ANALOG ; x += 1 ) - { - s_anaFilt[x] = s_anaFilt[x]/2 + (t_ana[1][x] >> 2 ) ; - t_ana[1][x] = ( t_ana[1][x] + t_ana[0][x] ) >> 1 ; - t_ana[0][x] = ( t_ana[0][x] + Analog_values[x] ) >> 1 ; - } -} - + void getADC_osmp() { register uint32_t x; @@ -1589,29 +1575,7 @@ void getADC_single() s_anaFilt[x] = Analog_values[x] >> 1 ; } } - #else - -void getADC_filt() -{ - static uint16_t t_ana[2][8]; - for (uint8_t adc_input=0; adc_input<8; adc_input++) { - ADMUX=adc_input|ADC_VREF_TYPE; - // Start the AD conversion - ADCSRA|=0x40; - - // Do this while waiting - s_anaFilt[adc_input] = (s_anaFilt[adc_input]/2 + t_ana[1][adc_input]) & 0xFFFE; //gain of 2 on last conversion - clear last bit - t_ana[1][adc_input] = (t_ana[1][adc_input] + t_ana[0][adc_input]) >> 1; - - // Wait for the AD conversion to complete - while ((ADCSRA & 0x10)==0); - ADCSRA|=0x10; - - t_ana[0][adc_input] = (t_ana[0][adc_input] + ADC) >> 1; - } -} - void getADC_osmp() { uint16_t temp_ana; @@ -2580,15 +2544,10 @@ FORCEINLINE void doMixerCalculations() activeMixes = 0; #endif - if (g_eeGeneral.filterInput == 1) { - getADC_filt() ; - } - else if ( g_eeGeneral.filterInput == 2) { - getADC_osmp() ; - } - else { - getADC_single() ; - } + if (g_eeGeneral.filterInput == 0) + getADC_single(); + else + getADC_osmp(); #if defined(PCBSKY9X) && defined(REVB) && !defined(SIMU) Current_analogue = ( Current_analogue * 31 + s_anaFilt[8] ) >> 5 ; @@ -3223,10 +3182,10 @@ FORCEINLINE void DSM2_USART0_vect() #endif #if !defined(SIMU) && !defined(PCBSKY9X) -#if defined (FRSKY) or defined(DSM2_SERIAL) +#if defined (FRSKY) || defined(DSM2_SERIAL) ISR(USART0_UDRE_vect) { -#if defined (FRSKY) and defined (DSM2_SERIAL) +#if defined(FRSKY) && defined(DSM2_SERIAL) if (g_model.protocol == PROTO_DSM2) { DSM2_USART0_vect(); } diff --git a/src/open9x.h b/src/open9x.h index 8b0ec6c5d..bd7a724f8 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -896,7 +896,6 @@ void checkAll(); #if !defined(SIMU) void getADC_single(); void getADC_osmp(); -void getADC_filt(); #endif extern uint8_t s_eeDirtyMsk; diff --git a/src/pulses_avr.cpp b/src/pulses_avr.cpp index 86353f884..865aa3826 100644 --- a/src/pulses_avr.cpp +++ b/src/pulses_avr.cpp @@ -348,7 +348,7 @@ void setupPulsesPXX() } #endif -#ifdef DSM2_SERIAL +#if defined(DSM2_SERIAL) // DSM2 protocol pulled from th9x - Thanks thus!!! @@ -454,7 +454,7 @@ void DSM2_Init(void) #endif // SIMU } -#endif // ifdef DSM2_SERIAL +#endif // defined(DSM2_SERIAL) /****** END DSM2=SERIAL ********/ diff --git a/src/simpgmspace.h b/src/simpgmspace.h index 16060f2f9..8d83288ba 100644 --- a/src/simpgmspace.h +++ b/src/simpgmspace.h @@ -280,7 +280,6 @@ extern uint8_t portb, portc, porth, dummyport; extern uint16_t dummyport16; extern uint8_t main_thread_running; -#define getADC_filt() #define getADC_single() #define getADC_osmp() #define getADC_bandgap() diff --git a/src/translations/cz.h b/src/translations/cz.h index a860ca7d6..80df2f4e2 100644 --- a/src/translations/cz.h +++ b/src/translations/cz.h @@ -18,7 +18,7 @@ #define TR_VRENAVIG "Ne REaREb" #define LEN_VFILTERADC "\004" -#define TR_VFILTERADC "SING""OSMP""FILT" +#define TR_VFILTERADC "SING""OSMP" #define LEN_VBLMODE "\005" #define TR_VBLMODE "Vyp\0 ""Kl\200v.""P\200ky\0""Kl+P\200""Zap\0 " diff --git a/src/translations/de.h b/src/translations/de.h index 31b500462..0dc28d343 100644 --- a/src/translations/de.h +++ b/src/translations/de.h @@ -18,7 +18,7 @@ #define TR_VRENAVIG "AUSDGaDGb" #define LEN_VFILTERADC "\004" -#define TR_VFILTERADC "SING""OSMP""FILT" +#define TR_VFILTERADC "SING""OSMP" #define LEN_VBLMODE "\004" #define TR_VBLMODE "OFF ""Tast""Knpl""Alle""ON\0" diff --git a/src/translations/en.h b/src/translations/en.h index e785570ed..755239b9d 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -18,7 +18,7 @@ #define TR_VRENAVIG "No REaREb" #define LEN_VFILTERADC "\004" -#define TR_VFILTERADC "SING""OSMP""FILT" +#define TR_VFILTERADC "SING""OSMP" #define LEN_VBLMODE "\004" #define TR_VBLMODE "OFF ""Keys""Stks""Both""ON\0" diff --git a/src/translations/es.h b/src/translations/es.h index c8bdcc8f3..85c9a9c83 100644 --- a/src/translations/es.h +++ b/src/translations/es.h @@ -18,7 +18,7 @@ #define TR_VRENAVIG "No REaREb" #define LEN_VFILTERADC "\004" -#define TR_VFILTERADC "SIMP""OSMP""FILT" +#define TR_VFILTERADC "SIMP""OSMP" #define LEN_VBLMODE "\004" #define TR_VBLMODE "OFF ""Keys""Stks""Dos ""ON\0" diff --git a/src/translations/fr.h b/src/translations/fr.h index 6d2685288..dd913fbc2 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -18,7 +18,7 @@ #define TR_VRENAVIG "NonREaREb" #define LEN_VFILTERADC "\004" -#define TR_VFILTERADC "SIMP""OSMP""FILT" +#define TR_VFILTERADC "SIMP""OSMP" #define LEN_VBLMODE "\004" #define TR_VBLMODE "OFF\0""Btns""Stks""Tout""ON\0" diff --git a/src/translations/it.h b/src/translations/it.h index e539396fc..9804bbbed 100644 --- a/src/translations/it.h +++ b/src/translations/it.h @@ -17,7 +17,7 @@ #define TR_VRENAVIG "No REaREb" #define LEN_VFILTERADC "\004" -#define TR_VFILTERADC "SING""OSMP""FILT" +#define TR_VFILTERADC "SING""OSMP" #define LEN_VBLMODE "\004" #define TR_VBLMODE "OFF ""Tast""Stks""Tutt""ON\0" diff --git a/src/translations/pt.h b/src/translations/pt.h index c5da452d4..b8d4c8ab1 100644 --- a/src/translations/pt.h +++ b/src/translations/pt.h @@ -18,7 +18,7 @@ #define TR_VRENAVIG "No REaREb" #define LEN_VFILTERADC "\004" -#define TR_VFILTERADC "SIMP""OSMP""FILT" +#define TR_VFILTERADC "SIMP""OSMP" #define LEN_VBLMODE "\004" #define TR_VBLMODE "OFF ""Chav""Stks""Tudo""ON\0" diff --git a/src/translations/se.h b/src/translations/se.h index eb598ed1e..9acb15159 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -18,7 +18,7 @@ #define TR_VRENAVIG "No REaREb" #define LEN_VFILTERADC "\004" -#define TR_VFILTERADC "SING""OSMP""FILT" +#define TR_VFILTERADC "SING""OSMP" #define LEN_VBLMODE "\004" #define TR_VBLMODE "AV ""Knpp""Spak""B\200da""P\203 "