From d437991e4ed24290de483b3a67d478a88d62b5c7 Mon Sep 17 00:00:00 2001 From: olliw42 Date: Thu, 29 Feb 2024 07:43:31 +0100 Subject: [PATCH] GCS_MAVLink: handle RADIO_RC_CHANNELS --- libraries/GCS_MAVLink/GCS.h | 1 + libraries/GCS_MAVLink/GCS_Common.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/libraries/GCS_MAVLink/GCS.h b/libraries/GCS_MAVLink/GCS.h index 736cadfa053a93..7a3112b61a8cf2 100644 --- a/libraries/GCS_MAVLink/GCS.h +++ b/libraries/GCS_MAVLink/GCS.h @@ -690,6 +690,7 @@ class GCS_MAVLINK void handle_optical_flow(const mavlink_message_t &msg); void handle_manual_control(const mavlink_message_t &msg); + void handle_radio_rc_channels(const mavlink_message_t &msg); // default empty handling of LANDING_TARGET virtual void handle_landing_target(const mavlink_landing_target_t &packet, uint32_t timestamp_ms) { } diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index a4d700c6d478e1..06029c2f0f6555 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -4189,6 +4189,11 @@ void GCS_MAVLINK::handle_message(const mavlink_message_t &msg) case MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE: handle_rc_channels_override(msg); break; +#if AP_RCPROTOCOL_MAVLINK_RADIO_ENABLED + case MAVLINK_MSG_ID_RADIO_RC_CHANNELS: + handle_radio_rc_channels(msg); + break; +#endif #endif #if AP_OPTICALFLOW_ENABLED @@ -6970,4 +6975,16 @@ MAV_RESULT GCS_MAVLINK::handle_control_high_latency(const mavlink_command_int_t } #endif // HAL_HIGH_LATENCY2_ENABLED +#if AP_RCPROTOCOL_MAVLINK_RADIO_ENABLED +void GCS_MAVLINK::handle_radio_rc_channels(const mavlink_message_t &msg) +{ + mavlink_radio_rc_channels_t packet; + mavlink_msg_radio_rc_channels_decode(&msg, &packet); + +#if AP_RCPROTOCOL_ENABLED + AP::RC().handle_radio_rc_channels(&packet); +#endif +} +#endif // AP_RCPROTOCOL_MAVLINK_RADIO_ENABLED + #endif // HAL_GCS_ENABLED