mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 01:51:37 +08:00
ms5611: ignore reading 0
This prevents publishing a negative pressure which leads to a NAN altitude estimate further down the line.
This commit is contained in:
@@ -253,6 +253,18 @@ MS5611::collect()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// According to the sensor docs:
|
||||||
|
// If the conversion is not executed before the ADC read command, or the
|
||||||
|
// ADC read command is repeated, it will give 0 as the output result.
|
||||||
|
//
|
||||||
|
// We have seen 0 during the init phase on I2C, therefore, we add this
|
||||||
|
// protection in.
|
||||||
|
if (raw == 0) {
|
||||||
|
perf_count(_comms_errors);
|
||||||
|
perf_end(_sample_perf);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* handle a measurement */
|
/* handle a measurement */
|
||||||
if (_measure_phase == 0) {
|
if (_measure_phase == 0) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user