AP_Baro: read bmp581 thrice to get corrected data

original read-twice suffers from beat frequencies where the 50Hz update on the device and the 50Hz update rate of the backend drift relative to one another.  The device appears dead when that happens.
This commit is contained in:
Peter Barker
2026-09-08 10:51:50 +10:00
committed by Andrew Tridgell
parent 805fa9f8d0
commit de3ff6d01a
+8 -2
View File
@@ -157,8 +157,14 @@ void AP_Baro_BMP581::timer(void)
return;
}
if (memcmp(buf, buf2, ARRAY_SIZE(buf)) != 0) {
// we didn't get the same data twice. Reject.
return;
// we didn't get the same data twice. Reject. See if we can
// git a third measurement to match the second:
if (!_dev->read_registers(BMP581_REG_TEMP_DATA_XLSB, buf, sizeof(buf))) {
return;
}
if (memcmp(buf, buf2, ARRAY_SIZE(buf)) != 0) {
return;
}
}
WITH_SEMAPHORE(_sem);