From 792f3b8a1511297ee4a021f9639a16a60178d9bf Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 15 Oct 2016 19:51:17 +1100 Subject: [PATCH] GCS_MAVLink: added handle_rc_bind() --- libraries/GCS_MAVLink/GCS.h | 1 + libraries/GCS_MAVLink/GCS_Common.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/libraries/GCS_MAVLink/GCS.h b/libraries/GCS_MAVLink/GCS.h index c673d66df3..f8a2de4f3e 100644 --- a/libraries/GCS_MAVLink/GCS.h +++ b/libraries/GCS_MAVLink/GCS.h @@ -269,6 +269,7 @@ protected: void handle_log_message(mavlink_message_t *msg, DataFlash_Class &dataflash); void handle_setup_signing(const mavlink_message_t *msg); uint8_t handle_preflight_reboot(const mavlink_command_long_t &packet, bool disable_overrides); + uint8_t handle_rc_bind(const mavlink_command_long_t &packet); private: diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index 5ee3394541..96d7121058 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -1764,3 +1764,18 @@ uint8_t GCS_MAVLINK::handle_preflight_reboot(const mavlink_command_long_t &packe } return MAV_RESULT_UNSUPPORTED; } + + +/* + handle a R/C bind request (for spektrum) + */ +uint8_t GCS_MAVLINK::handle_rc_bind(const mavlink_command_long_t &packet) +{ + // initiate bind procedure. We accept the DSM type from either + // param1 or param2 due to a past mixup with what parameter is the + // right one + if (!hal.rcin->rc_bind(packet.param2>0?packet.param2:packet.param1)) { + return MAV_RESULT_FAILED; + } + return MAV_RESULT_ACCEPTED; +}