diff --git a/src/modules/mavlink/streams/GPS_GLOBAL_ORIGIN.hpp b/src/modules/mavlink/streams/GPS_GLOBAL_ORIGIN.hpp index 22802b9082..7f59f52c03 100644 --- a/src/modules/mavlink/streams/GPS_GLOBAL_ORIGIN.hpp +++ b/src/modules/mavlink/streams/GPS_GLOBAL_ORIGIN.hpp @@ -58,12 +58,8 @@ public: bool request_message(float param2, float param3, float param4, float param5, float param6, float param7) override { - if (_valid) { - _force_next_send = true; - return true; - } - - return false; + _force_next_send = true; + return send(); } private: @@ -75,15 +71,13 @@ private: double _ref_lat{static_cast(NAN)}; double _ref_lon{static_cast(NAN)}; float _ref_alt{NAN}; - - bool _valid{false}; bool _force_next_send{true}; bool send() override { - vehicle_local_position_s vehicle_local_position; + vehicle_local_position_s vehicle_local_position{}; - if (_vehicle_local_position_sub.update(&vehicle_local_position)) { + if (_force_next_send || _vehicle_local_position_sub.update(&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 @@ -107,7 +101,6 @@ private: _ref_alt = vehicle_local_position.ref_alt; _force_next_send = false; - _valid = true; return true; }