diff --git a/conf/modules/airspeed_ets.xml b/conf/modules/airspeed_ets.xml index 5e35f2c7cb..9bde519b64 100644 --- a/conf/modules/airspeed_ets.xml +++ b/conf/modules/airspeed_ets.xml @@ -5,6 +5,8 @@ @param AIRSPEED_ETS_SCALE scale factor (default 1.8) @param AIRSPEED_ETS_OFFSET offset (default 0) @param AIRSPEED_ETS_I2C_DEV i2c device (default i2c0) + @flag USE_AIRSPEED to use the data for airspeed control loop + @flag SENSOR_SYNC_SEND to transmit the data as it is acquired --> @@ -18,7 +20,6 @@ - diff --git a/conf/modules/baro_bmp.xml b/conf/modules/baro_bmp.xml index 1e01d1c1cc..288036c05c 100644 --- a/conf/modules/baro_bmp.xml +++ b/conf/modules/baro_bmp.xml @@ -1,5 +1,11 @@ + +
diff --git a/conf/modules/baro_scp.xml b/conf/modules/baro_scp.xml index 31337accfa..f76579e90f 100644 --- a/conf/modules/baro_scp.xml +++ b/conf/modules/baro_scp.xml @@ -1,5 +1,10 @@ + +
diff --git a/conf/modules/baro_scp_i2c.xml b/conf/modules/baro_scp_i2c.xml index c6e7006882..972be683b7 100644 --- a/conf/modules/baro_scp_i2c.xml +++ b/conf/modules/baro_scp_i2c.xml @@ -1,8 +1,9 @@ diff --git a/sw/airborne/modules/sensors/airspeed_ets.c b/sw/airborne/modules/sensors/airspeed_ets.c index 59d957de35..7b8ae76096 100644 --- a/sw/airborne/modules/sensors/airspeed_ets.c +++ b/sw/airborne/modules/sensors/airspeed_ets.c @@ -36,8 +36,18 @@ */ #include "sensors/airspeed_ets.h" #include "estimator.h" +#include "i2c.h" +#include "uart.h" +#include "messages.h" +#include "downlink.h" #include +#ifndef USE_AIRSPEED +#ifndef SENSOR_SYNC_SEND +#warning either set USE_AIRSPEED or SENSOR_SYNC_SEND to use ets_airspeed +#endif +#endif + #define AIRSPEED_ETS_ADDR 0xEA #ifndef AIRSPEED_ETS_SCALE #define AIRSPEED_ETS_SCALE 1.8 @@ -149,7 +159,12 @@ void airspeed_ets_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; +#ifdef USE_AIRSPEED EstimatorSetAirspeed(airspeed_ets); +#endif +#ifdef SENSOR_SYNC_SEND + DOWNLINK_SEND_AIRSPEED_ETS(DefaultChannel, &airspeed_ets_raw, &airspeed_ets_offset, &airspeed_ets); +#endif } else { airspeed_ets = 0.0; } diff --git a/sw/airborne/modules/sensors/baro_bmp.c b/sw/airborne/modules/sensors/baro_bmp.c index 9d12b1e49b..34860b1ca0 100644 --- a/sw/airborne/modules/sensors/baro_bmp.c +++ b/sw/airborne/modules/sensors/baro_bmp.c @@ -38,6 +38,10 @@ #include "messages.h" #include "downlink.h" +#ifndef SENSOR_SYNC_SEND +#warning set SENSOR_SYNC_SEND to use baro_bmp +#endif + #ifndef BMP_I2C_DEV #define BMP_I2C_DEV i2c0 #endif @@ -157,7 +161,9 @@ void baro_bmp_event( void ) { baro_bmp_temperature = bmp_t; baro_bmp_pressure = bmp_p; +#ifdef SENSOR_SYNC_SEND DOWNLINK_SEND_BMP_STATUS(DefaultChannel, &bmp_p, &bmp_t); +#endif } } } diff --git a/sw/airborne/modules/sensors/baro_scp.c b/sw/airborne/modules/sensors/baro_scp.c index b24f6aa7ec..45608092e7 100644 --- a/sw/airborne/modules/sensors/baro_scp.c +++ b/sw/airborne/modules/sensors/baro_scp.c @@ -12,6 +12,10 @@ #include "baro_scp.h" +#ifndef SENSOR_SYNC_SEND +#warning set SENSOR_SYNC_SEND to use baro_scp +#endif + #define STA_UNINIT 0 #define STA_INITIALISING 1 #define STA_IDLE 2 @@ -171,7 +175,9 @@ static void baro_scp_read(void) { void baro_scp_event( void ) { if (baro_scp_available == TRUE) { +#ifdef SENSOR_SYNC_SEND DOWNLINK_SEND_SCP_STATUS(DefaultChannel, &baro_scp_pressure, &baro_scp_temperature); +#endif baro_scp_available = FALSE; } } diff --git a/sw/airborne/modules/sensors/baro_scp_i2c.c b/sw/airborne/modules/sensors/baro_scp_i2c.c index aef0cc365e..f45f89abd0 100644 --- a/sw/airborne/modules/sensors/baro_scp_i2c.c +++ b/sw/airborne/modules/sensors/baro_scp_i2c.c @@ -14,6 +14,10 @@ #include "messages.h" #include "downlink.h" +#ifndef SENSOR_SYNC_SEND +#warning set SENSOR_SYNC_SEND to use baro_scp_i2c +#endif + uint8_t baro_scp_status; uint32_t baro_scp_pressure; uint16_t baro_scp_temperature; @@ -90,7 +94,9 @@ void baro_scp_event( void ) { baro_scp_pressure |= scp_trans.buf[1]; baro_scp_pressure *= 25; +#ifdef SENSOR_SYNC_SEND DOWNLINK_SEND_SCP_STATUS(DefaultChannel, &baro_scp_pressure, &baro_scp_temperature); +#endif baro_scp_status = BARO_SCP_IDLE; }