From 55936895e32db2ee899583e8fb949fa5a230ca3c Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Thu, 14 Nov 2024 17:42:30 +0000 Subject: [PATCH] GCS_MAVLink: send `AVAILABLE_MODES_MONITOR` message --- libraries/GCS_MAVLink/GCS.h | 10 ++++++++++ libraries/GCS_MAVLink/GCS_Common.cpp | 21 +++++++++++++++++++++ libraries/GCS_MAVLink/ap_message.h | 1 + 3 files changed, 32 insertions(+) diff --git a/libraries/GCS_MAVLink/GCS.h b/libraries/GCS_MAVLink/GCS.h index 8bb1108de3..649a12a6ad 100644 --- a/libraries/GCS_MAVLink/GCS.h +++ b/libraries/GCS_MAVLink/GCS.h @@ -1139,6 +1139,7 @@ private: uint8_t next_index; } available_modes; bool send_available_modes(); + bool send_available_mode_monitor(); }; @@ -1301,6 +1302,11 @@ public: MAV_RESULT lua_command_int_packet(const mavlink_command_int_t &packet); #endif + // Sequence number should be incremented when available modes changes + // Sent in AVAILABLE_MODES_MONITOR msg + uint8_t get_available_modes_sequence() const { return available_modes_sequence; } + void available_modes_changed() { available_modes_sequence += 1; } + protected: virtual GCS_MAVLINK *new_gcs_mavlink_backend(GCS_MAVLINK_Parameters ¶ms, @@ -1378,6 +1384,10 @@ private: // GCS::update_send is called so we don't starve later links of // time in which they are permitted to send messages. uint8_t first_backend_to_send; + + // Sequence number should be incremented when available modes changes + // Sent in AVAILABLE_MODES_MONITOR msg + uint8_t available_modes_sequence; }; GCS &gcs(); diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index ed46758517..e670339e7b 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -1153,6 +1153,7 @@ ap_message GCS_MAVLINK::mavlink_id_to_ap_message_id(const uint32_t mavlink_id) c { MAVLINK_MSG_ID_AIRSPEED, MSG_AIRSPEED}, #endif { MAVLINK_MSG_ID_AVAILABLE_MODES, MSG_AVAILABLE_MODES}, + { MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR, MSG_AVAILABLE_MODES_MONITOR}, }; for (uint8_t i=0; i