mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
sensor/vehicle_magnetometer: sensor update loop limit iterations
- place upper bound to prevent looping indefinitely (high publish rate, etc)
This commit is contained in:
parent
c5835a48de
commit
d96970a2b9
@ -461,9 +461,11 @@ void VehicleMagnetometer::Run()
|
||||
}
|
||||
|
||||
if (_advertised[uorb_index]) {
|
||||
int sensor_mag_updates = 0;
|
||||
sensor_mag_s report;
|
||||
|
||||
while (_sensor_sub[uorb_index].update(&report)) {
|
||||
while ((sensor_mag_updates < sensor_mag_s::ORB_QUEUE_LENGTH) && _sensor_sub[uorb_index].update(&report)) {
|
||||
sensor_mag_updates++;
|
||||
|
||||
if (_calibration[uorb_index].device_id() != report.device_id) {
|
||||
_calibration[uorb_index].set_device_id(report.device_id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user