From 1fc38aab921e092b4adf4560c5fc172d1f39bd69 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 4 Mar 2024 13:07:17 -0500 Subject: [PATCH] sensors/vehicle_air_data: sensor update loop limit iterations --- src/modules/sensors/vehicle_air_data/VehicleAirData.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/sensors/vehicle_air_data/VehicleAirData.cpp b/src/modules/sensors/vehicle_air_data/VehicleAirData.cpp index d8654c4071..c18d670cfc 100644 --- a/src/modules/sensors/vehicle_air_data/VehicleAirData.cpp +++ b/src/modules/sensors/vehicle_air_data/VehicleAirData.cpp @@ -163,9 +163,11 @@ void VehicleAirData::Run() } if (_advertised[uorb_index]) { + int sensor_sub_updates = 0; 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) { _calibration[uorb_index].set_device_id(report.device_id);