From fe48de6240d783d0da8f388f06209fe43f1c0c3b Mon Sep 17 00:00:00 2001 From: Daniel Mesham Date: Wed, 4 May 2022 09:03:52 +0200 Subject: [PATCH] Check position subscriber before force-send flag when sending GPS global origin stream --- src/modules/mavlink/streams/GPS_GLOBAL_ORIGIN.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/mavlink/streams/GPS_GLOBAL_ORIGIN.hpp b/src/modules/mavlink/streams/GPS_GLOBAL_ORIGIN.hpp index 7f59f52c03..fb707b3d14 100644 --- a/src/modules/mavlink/streams/GPS_GLOBAL_ORIGIN.hpp +++ b/src/modules/mavlink/streams/GPS_GLOBAL_ORIGIN.hpp @@ -77,7 +77,8 @@ private: { vehicle_local_position_s vehicle_local_position{}; - if (_force_next_send || _vehicle_local_position_sub.update(&vehicle_local_position)) { + if ((_vehicle_local_position_sub.updated() || _force_next_send) + && _vehicle_local_position_sub.copy(&vehicle_local_position)) { if (vehicle_local_position.xy_global && vehicle_local_position.z_global) { static constexpr double LLA_MIN_DIFF = 0.0000001; // ~11.132 mm at the equator