mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-02 10:23:25 +08:00
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:
committed by
Andrew Tridgell
parent
805fa9f8d0
commit
de3ff6d01a
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user