Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BACKPORT v1.13] ms5611: ignore reading 0 #20351

Merged
merged 1 commit into from
Oct 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/drivers/barometer/ms5611/ms5611.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,18 @@ MS5611::collect()
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 */
if (_measure_phase == 0) {

Expand Down