sensors/vehicle_air_data: sensor update loop limit iterations

This commit is contained in:
Daniel Agar 2024-03-04 13:07:17 -05:00
parent 2bf1eeb003
commit 1fc38aab92
1 changed files with 3 additions and 1 deletions

View File

@ -163,9 +163,11 @@ void VehicleAirData::Run()
} }
if (_advertised[uorb_index]) { if (_advertised[uorb_index]) {
int sensor_sub_updates = 0;
sensor_baro_s report; sensor_baro_s report;
while (_sensor_sub[uorb_index].update(&report)) { while ((sensor_sub_updates < sensor_baro_s::ORB_QUEUE_LENGTH) && _sensor_sub[uorb_index].update(&report)) {
sensor_sub_updates++;
if (_calibration[uorb_index].device_id() != report.device_id) { if (_calibration[uorb_index].device_id() != report.device_id) {
_calibration[uorb_index].set_device_id(report.device_id); _calibration[uorb_index].set_device_id(report.device_id);