From 3c76ec492bf0116f9ba7d8de50dad3d519871cb4 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 31 Aug 2018 09:48:00 -0400 Subject: [PATCH] Copter: Impliment mavlink landing gear control Uses MAV_CMD_AIRFRAME_CONFIGURATION to retract and deploy landing gear --- ArduCopter/GCS_Mavlink.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ArduCopter/GCS_Mavlink.cpp b/ArduCopter/GCS_Mavlink.cpp index 468d81ea37..3a65ce40e6 100644 --- a/ArduCopter/GCS_Mavlink.cpp +++ b/ArduCopter/GCS_Mavlink.cpp @@ -1080,6 +1080,23 @@ void GCS_MAVLINK_Copter::handleMessage(mavlink_message_t* msg) break; #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); + result = MAV_RESULT_ACCEPTED; + break; + default: + copter.landinggear.set_position(AP_LandingGear::LandingGear_Deploy); + result = MAV_RESULT_ACCEPTED; + break; + } + break; + } + /* Solo user presses Fly button */ case MAV_CMD_SOLO_BTN_FLY_CLICK: { result = MAV_RESULT_ACCEPTED;