diff --git a/conf/modules/airspeed_amsys.xml b/conf/modules/airspeed_amsys.xml index 85cb9cbcb0..a28b066830 100644 --- a/conf/modules/airspeed_amsys.xml +++ b/conf/modules/airspeed_amsys.xml @@ -11,8 +11,8 @@ - + diff --git a/conf/modules/airspeed_ets.xml b/conf/modules/airspeed_ets.xml index 07cf003315..26892fe061 100644 --- a/conf/modules/airspeed_ets.xml +++ b/conf/modules/airspeed_ets.xml @@ -21,8 +21,8 @@ - +
diff --git a/conf/modules/airspeed_ms45xx_i2c.xml b/conf/modules/airspeed_ms45xx_i2c.xml index 926de40645..94bb9bcaee 100644 --- a/conf/modules/airspeed_ms45xx_i2c.xml +++ b/conf/modules/airspeed_ms45xx_i2c.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/pbn.xml b/conf/modules/pbn.xml index 60c038e401..5459ff9063 100644 --- a/conf/modules/pbn.xml +++ b/conf/modules/pbn.xml @@ -11,6 +11,10 @@ controlled by a dspic return scaled values over I2C + + + + diff --git a/sw/airborne/modules/sensors/airspeed_amsys.c b/sw/airborne/modules/sensors/airspeed_amsys.c index 0a52383c6e..88f979be5e 100644 --- a/sw/airborne/modules/sensors/airspeed_amsys.c +++ b/sw/airborne/modules/sensors/airspeed_amsys.c @@ -57,6 +57,14 @@ #define TEMPERATURE_AMSYS_MIN -25 #endif +#ifndef USE_AIRSPEED_AMSYS +#if USE_AIRSPEED +#define USE_AIRSPEED_AMSYS TRUE +PRINT_CONFIG_MSG("USE_AIRSPEED_AMSYS automatically set to TRUE") +#endif +#endif + + // Global variables uint16_t airspeed_amsys_raw; @@ -106,7 +114,7 @@ void airspeed_amsys_read_periodic( void ) { #endif } -#if USE_AIRSPEED +#if USE_AIRSPEED_AMSYS stateSetAirspeed_f(&airspeed_amsys); #endif diff --git a/sw/airborne/modules/sensors/airspeed_ets.c b/sw/airborne/modules/sensors/airspeed_ets.c index f7d2fed2fc..e43ebdf489 100644 --- a/sw/airborne/modules/sensors/airspeed_ets.c +++ b/sw/airborne/modules/sensors/airspeed_ets.c @@ -47,12 +47,17 @@ #include "subsystems/datalink/downlink.h" #include -#if !USE_AIRSPEED -#ifndef AIRSPEED_ETS_SYNC_SEND -#warning either set USE_AIRSPEED or AIRSPEED_ETS_SYNC_SEND to use ets_airspeed +#ifndef USE_AIRSPEED_ETS +#if USE_AIRSPEED +#define USE_AIRSPEED_ETS TRUE +PRINT_CONFIG_MSG("USE_AIRSPEED_ETS automatically set to TRUE") #endif #endif +#if !USE_AIRSPEED_ETS && !AIRSPEED_ETS_SYNC_SEND +#warning either set USE_AIRSPEED_ETS or AIRSPEED_ETS_SYNC_SEND to use airspeed_ets +#endif + #define AIRSPEED_ETS_ADDR 0xEA #ifndef AIRSPEED_ETS_SCALE #define AIRSPEED_ETS_SCALE 1.8 @@ -184,10 +189,10 @@ void airspeed_ets_read_event( void ) { for (n = 0; n < AIRSPEED_ETS_NBSAMPLES_AVRG; ++n) airspeed_ets += airspeed_ets_buffer[n]; airspeed_ets = airspeed_ets / (float)AIRSPEED_ETS_NBSAMPLES_AVRG; -#if USE_AIRSPEED +#if USE_AIRSPEED_ETS stateSetAirspeed_f(&airspeed_ets); #endif -#ifdef AIRSPEED_ETS_SYNC_SEND +#if AIRSPEED_ETS_SYNC_SEND DOWNLINK_SEND_AIRSPEED_ETS(DefaultChannel, DefaultDevice, &airspeed_ets_raw, &airspeed_ets_offset, &airspeed_ets); #endif } else { diff --git a/sw/airborne/modules/sensors/airspeed_ms45xx_i2c.c b/sw/airborne/modules/sensors/airspeed_ms45xx_i2c.c index a86bb8010f..d4068f677d 100644 --- a/sw/airborne/modules/sensors/airspeed_ms45xx_i2c.c +++ b/sw/airborne/modules/sensors/airspeed_ms45xx_i2c.c @@ -26,7 +26,6 @@ */ #include "std.h" -#include "state.h" #include "mcu_periph/i2c.h" #include "modules/sensors/airspeed_ms45xx_i2c.h" #include "filters/low_pass_filter.h" @@ -39,6 +38,17 @@ #include "subsystems/datalink/telemetry.h" #endif +#ifndef USE_AIRSPEED_MS45XX +#if USE_AIRSPEED +#define USE_AIRSPEED_MS45XX TRUE +PRINT_CONFIG_MSG("USE_AIRSPEED_MS45XX automatically set to TRUE") +#endif +#endif + +#if USE_AIRSPEED_MS45XX +#include "state.h" +#endif + /** Default I2C device */ #ifndef MS45XX_I2C_DEV @@ -192,7 +202,7 @@ void ms45xx_i2c_event(void) // Compute airspeed ms45xx.airspeed = sqrtf(Max(ms45xx.diff_pressure * ms45xx.airspeed_scale, 0)); -#if USE_AIRSPEED +#if USE_AIRSPEED_MS45XX stateSetAirspeed_f(&ms45xx.airspeed); #endif if (ms45xx.sync_send) { diff --git a/sw/airborne/modules/sensors/pressure_board_navarro.c b/sw/airborne/modules/sensors/pressure_board_navarro.c index d832fad9a0..6a1396d6eb 100644 --- a/sw/airborne/modules/sensors/pressure_board_navarro.c +++ b/sw/airborne/modules/sensors/pressure_board_navarro.c @@ -20,39 +20,49 @@ * */ -/* +/** @file modules/sensors/pressure_board_navarro.c * Pressure Board Navarro */ #include "pressure_board_navarro.h" -#include "state.h" #include "subsystems/abi.h" -/* Default I2C device on tiny is i2c0 +#ifndef USE_AIRSPEED_PBN +#if USE_AIRSPEED +#define USE_AIRSPEED_PBN TRUE +PRINT_CONFIG_MSG("USE_AIRSPEED_PBN automatically set to TRUE") +#endif +#endif + +#if USE_AIRSPEED_PBN +#include "state.h" +#endif + +/** Default I2C device on tiny is i2c0 */ #ifndef PBN_I2C_DEV #define PBN_I2C_DEV i2c0 #endif -/* Sensor I2C slave address */ +/** Sensor I2C slave address */ #define PBN_I2C_ADDR 0x28 -/* Number of values to compute an offset at startup */ +/** Number of values to compute an offset at startup */ #define OFFSET_NBSAMPLES_AVRG 100 -/* Number of loops before starting to store data */ +/** Number of loops before starting to store data */ #define PBN_START_DELAY 30 -/* Weight for offset IIR filter */ +/** Weight for offset IIR filter */ #define PBN_OFFSET_FILTER 7 -/* Quadratic scale factor for airspeed */ +/** Quadratic scale factor for airspeed */ #ifndef PBN_AIRSPEED_SCALE #define PBN_AIRSPEED_SCALE (1./0.54) #endif -/* Linear scale factor for altitude */ +/** Linear scale factor for altitude */ #ifndef PBN_ALTITUDE_SCALE #define PBN_ALTITUDE_SCALE 0.32 #endif @@ -148,7 +158,7 @@ void pbn_read_event( void ) { pbn_altitude = PBN_ALTITUDE_SCALE*(float)(altitude_adc-altitude_offset); pbn_airspeed = (airspeed_filter*pbn_airspeed + tmp_airspeed) / (airspeed_filter + 1.); -#if USE_AIRSPEED +#if USE_AIRSPEED_PBN stateSetAirspeed_f(&pbn_airspeed); #endif } diff --git a/sw/airborne/modules/sensors/pressure_board_navarro.h b/sw/airborne/modules/sensors/pressure_board_navarro.h index f5e78f2a2f..ff16f5da43 100644 --- a/sw/airborne/modules/sensors/pressure_board_navarro.h +++ b/sw/airborne/modules/sensors/pressure_board_navarro.h @@ -20,7 +20,8 @@ * */ -/* +/** @file modules/sensors/pressure_board_navarro.h + * * Pressure Board Navarro (2010) * * by Matthieu Navarro