47 #include "pprzlink/messages.h"
52 #ifndef USE_AIRSPEED_ETS
54 #define USE_AIRSPEED_ETS TRUE
59 #if !USE_AIRSPEED_ETS && !AIRSPEED_ETS_SYNC_SEND
60 #warning either set USE_AIRSPEED_ETS or AIRSPEED_ETS_SYNC_SEND to use airspeed_ets
63 #define AIRSPEED_ETS_ADDR 0xEA
64 #ifndef AIRSPEED_ETS_SCALE
65 #define AIRSPEED_ETS_SCALE 1.8
67 #ifndef AIRSPEED_ETS_OFFSET
68 #define AIRSPEED_ETS_OFFSET 0
70 #define AIRSPEED_ETS_OFFSET_MAX 1750
71 #define AIRSPEED_ETS_OFFSET_MIN 1450
72 #define AIRSPEED_ETS_OFFSET_NBSAMPLES_INIT 40
73 #define AIRSPEED_ETS_OFFSET_NBSAMPLES_AVRG 60
74 #define AIRSPEED_ETS_NBSAMPLES_AVRG 10
76 #ifndef AIRSPEED_ETS_I2C_DEV
77 #define AIRSPEED_ETS_I2C_DEV i2c0
82 #ifndef AIRSPEED_ETS_START_DELAY
83 #define AIRSPEED_ETS_START_DELAY 0.2
88 #if AIRSPEED_ETS_SDLOG
91 bool log_airspeed_ets_started;
137 #if AIRSPEED_ETS_SDLOG
138 log_airspeed_ets_started =
false;
153 #elif !defined USE_NPS
162 float airspeed_tmp = 0.0;
175 #if !AIRSPEED_ETS_3RD_PARTY_MODE
198 #ifdef AIRSPEED_ETS_REVERSE
216 if (airspeed_tmp < 0.0) {
236 #if AIRSPEED_ETS_SYNC_SEND
244 #if AIRSPEED_ETS_SDLOG
247 if (!log_airspeed_ets_started) {
248 sdLogWriteLog(
pprzLogFile,
"AIRSPEED_ETS: raw offset airspeed(m/s) GPS_fix TOW(ms) Week Lat(1e7deg) Lon(1e7deg) HMSL(mm) gpseed(cm/s) course(1e7rad) climb(cm/s)\n");
249 log_airspeed_ets_started =
true;
251 sdLogWriteLog(
pprzLogFile,
"airspeed_ets: %d %d %8.4f %d %d %d %d %d %d %d %d %d\n",
Main include for ABI (AirBorneInterface).
float airspeed_ets_buffer[AIRSPEED_ETS_NBSAMPLES_AVRG]
#define AIRSPEED_ETS_OFFSET_MIN
bool airspeed_ets_delay_done
#define AIRSPEED_ETS_SCALE
bool airspeed_ets_offset_init
volatile bool airspeed_ets_i2c_done
uint32_t airspeed_ets_offset_tmp
uint16_t airspeed_ets_cnt
#define AIRSPEED_ETS_OFFSET_NBSAMPLES_INIT
#define AIRSPEED_ETS_OFFSET_NBSAMPLES_AVRG
uint16_t airspeed_ets_raw
#define AIRSPEED_ETS_START_DELAY
delay in seconds until sensor is read after startup
#define AIRSPEED_ETS_OFFSET_MAX
void airspeed_ets_read_event(void)
uint32_t airspeed_ets_delay_time
#define AIRSPEED_ETS_NBSAMPLES_AVRG
uint16_t airspeed_ets_offset
void airspeed_ets_init(void)
void airspeed_ets_read_periodic(void)
#define AIRSPEED_ETS_OFFSET
struct i2c_transaction airspeed_ets_i2c_trans
int airspeed_ets_buffer_idx
#define AIRSPEED_ETS_I2C_DEV
#define AIRSPEED_ETS_ADDR
Driver for the EagleTree Systems Airspeed Sensor.
Common code for AP and FBW telemetry.
struct GpsState gps
global GPS state
Device independent GPS code (interface)
uint32_t tow
GPS time of week in ms.
int32_t hmsl
height above mean sea level (MSL) in mm
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
struct NedCoor_i ned_vel
speed NED in cm/s
uint16_t gspeed
norm of 2d ground speed in cm/s
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
enum I2CTransactionStatus status
Transaction status.
bool i2c_receive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint16_t len)
Submit a read only transaction.
@ I2CTransDone
transaction set to done by user level
I2C transaction structure.
int32_t lat
in degrees*1e7
int32_t lon
in degrees*1e7
static void stateSetAirspeed_f(float airspeed)
Set airspeed (float).
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
API to get/set the generic vehicle states.
Architecture independent timing functions.
#define SysTimeTimerStart(_t)
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.