mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
fix(bmp581): correct timestamp_sample to integration midpoint
The BMP581 pressure measurement is integrated over a configurable window (~23ms at 32x pressure / 2x temperature oversampling). The read time corresponds to the end of the integration window, introducing a systematic timing bias. Correct timestamp_sample to the midpoint by subtracting measurement_time / 2.
This commit is contained in:
parent
7f59e5dc16
commit
8170e113fd
@ -137,8 +137,12 @@ int BMP581::collect()
|
||||
|
||||
perf_begin(_sample_perf);
|
||||
|
||||
/* this should be fairly close to the end of the conversion, so the best approximation of the time */
|
||||
const hrt_abstime timestamp_sample = hrt_absolute_time();
|
||||
/* Correct for measurement integration delay: the pressure was
|
||||
* integrated over the preceding measurement_time window, so the
|
||||
* effective sample midpoint is half the measurement time before now. */
|
||||
const hrt_abstime now = hrt_absolute_time();
|
||||
const hrt_abstime half_meas = get_measurement_time() / 2;
|
||||
const hrt_abstime timestamp_sample = (now > half_meas) ? (now - half_meas) : now;
|
||||
|
||||
int_status = get_interrupt_status();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user