From a9814d34c7d854302db51a372f44a73c8d3e3a2f Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Tue, 30 Apr 2019 12:22:47 +0200 Subject: [PATCH] AC_PrecLand: pass mavlink_message_t by const reference --- libraries/AC_PrecLand/AC_PrecLand.cpp | 2 +- libraries/AC_PrecLand/AC_PrecLand.h | 2 +- libraries/AC_PrecLand/AC_PrecLand_Backend.h | 2 +- libraries/AC_PrecLand/AC_PrecLand_Companion.cpp | 4 ++-- libraries/AC_PrecLand/AC_PrecLand_Companion.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/AC_PrecLand/AC_PrecLand.cpp b/libraries/AC_PrecLand/AC_PrecLand.cpp index bf4a911ee8..701c94aac9 100644 --- a/libraries/AC_PrecLand/AC_PrecLand.cpp +++ b/libraries/AC_PrecLand/AC_PrecLand.cpp @@ -251,7 +251,7 @@ bool AC_PrecLand::get_target_velocity_relative_cms(Vector2f& ret) } // handle_msg - Process a LANDING_TARGET mavlink message -void AC_PrecLand::handle_msg(mavlink_message_t* msg) +void AC_PrecLand::handle_msg(const mavlink_message_t &msg) { // run backend update if (_backend != nullptr) { diff --git a/libraries/AC_PrecLand/AC_PrecLand.h b/libraries/AC_PrecLand/AC_PrecLand.h index 9f60a8e54b..1253530966 100644 --- a/libraries/AC_PrecLand/AC_PrecLand.h +++ b/libraries/AC_PrecLand/AC_PrecLand.h @@ -86,7 +86,7 @@ public: bool target_acquired(); // process a LANDING_TARGET mavlink message - void handle_msg(mavlink_message_t* msg); + void handle_msg(const mavlink_message_t &msg); // parameter var table static const struct AP_Param::GroupInfo var_info[]; diff --git a/libraries/AC_PrecLand/AC_PrecLand_Backend.h b/libraries/AC_PrecLand/AC_PrecLand_Backend.h index 84ea4016a4..d6eeb33a45 100644 --- a/libraries/AC_PrecLand/AC_PrecLand_Backend.h +++ b/libraries/AC_PrecLand/AC_PrecLand_Backend.h @@ -35,7 +35,7 @@ public: virtual float distance_to_target() { return 0.0f; }; // parses a mavlink message from the companion computer - virtual void handle_msg(mavlink_message_t* msg) {}; + virtual void handle_msg(const mavlink_message_t &msg) {}; // get bus parameter int8_t get_bus(void) const { return _frontend._bus.get(); } diff --git a/libraries/AC_PrecLand/AC_PrecLand_Companion.cpp b/libraries/AC_PrecLand/AC_PrecLand_Companion.cpp index ab82813146..6e7934e02b 100644 --- a/libraries/AC_PrecLand/AC_PrecLand_Companion.cpp +++ b/libraries/AC_PrecLand/AC_PrecLand_Companion.cpp @@ -42,11 +42,11 @@ float AC_PrecLand_Companion::distance_to_target() return _distance_to_target; } -void AC_PrecLand_Companion::handle_msg(mavlink_message_t* msg) +void AC_PrecLand_Companion::handle_msg(const mavlink_message_t &msg) { // parse mavlink message __mavlink_landing_target_t packet; - mavlink_msg_landing_target_decode(msg, &packet); + mavlink_msg_landing_target_decode(&msg, &packet); _timestamp_us = packet.time_usec; _distance_to_target = packet.distance; diff --git a/libraries/AC_PrecLand/AC_PrecLand_Companion.h b/libraries/AC_PrecLand/AC_PrecLand_Companion.h index 11b5b7a0a1..eca64a3c14 100644 --- a/libraries/AC_PrecLand/AC_PrecLand_Companion.h +++ b/libraries/AC_PrecLand/AC_PrecLand_Companion.h @@ -36,7 +36,7 @@ public: float distance_to_target() override; // parses a mavlink message from the companion computer - void handle_msg(mavlink_message_t* msg) override; + void handle_msg(const mavlink_message_t &msg) override; private: uint64_t _timestamp_us; // timestamp from message