Skip to content

Commit

Permalink
[modules] airspeed_ets: add 3rd party mode support
Browse files Browse the repository at this point in the history
Add option to use the raw value. This is needed when the sensor is in third-party mode.

closes paparazzi#1099
  • Loading branch information
alonsoac authored and flixr committed Feb 13, 2015
1 parent 8eb1aeb commit 6616c29
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 6 additions & 4 deletions conf/modules/airspeed_ets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
Has only been tested with V3 of the sensor hardware.

Notes:
Connect directly to TWOG/Tiny I2C port. Multiple sensors can be chained together.
Sensor should be in the proprietary mode (default) and not in 3rd party mode.
Connect directly to TWOG/Tiny/Lisa I2C port. Multiple sensors can be chained together.
Sensor may be in the proprietary mode (default) or in 3rd-party mode. In 3rd-party mode you must define AIRSPEED_ETS_3RD_PARTY_MODE.
A eLogger is needed to set sensor to 3rd-party mode, which is supposed to be more reliable than the default mode.

Sensor module wire assignments:
- Red wire: 5V
Expand All @@ -18,11 +19,12 @@
- Brown wire: SCL
</description>
<define name="AIRSPEED_ETS_I2C_DEV" value="i2cX" description="set i2c peripheral (default: i2c0)"/>
<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_OFFSET" value="offset" description="sensor reading offset for sensor in proprietary mode (default: 0)"/>
<define name="AIRSPEED_ETS_SCALE" value="scale" description="sensor scale factor for sensor in proprietary mode (default: 1.8)"/>
<define name="AIRSPEED_ETS_START_DELAY" value="delay" description="set initial start delay in seconds"/>
<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"/>
<define name="AIRSPEED_ETS_3RD_PARTY_MODE" description="read raw value for sensor in third-party mode"/>
</doc>

<header>
Expand Down
7 changes: 7 additions & 0 deletions sw/airborne/modules/sensors/airspeed_ets.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* Notes:
* Connect directly to TWOG/Tiny I2C port. Multiple sensors can be chained together.
* Sensor should be in the proprietary mode (default) and not in 3rd party mode.
* Define AIRSPEED_ETS_3RD_PARTY_MODE to run it in 3rd party mode.
*
* Sensor module wire assignments:
* Red wire: 5V
Expand Down Expand Up @@ -156,6 +157,7 @@ void airspeed_ets_read_event(void)

// Continue only if a new airspeed value was received
if (airspeed_ets_valid) {
#if !AIRSPEED_ETS_3RD_PARTY_MODE
// Calculate offset average if not done already
if (!airspeed_ets_offset_init) {
--airspeed_ets_cnt;
Expand Down Expand Up @@ -190,6 +192,11 @@ void airspeed_ets_read_event(void)
else {
airspeed_tmp = 0.0;
}
//use raw value for sensor set to third-party mode
#else
airspeed_tmp = airspeed_ets_raw;
#endif //AIRSPEED_ETS_3RD_PARTY_MODE

// Airspeed should always be positive
if (airspeed_tmp < 0.0) {
airspeed_tmp = 0.0;
Expand Down

0 comments on commit 6616c29

Please sign in to comment.