From fd332287b24b7e7e0d3504850b8173576ca7eacc Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 30 Jul 2018 18:13:37 -0400 Subject: [PATCH] COPTER: Add mavlink landing gear control Add MAV_CMD_AIRFRAME_CONFIGURATION (# 2520), which is for landing gear control. Param 1 is not used in ArduPilot Param 2 is deploy/retract. 0 is deploy, 1 is Retract --- ArduCopter/GCS_Mavlink.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ArduCopter/GCS_Mavlink.cpp b/ArduCopter/GCS_Mavlink.cpp index 25e363ec3c..6e4f56ce9d 100644 --- a/ArduCopter/GCS_Mavlink.cpp +++ b/ArduCopter/GCS_Mavlink.cpp @@ -928,6 +928,21 @@ MAV_RESULT GCS_MAVLINK_Copter::handle_command_long_packet(const mavlink_command_ return MAV_RESULT_FAILED; #endif + case MAV_CMD_AIRFRAME_CONFIGURATION: { + // Param 1: Select which gear, not used in ArduPilot + // Param 2: 0 = Deploy, 1 = Retract + // For safety, anything other than 1 will deploy + switch ((uint8_t)packet.param2) { + case 1: + copter.landinggear.set_position(AP_LandingGear::LandingGear_Retract); + return MAV_RESULT_ACCEPTED; + default: + copter.landinggear.set_position(AP_LandingGear::LandingGear_Deploy); + return MAV_RESULT_ACCEPTED; + } + return MAV_RESULT_FAILED; + } + /* Solo user presses Fly button */ case MAV_CMD_SOLO_BTN_FLY_CLICK: { if (copter.failsafe.radio) {