forked from Archive/PX4-Autopilot
meas_airspeed: don't use stale/bad data in airspeed reading
also fixed handling of perf counters on error
This commit is contained in:
parent
fdbc09e2a5
commit
935ed2fe49
|
@ -162,6 +162,8 @@ MEASAirspeed::collect()
|
|||
|
||||
if (ret < 0) {
|
||||
log("error reading from sensor: %d", ret);
|
||||
perf_count(_comms_errors);
|
||||
perf_end(_sample_perf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -169,9 +171,14 @@ MEASAirspeed::collect()
|
|||
|
||||
if (status == 2) {
|
||||
log("err: stale data");
|
||||
|
||||
perf_count(_comms_errors);
|
||||
perf_end(_sample_perf);
|
||||
return ret;
|
||||
} else if (status == 3) {
|
||||
log("err: fault");
|
||||
perf_count(_comms_errors);
|
||||
perf_end(_sample_perf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//uint16_t diff_pres_pa = (val[1]) | ((val[0] & ~(0xC0)) << 8);
|
||||
|
|
Loading…
Reference in New Issue