mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
sensors/vehicle_air_data: fix air data publication rate (#23717)
Co-authored-by: Nicolas Martin <n.martin@elistair.com>
This commit is contained in:
parent
454ded1b25
commit
d269ddfb49
@ -243,7 +243,7 @@ void VehicleAirData::Run()
|
||||
|
||||
const hrt_abstime timestamp_sample = _timestamp_sample_sum[instance] / _data_sum_count[instance];
|
||||
|
||||
if (timestamp_sample >= _last_publication_timestamp[instance] + interval_us) {
|
||||
if (time_now_us >= _last_publication_timestamp[instance] + interval_us) {
|
||||
|
||||
bool publish = (time_now_us <= timestamp_sample + 1_s);
|
||||
|
||||
@ -278,7 +278,7 @@ void VehicleAirData::Run()
|
||||
_vehicle_air_data_pub.publish(out);
|
||||
}
|
||||
|
||||
_last_publication_timestamp[instance] = timestamp_sample;
|
||||
_last_publication_timestamp[instance] = time_now_us;
|
||||
|
||||
// reset
|
||||
_timestamp_sample_sum[instance] = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user