From d0b96d4cd958e4a157827535748537d331d09aac Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 27 Oct 2022 13:46:13 +1100 Subject: [PATCH] GCS_MAVLink: deprecate handling of AUTOPILOT_VERSION_REQUEST This can be done equivalently with MAV_CMD_REQUEST_MESSAGE --- libraries/GCS_MAVLink/GCS.h | 2 ++ libraries/GCS_MAVLink/GCS_Common.cpp | 4 ++++ libraries/GCS_MAVLink/GCS_config.h | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/libraries/GCS_MAVLink/GCS.h b/libraries/GCS_MAVLink/GCS.h index 4bbbcf9b64..3d793bd34e 100644 --- a/libraries/GCS_MAVLink/GCS.h +++ b/libraries/GCS_MAVLink/GCS.h @@ -587,7 +587,9 @@ protected: virtual MAV_RESULT handle_flight_termination(const mavlink_command_long_t &packet); +#if AP_MAVLINK_AUTOPILOT_VERSION_REQUEST_ENABLED void handle_send_autopilot_version(const mavlink_message_t &msg); +#endif MAV_RESULT handle_command_request_autopilot_capabilities(const mavlink_command_long_t &packet); virtual void send_banner(); diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index 7e9b8f2c5c..ec697621e1 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -3869,9 +3869,11 @@ void GCS_MAVLINK::handle_common_message(const mavlink_message_t &msg) handle_set_mode(msg); break; +#if AP_MAVLINK_AUTOPILOT_VERSION_REQUEST_ENABLED case MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST: handle_send_autopilot_version(msg); break; +#endif case MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST: case MAVLINK_MSG_ID_MISSION_REQUEST_LIST: @@ -4141,10 +4143,12 @@ void GCS_MAVLINK::handle_common_mission_message(const mavlink_message_t &msg) } } +#if AP_MAVLINK_AUTOPILOT_VERSION_REQUEST_ENABLED void GCS_MAVLINK::handle_send_autopilot_version(const mavlink_message_t &msg) { send_message(MSG_AUTOPILOT_VERSION); } +#endif void GCS_MAVLINK::send_banner() { diff --git a/libraries/GCS_MAVLink/GCS_config.h b/libraries/GCS_MAVLink/GCS_config.h index 31fdc205ea..2442546d27 100644 --- a/libraries/GCS_MAVLink/GCS_config.h +++ b/libraries/GCS_MAVLink/GCS_config.h @@ -18,3 +18,10 @@ #ifndef AP_MAVLINK_MISSION_SET_CURRENT_ENABLED #define AP_MAVLINK_MISSION_SET_CURRENT_ENABLED 1 #endif + +// AUTOPILOT_VERSION_REQUEST is slated to be removed; an instance of +// AUTOPILOT_VERSION can be requested with MAV_CMD_REQUEST_MESSAGE, +// which gets you an ACK/NACK +#ifndef AP_MAVLINK_AUTOPILOT_VERSION_REQUEST_ENABLED +#define AP_MAVLINK_AUTOPILOT_VERSION_REQUEST_ENABLED 1 +#endif