diff options
author | Andrew Tridgell <tridge@samba.org> | 2014-05-19 16:33:15 +1000 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-05-20 07:32:31 +0200 |
commit | c945693054a15db03414b0446372c7a457fa743a (patch) | |
tree | e51d79e80f7d390862311ffa6f400fa975f66f22 /src | |
parent | b250e28abfaf4d1adc8bdfb815fff369e0e41cc6 (diff) | |
download | px4-firmware-c945693054a15db03414b0446372c7a457fa743a.tar.gz px4-firmware-c945693054a15db03414b0446372c7a457fa743a.tar.bz2 px4-firmware-c945693054a15db03414b0446372c7a457fa743a.zip |
ets airspeed: Support raw field
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/ets_airspeed/ets_airspeed.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/drivers/ets_airspeed/ets_airspeed.cpp b/src/drivers/ets_airspeed/ets_airspeed.cpp index 146a06e7c..2de7063ea 100644 --- a/src/drivers/ets_airspeed/ets_airspeed.cpp +++ b/src/drivers/ets_airspeed/ets_airspeed.cpp @@ -154,8 +154,9 @@ ETSAirspeed::collect() return ret; } - uint16_t diff_pres_pa = val[1] << 8 | val[0]; - if (diff_pres_pa == 0) { + uint16_t diff_pres_pa_raw = val[1] << 8 | val[0]; + uint16_t diff_pres_pa; + if (diff_pres_pa_raw == 0) { // a zero value means the pressure sensor cannot give us a // value. We need to return, and not report a value or the // caller could end up using this value as part of an @@ -165,10 +166,10 @@ ETSAirspeed::collect() return -1; } - if (diff_pres_pa < _diff_pres_offset + MIN_ACCURATE_DIFF_PRES_PA) { + if (diff_pres_pa_raw < _diff_pres_offset + MIN_ACCURATE_DIFF_PRES_PA) { diff_pres_pa = 0; } else { - diff_pres_pa -= _diff_pres_offset; + diff_pres_pa = diff_pres_pa_raw - _diff_pres_offset; } // Track maximum differential pressure measured (so we can work out top speed). @@ -183,6 +184,7 @@ ETSAirspeed::collect() // XXX we may want to smooth out the readings to remove noise. report.differential_pressure_filtered_pa = (float)diff_pres_pa; + report.differential_pressure_raw_pa = (float)diff_pres_pa_raw; report.temperature = -1000.0f; report.voltage = 0; report.max_differential_pressure_pa = _max_differential_pressure_pa; |