mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 01:43:34 +08:00
ets_airspeed: cope with zero value from ETS airspeed sensor
This commit is contained in:
committed by
Lorenz Meier
parent
043dc4e225
commit
dad76c56c6
@@ -157,6 +157,14 @@ ETSAirspeed::collect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16_t diff_pres_pa = val[1] << 8 | val[0];
|
uint16_t diff_pres_pa = val[1] << 8 | val[0];
|
||||||
|
if (diff_pres_pa == 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
|
||||||
|
// average
|
||||||
|
log("zero value from sensor");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (diff_pres_pa < _diff_pres_offset + MIN_ACCURATE_DIFF_PRES_PA) {
|
if (diff_pres_pa < _diff_pres_offset + MIN_ACCURATE_DIFF_PRES_PA) {
|
||||||
diff_pres_pa = 0;
|
diff_pres_pa = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user