mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-22 20:36:06 +08:00
[modules] separate USE_AIRSPEED_xx flags
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
<define name="AIRSPEED_AMSYS_MAXPRESURE" value="2068" description="max sensor pressure (Pa) (default: 2068 for -003)(for -001 use 689)"/>
|
||||
<define name="AIRSPEED_AMSYS_SCALE" value="1.0" description="sensor scale factor (default: 1.0)"/>
|
||||
<define name="AIRSPEED_AMSYS_FILTER" value="0." description="sensor filter (default: 0. max:1)"/>
|
||||
<define name="USE_AIRSPEED" description="flag to use the data for airspeed control"/>
|
||||
<define name="AIRSPEED_AMSYS_SYNC_SEND" description="flag to transmit the data as it is acquired"/>
|
||||
<define name="USE_AIRSPEED_AMSYS" value="TRUE|FALSE" description="set airspeed in state interface"/>
|
||||
</doc>
|
||||
<settings>
|
||||
<dl_settings>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
<define name="AIRSPEED_ETS_OFFSET" value="offset" description="sensor reading offset (default: 0)"/>
|
||||
<define name="AIRSPEED_ETS_SCALE" value="scale" description="sensor scale factor (default: 1.8)"/>
|
||||
<define name="AIRSPEED_ETS_START_DELAY" value="delay" description="set initial start delay in seconds"/>
|
||||
<define name="USE_AIRSPEED" description="flag to use the data for airspeed control"/>
|
||||
<define name="AIRSPEED_ETS_SYNC_SEND" description="flag to transmit the data as it is acquired"/>
|
||||
<define name="USE_AIRSPEED_ETS" value="TRUE|FALSE" description="set airspeed in state interface"/>
|
||||
</doc>
|
||||
|
||||
<header>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<define name="MS45XX_PRESSURE_OFFSET" value="8618.4" description="pressure offset in Pa (default: set according to pressure range and output type according to datasheet)"/>
|
||||
<define name="MS45XX_AIRSPEED_SCALE" value="1.6327" description="quadratic scale factor to convert differential pressure to airspeed"/>
|
||||
<define name="MS45XX_LOWPASS_TAU" value="0.15" description="Time constant for second order Butterworth low pass filter"/>
|
||||
<define name="USE_AIRSPEED" description="flag to use the data for airspeed control"/>
|
||||
<define name="USE_AIRSPEED_MS45XX" value="TRUE|FALSE" description="set airspeed in state interface"/>
|
||||
</doc>
|
||||
|
||||
<settings>
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
controlled by a dspic
|
||||
return scaled values over I2C
|
||||
</description>
|
||||
<define name="PBN_AIRSPEED_SCALE" value="(1./0.54)" description="quadratic scale factor to convert differential pressure to airspeed"/>
|
||||
<define name="PBN_ALTITUDE_SCALE" value="0.32" description="linear scale factor for altitude"/>
|
||||
<define name="PBN_PRESSURE_OFFSET" value="101325.0" description="pressure offset"/>
|
||||
<define name="USE_AIRSPEED_PBN" value="TRUE|FALSE" description="set airspeed in state interface"/>
|
||||
</doc>
|
||||
<settings>
|
||||
<dl_settings>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -47,12 +47,17 @@
|
||||
#include "subsystems/datalink/downlink.h"
|
||||
#include <math.h>
|
||||
|
||||
#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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
/** @file modules/sensors/pressure_board_navarro.h
|
||||
*
|
||||
* Pressure Board Navarro (2010)
|
||||
*
|
||||
* by Matthieu Navarro
|
||||
|
||||
Reference in New Issue
Block a user