mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 16:58:48 +08:00
Add USE_AIRSPEED and SENSOR_SYNC_SEND for airspeed and baro
This commit is contained in:
@@ -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
|
||||
-->
|
||||
|
||||
<module name="airspeed_ets" dir="sensors">
|
||||
@@ -18,7 +20,6 @@
|
||||
|
||||
<makefile>
|
||||
<file name="airspeed_ets.c"/>
|
||||
<flag name="USE_AIRSPEED"/>
|
||||
</makefile>
|
||||
|
||||
</module>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<!--
|
||||
Bosch BMP085 pressure sensor
|
||||
@param BMP_I2C_DEV i2c device (default i2c0)
|
||||
@flag SENSOR_SYNC_SEND to transmit the data as it is acquired
|
||||
-->
|
||||
|
||||
<module name="baro_bmp" dir="sensors">
|
||||
<header>
|
||||
<file name="baro_bmp.h"/>
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<!--
|
||||
VTI SCP1000 pressure sensor (SPI)
|
||||
@flag SENSOR_SYNC_SEND to transmit the data as it is acquired
|
||||
-->
|
||||
|
||||
<module name="baro_scp" dir="sensors">
|
||||
<header>
|
||||
<file name="baro_scp.h"/>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<!--
|
||||
Baro SCP module (I2C)
|
||||
VTI SCP1000 pressure sensor (I2C)
|
||||
@param SCP_I2C_DEV i2c device (default i2c0)
|
||||
@flag SENSOR_SYNC_SEND to transmit the data as it is acquired
|
||||
-->
|
||||
|
||||
<module name="baro_scp_i2c" dir="sensors">
|
||||
|
||||
@@ -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 <math.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user