[modules] airspeed_ets: add 3rd party mode support

Add option to use the raw value. This is needed when the sensor is in third-party mode.

closes #1099
This commit is contained in:
alonsoac
2015-02-11 22:53:23 -06:00
committed by Felix Ruess
parent 8eb1aebd7c
commit 6616c2977d
2 changed files with 13 additions and 4 deletions
+6 -4
View File
@@ -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
@@ -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>
@@ -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
@@ -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;
@@ -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;