From 7fad72dacf6a097822dc67afd019dc8fdbfa3457 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 9 Nov 2018 11:02:54 +1100 Subject: [PATCH] RC_Channel: moved LANDING_GEAR to common library --- libraries/RC_Channel/RC_Channel.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/libraries/RC_Channel/RC_Channel.cpp b/libraries/RC_Channel/RC_Channel.cpp index 092f359a68..cac99d1fcd 100644 --- a/libraries/RC_Channel/RC_Channel.cpp +++ b/libraries/RC_Channel/RC_Channel.cpp @@ -32,6 +32,7 @@ extern const AP_HAL::HAL& hal; #include #include #include +#include const AP_Param::GroupInfo RC_Channel::var_info[] = { // @Param: MIN @@ -438,6 +439,7 @@ void RC_Channel::init_aux_function(const aux_func_t ch_option, const aux_switch_ case DO_NOTHING: case CLEAR_WP: case COMPASS_LEARN: + case LANDING_GEAR: break; case GRIPPER: case SPRAYER: @@ -650,6 +652,25 @@ void RC_Channel::do_aux_function(const aux_func_t ch_option, const aux_switch_po } break; + case LANDING_GEAR: { + AP_LandingGear *lg = AP_LandingGear::instance(); + if (lg == nullptr) { + break; + } + switch (ch_flag) { + case LOW: + lg->set_position(AP_LandingGear::LandingGear_Deploy); + break; + case MIDDLE: + // nothing + break; + case HIGH: + lg->set_position(AP_LandingGear::LandingGear_Retract); + break; + } + break; + } + default: gcs().send_text(MAV_SEVERITY_INFO, "Invalid channel option (%u)", ch_option); break;