meas_airspeed: don't use stale/bad data in airspeed reading

also fixed handling of perf counters on error
This commit is contained in:
Andrew Tridgell
2013-08-28 11:16:55 +02:00
committed by Lorenz Meier
parent fdbc09e2a5
commit 935ed2fe49
+8 -1
View File
@@ -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);