From d96e85b2034b05caa9b2cace4eb4ff93a4b92a4c Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Sat, 8 Sep 2018 12:35:18 +0900 Subject: [PATCH] Plane: use parent AP_Arming rudder value --- ArduPlane/AP_Arming.cpp | 7 +------ ArduPlane/AP_Arming.h | 10 ---------- ArduPlane/Parameters.cpp | 1 + ArduPlane/radio.cpp | 6 +++--- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/ArduPlane/AP_Arming.cpp b/ArduPlane/AP_Arming.cpp index 0bae9256eb..ebc9f5756f 100644 --- a/ArduPlane/AP_Arming.cpp +++ b/ArduPlane/AP_Arming.cpp @@ -8,12 +8,7 @@ const AP_Param::GroupInfo AP_Arming_Plane::var_info[] = { // variables from parent vehicle AP_NESTEDGROUPINFO(AP_Arming, 0), - // @Param: RUDDER - // @DisplayName: Rudder Arming - // @Description: Control arm/disarm by rudder input. When enabled arming is done with right rudder, disarming with left rudder. Rudder arming only works in manual throttle modes with throttle at zero +- deadzone (RCx_DZ) - // @Values: 0:Disabled,1:ArmingOnly,2:ArmOrDisarm - // @User: Advanced - AP_GROUPINFO("RUDDER", 3, AP_Arming_Plane, rudder_arming_value, ARMING_RUDDER_ARMONLY), + // index 3 was RUDDER and should not be used AP_GROUPEND }; diff --git a/ArduPlane/AP_Arming.h b/ArduPlane/AP_Arming.h index 172354286d..c47c7c4cb7 100644 --- a/ArduPlane/AP_Arming.h +++ b/ArduPlane/AP_Arming.h @@ -15,26 +15,16 @@ public: AP_Param::setup_object_defaults(this, var_info); } - enum ArmingRudder { - ARMING_RUDDER_DISABLED = 0, - ARMING_RUDDER_ARMONLY = 1, - ARMING_RUDDER_ARMDISARM = 2 - }; - /* Do not allow copies */ AP_Arming_Plane(const AP_Arming_Plane &other) = delete; AP_Arming_Plane &operator=(const AP_Arming_Plane&) = delete; bool pre_arm_checks(bool report); - ArmingRudder rudder_arming() const { return (ArmingRudder)rudder_arming_value.get(); } - // var_info for holding Parameter information static const struct AP_Param::GroupInfo var_info[]; protected: bool ins_checks(bool report); - // parameters - AP_Int8 rudder_arming_value; }; diff --git a/ArduPlane/Parameters.cpp b/ArduPlane/Parameters.cpp index 3a1346cf79..33fa94e5a6 100644 --- a/ArduPlane/Parameters.cpp +++ b/ArduPlane/Parameters.cpp @@ -1256,6 +1256,7 @@ const AP_Param::ConversionInfo conversion_table[] = { { Parameters::k_param_fs_batt_voltage, 0, AP_PARAM_FLOAT, "BATT_FS_LOW_VOLT" }, { Parameters::k_param_fs_batt_mah, 0, AP_PARAM_FLOAT, "BATT_FS_LOW_MAH" }, + { Parameters::k_param_arming, 3, AP_PARAM_INT8, "ARMING_RUDDER" }, }; void Plane::load_parameters(void) diff --git a/ArduPlane/radio.cpp b/ArduPlane/radio.cpp index 7eb977cd03..af96927398 100644 --- a/ArduPlane/radio.cpp +++ b/ArduPlane/radio.cpp @@ -109,9 +109,9 @@ void Plane::init_rc_out_aux() */ void Plane::rudder_arm_disarm_check() { - AP_Arming_Plane::ArmingRudder arming_rudder = arming.rudder_arming(); + AP_Arming::ArmingRudder arming_rudder = arming.rudder_arming(); - if (arming_rudder == AP_Arming_Plane::ARMING_RUDDER_DISABLED) { + if (arming_rudder == AP_Arming::ARMING_RUDDER_DISABLED) { //parameter disallows rudder arming/disabling return; } @@ -150,7 +150,7 @@ void Plane::rudder_arm_disarm_check() // not at full right rudder rudder_arm_timer = 0; } - } else if (arming_rudder == AP_Arming_Plane::ARMING_RUDDER_ARMDISARM && !is_flying()) { + } else if ((arming_rudder == AP_Arming::ARMING_RUDDER_ARMDISARM) && !is_flying()) { // when armed and not flying, full left rudder starts disarming counter if (channel_rudder->get_control_in() < -4000) { uint32_t now = millis();