47 #include "pprzlink/messages.h"
52 #if PERIODIC_TELEMETRY
56 #ifndef USE_AIRSPEED_ETS
58 #define USE_AIRSPEED_ETS TRUE
67 #define AIRSPEED_ETS_ADDR 0xEA
68 #ifndef AIRSPEED_ETS_SCALE
69 #define AIRSPEED_ETS_SCALE 1.8
71 #ifndef AIRSPEED_ETS_OFFSET
72 #define AIRSPEED_ETS_OFFSET 0
74 #define AIRSPEED_ETS_OFFSET_MAX 1750
75 #define AIRSPEED_ETS_OFFSET_MIN 1450
76 #define AIRSPEED_ETS_OFFSET_NBSAMPLES_INIT 40
77 #define AIRSPEED_ETS_OFFSET_NBSAMPLES_AVRG 60
78 #define AIRSPEED_ETS_NBSAMPLES_AVRG 10
80 #ifndef AIRSPEED_ETS_I2C_DEV
81 #define AIRSPEED_ETS_I2C_DEV i2c0
86 #ifndef AIRSPEED_ETS_START_DELAY
87 #define AIRSPEED_ETS_START_DELAY 0.2
92 #if AIRSPEED_ETS_SDLOG
95 bool log_airspeed_ets_started;
125 pprz_msg_send_AIRSPEED_RAW(trans,
dev,AC_ID,
157 #if PERIODIC_TELEMETRY
162 #if AIRSPEED_ETS_SDLOG
163 log_airspeed_ets_started =
false;
178 #elif !defined USE_NPS
179 extern float sim_air_speed;
187 float airspeed_tmp = 0.0;
200 #if !AIRSPEED_ETS_3RD_PARTY_MODE
223 #ifdef AIRSPEED_ETS_REVERSE
241 if (airspeed_tmp < 0.0) {
266 #if AIRSPEED_ETS_SDLOG
269 if (!log_airspeed_ets_started) {
270 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");
271 log_airspeed_ets_started =
true;
273 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]
static void airspeed_ets_downlink(struct transport_tx *trans, struct link_device *dev)
#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.
static const float offset[]
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")
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
API to get/set the generic vehicle states.
static const struct usb_device_descriptor dev
Architecture independent timing functions.
#define SysTimeTimerStart(_t)
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
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.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.