diff --git a/ArduPlane/Attitude.pde b/ArduPlane/Attitude.pde index 2ee2f98c92..7118c434cf 100644 --- a/ArduPlane/Attitude.pde +++ b/ArduPlane/Attitude.pde @@ -843,6 +843,25 @@ static void set_servos(void) } else { auto_flap_percent = g.flap_1_percent; } + + /* + special flap levels for takeoff and landing. This works + better than speed based flaps as it leads to less + possibility of oscillation + */ + if (control_mode == AUTO) { + switch (flight_stage) { + case AP_SpdHgtControl::FLIGHT_TAKEOFF: + auto_flap_percent = g.takeoff_flap_percent; + break; + case AP_SpdHgtControl::FLIGHT_LAND_APPROACH: + case AP_SpdHgtControl::FLIGHT_LAND_FINAL: + auto_flap_percent = g.land_flap_percent; + break; + default: + break; + } + } } // manual flap input overrides auto flap input diff --git a/ArduPlane/Parameters.h b/ArduPlane/Parameters.h index a451b61c4a..fc58e25a4d 100644 --- a/ArduPlane/Parameters.h +++ b/ArduPlane/Parameters.h @@ -124,6 +124,8 @@ public: k_param_terrain_lookahead, k_param_fbwa_tdrag_chan, k_param_rangefinder_landing, + k_param_land_flap_percent, + k_param_takeoff_flap_percent, // 100: Arming parameters k_param_arming = 100, @@ -438,6 +440,8 @@ public: AP_Int8 flap_1_speed; AP_Int8 flap_2_percent; AP_Int8 flap_2_speed; + AP_Int8 land_flap_percent; + AP_Int8 takeoff_flap_percent; AP_Int8 rssi_pin; AP_Float rssi_range; // allows to set max voltage for rssi pin such as 5.0, 3.3 etc. AP_Int8 inverted_flight_ch; // 0=disabled, 1-8 is channel for inverted flight trigger diff --git a/ArduPlane/Parameters.pde b/ArduPlane/Parameters.pde index 3889d3cee5..199a508212 100644 --- a/ArduPlane/Parameters.pde +++ b/ArduPlane/Parameters.pde @@ -206,6 +206,14 @@ const AP_Param::Info var_info[] PROGMEM = { // @User: User GSCALAR(takeoff_throttle_slewrate, "TKOFF_THR_SLEW", 0), + // @Param: TKOFF_FLAP_PCNT + // @DisplayName: Takeoff flap percentage + // @Description: The amount of flaps (as a percentage) to apply in automatic takeoff + // @Range: 0 100 + // @Units: Percent + // @User: Advanced + GSCALAR(takeoff_flap_percent, "TKOFF_FLAP_PCNT", 0), + // @Param: FBWA_TDRAG_CHAN // @DisplayName: FBWA taildragger channel // @Description: This is a RC input channel which when it goes above 1700 enables FBWA taildragger takeoff mode. It should be assigned to a momentary switch. Once this feature is enabled it will stay enabled until the aircraft goes above TKOFF_TDRAG_SPD1 airspeed, changes mode, or the pitch goes above the initial pitch when this is engaged or goes below 0 pitch. When enabled the elevator will be forced to TKOFF_TDRAG_ELEV. This option allows for easier takeoffs on taildraggers in FBWA mode, and also makes it easier to test auto-takeoff steering handling in FBWA. Setting it to 0 disables this option. @@ -849,6 +857,14 @@ const AP_Param::Info var_info[] PROGMEM = { // @User: Advanced GSCALAR(flap_2_speed, "FLAP_2_SPEED", FLAP_2_SPEED), + // @Param: LAND_FLAP_PERCNT + // @DisplayName: Landing flap percentage + // @Description: The amount of flaps (as a percentage) to apply in the landing approach and flare of an automatic landing + // @Range: 0 100 + // @Units: Percent + // @User: Advanced + GSCALAR(land_flap_percent, "LAND_FLAP_PERCNT", 0), + // @Param: RSSI_PIN // @DisplayName: Receiver RSSI sensing pin // @Description: This selects an analog pin for the receiver RSSI voltage. It assumes the voltage is 5V for max rssi, 0V for minimum