diff --git a/conf/airframes/mm/fixed-wing/funjetmm.xml b/conf/airframes/mm/fixed-wing/funjetmm.xml index 3ce0e0cbe9..f8ebbe9620 100755 --- a/conf/airframes/mm/fixed-wing/funjetmm.xml +++ b/conf/airframes/mm/fixed-wing/funjetmm.xml @@ -10,15 +10,6 @@ - - - - - - - - - @@ -26,10 +17,19 @@ - - - - + + + + + + + + + + + + + @@ -49,7 +49,6 @@ - @@ -61,8 +60,12 @@ + + + + +
+ +
+ + + + + + + +
+ diff --git a/sw/airborne/main_ap.c b/sw/airborne/main_ap.c index e55f780d11..35a5d56bf0 100644 --- a/sw/airborne/main_ap.c +++ b/sw/airborne/main_ap.c @@ -67,10 +67,6 @@ #include "led.h" #endif -#ifdef USE_ADC_GENERIC -#include "adc_generic.h" -#endif - #if defined USE_I2C0 || USE_I2C1 #include "i2c.h" #endif @@ -87,10 +83,6 @@ #include "usb_serial.h" #endif -#ifdef USE_BARO_ETS -#include "baro_ets.h" -#endif // USE_BARO_ETS - #if ! defined CATASTROPHIC_BAT_LEVEL && defined LOW_BATTERY #warning "LOW_BATTERY deprecated. Renamed into CATASTROPHIC_BAT_LEVEL (in airframe file)" #define CATASTROPHIC_BAT_LEVEL LOW_BATTERY @@ -446,13 +438,6 @@ void periodic_task_ap( void ) { break; #endif -#ifdef USE_ADC_GENERIC - case 6: - adc_generic_periodic(); - DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, &adc_generic_val1, &adc_generic_val2); - break; -#endif - /* default: */ } @@ -543,10 +528,6 @@ void init_ap( void ) { i2c1_init(); #endif -#ifdef USE_ADC_GENERIC - adc_generic_init(); -#endif - /************* Links initialization ***************/ #if defined USE_SPI spi_init(); @@ -673,15 +654,6 @@ void event_task_ap( void ) { } #endif -#if defined(USE_BARO_ETS) - if (baro_ets_updated) { - baro_ets_updated = FALSE; - if (baro_ets_valid) { - EstimatorSetAlt(baro_ets_altitude); - } - } -#endif - if (inter_mcu_received_fbw) { /* receive radio control task from fbw */ inter_mcu_received_fbw = FALSE; diff --git a/sw/airborne/adc_generic.c b/sw/airborne/modules/adcs/adc_generic.c similarity index 65% rename from sw/airborne/adc_generic.c rename to sw/airborne/modules/adcs/adc_generic.c index e2749afcc1..d7e8f26f52 100644 --- a/sw/airborne/adc_generic.c +++ b/sw/airborne/modules/adcs/adc_generic.c @@ -1,10 +1,21 @@ #include "adc_generic.h" #include "adc.h" +#include "uart.h" +#include "messages.h" +#include "downlink.h" #include BOARD_CONFIG -#ifdef USE_ADC_GENERIC uint16_t adc_generic_val1; uint16_t adc_generic_val2; + +#ifndef ADC_CHANNEL_GENERIC1 +#ifndef ADC_CHANNEL_GENERIC2 +#error "at least one ADC_CHANNEL_GENERIC1/2 needs to be defined to use the generic_adc module" +#endif +#endif + +#ifndef ADC_CHANNEL_GENERIC_NB_SAMPLES +#define ADC_CHANNEL_GENERIC_NB_SAMPLES DEFAULT_AV_NB_SAMPLE #endif #ifdef ADC_CHANNEL_GENERIC1 @@ -31,4 +42,7 @@ void adc_generic_periodic( void ) { #ifdef ADC_CHANNEL_GENERIC2 adc_generic_val2 = buf_generic2.sum / buf_generic2.av_nb_sample; #endif + + DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, &adc_generic_val1, &adc_generic_val2); } + diff --git a/sw/airborne/adc_generic.h b/sw/airborne/modules/adcs/adc_generic.h similarity index 100% rename from sw/airborne/adc_generic.h rename to sw/airborne/modules/adcs/adc_generic.h