From ac920633af4bfb32a0e126fe383679e1b4f0ca00 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 9 Nov 2018 17:36:12 +1100 Subject: [PATCH] AP_LandingGear: use SERVO_MIN/MAX/REVERSED for landing gear --- libraries/AP_LandingGear/AP_LandingGear.cpp | 22 +++------------------ libraries/AP_LandingGear/AP_LandingGear.h | 5 ----- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/libraries/AP_LandingGear/AP_LandingGear.cpp b/libraries/AP_LandingGear/AP_LandingGear.cpp index d2e9ad14c1..a283be0a34 100644 --- a/libraries/AP_LandingGear/AP_LandingGear.cpp +++ b/libraries/AP_LandingGear/AP_LandingGear.cpp @@ -10,23 +10,7 @@ extern const AP_HAL::HAL& hal; const AP_Param::GroupInfo AP_LandingGear::var_info[] = { - // @Param: SERVO_RTRACT - // @DisplayName: Landing Gear Servo Retracted PWM Value - // @Description: Servo PWM value in microseconds when landing gear is retracted - // @Range: 1000 2000 - // @Units: PWM - // @Increment: 1 - // @User: Standard - AP_GROUPINFO("SERVO_RTRACT", 0, AP_LandingGear, _servo_retract_pwm, AP_LANDINGGEAR_SERVO_RETRACT_PWM_DEFAULT), - - // @Param: SERVO_DEPLOY - // @DisplayName: Landing Gear Servo Deployed PWM Value - // @Description: Servo PWM value in microseconds when landing gear is deployed - // @Range: 1000 2000 - // @Units: PWM - // @Increment: 1 - // @User: Standard - AP_GROUPINFO("SERVO_DEPLOY", 1, AP_LandingGear, _servo_deploy_pwm, AP_LANDINGGEAR_SERVO_DEPLOY_PWM_DEFAULT), + // 0 and 1 used by previous retract and deploy pwm, now replaced with SERVOn_MIN/MAX/REVERSED // @Param: STARTUP // @DisplayName: Landing Gear Startup position @@ -136,7 +120,7 @@ void AP_LandingGear::set_position(LandingGearCommand cmd) void AP_LandingGear::deploy() { // set servo PWM to deployed position - SRV_Channels::set_output_pwm(SRV_Channel::k_landing_gear_control, _servo_deploy_pwm); + SRV_Channels::set_output_limit(SRV_Channel::k_landing_gear_control, SRV_Channel::SRV_CHANNEL_LIMIT_MAX); // set deployed flag _deployed = true; @@ -149,7 +133,7 @@ void AP_LandingGear::deploy() void AP_LandingGear::retract() { // set servo PWM to retracted position - SRV_Channels::set_output_pwm(SRV_Channel::k_landing_gear_control, _servo_retract_pwm); + SRV_Channels::set_output_limit(SRV_Channel::k_landing_gear_control, SRV_Channel::SRV_CHANNEL_LIMIT_MIN); // reset deployed flag _deployed = false; diff --git a/libraries/AP_LandingGear/AP_LandingGear.h b/libraries/AP_LandingGear/AP_LandingGear.h index 493433e587..1e2781fcf3 100644 --- a/libraries/AP_LandingGear/AP_LandingGear.h +++ b/libraries/AP_LandingGear/AP_LandingGear.h @@ -5,9 +5,6 @@ #include #include -#define AP_LANDINGGEAR_SERVO_RETRACT_PWM_DEFAULT 1250 // default PWM value to move servo to when landing gear is up -#define AP_LANDINGGEAR_SERVO_DEPLOY_PWM_DEFAULT 1750 // default PWM value to move servo to when landing gear is down - #if CONFIG_HAL_BOARD == HAL_BOARD_SITL #define DEFAULT_PIN_WOW 8 #define DEFAULT_PIN_WOW_POL 1 @@ -88,8 +85,6 @@ public: private: // Parameters - AP_Int16 _servo_retract_pwm; // PWM value to move servo to when gear is retracted - AP_Int16 _servo_deploy_pwm; // PWM value to move servo to when gear is deployed AP_Int8 _startup_behaviour; // start-up behaviour (see LandingGearStartupBehaviour) AP_Int8 _pin_deployed;