From c297aaeeabe6c9684c0a3f3494fa42cad776147a Mon Sep 17 00:00:00 2001 From: Robert Lefebvre Date: Tue, 6 Jan 2015 14:52:16 -0500 Subject: [PATCH] AP_LandingGear: Add force_deploy method. --- libraries/AP_LandingGear/AP_LandingGear.cpp | 12 ++++++++++-- libraries/AP_LandingGear/AP_LandingGear.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libraries/AP_LandingGear/AP_LandingGear.cpp b/libraries/AP_LandingGear/AP_LandingGear.cpp index 0f536ecf68..1c96fcd5dc 100644 --- a/libraries/AP_LandingGear/AP_LandingGear.cpp +++ b/libraries/AP_LandingGear/AP_LandingGear.cpp @@ -59,7 +59,15 @@ void AP_LandingGear::retract() /// update - should be called at 10hz void AP_LandingGear::update() -{ +{ + // if there is a force deploy active, disable retraction, then reset force deploy to consume it + // gear will be deployed automatically because _retract_enabled is false. + // this will disable retract switch until it is cycled through deploy position + if ( _force_deploy){ + enable(false); + force_deploy(false); + } + if (!_retract_enabled) { // force deployment if retract is not enabled deploy(); @@ -68,7 +76,7 @@ void AP_LandingGear::update() return; } - if (_command_mode == COMMAND_MODE_DEPLOY){ + if (_command_mode == COMMAND_MODE_DEPLOY){ deploy(); } diff --git a/libraries/AP_LandingGear/AP_LandingGear.h b/libraries/AP_LandingGear/AP_LandingGear.h index 51167ca02d..13cc38019e 100644 --- a/libraries/AP_LandingGear/AP_LandingGear.h +++ b/libraries/AP_LandingGear/AP_LandingGear.h @@ -41,6 +41,8 @@ public: void update(); void set_cmd_mode(int8_t cmd) { _command_mode = cmd; } + + void force_deploy(bool force) { _force_deploy = force;} static const struct AP_Param::GroupInfo var_info[]; @@ -54,6 +56,7 @@ private: // internal variables bool _deployed; // true if the landing gear has been deployed, initialized false + bool _force_deploy; // used by main code to force landing gear to deploy, such as in Land mode int8_t _command_mode; // pilots commanded control mode: Manual Deploy, Auto, or Manual Retract /// enable - enable landing gear retraction