Plane: Make LAND_FLARE_SEC optional.

This commit is contained in:
Michael Day 2015-04-06 09:56:29 -06:00 committed by Andrew Tridgell
parent a262f9d31b
commit 05d065b471
2 changed files with 6 additions and 5 deletions

View File

@ -235,7 +235,7 @@ const AP_Param::Info var_info[] PROGMEM = {
// @Param: LAND_FLARE_SEC
// @DisplayName: Landing flare time
// @Description: Vertical time before landing point at which to lock heading and flare with the motor stopped. This is vertical time, and is calculated based solely on the current height above the ground and the current descent rate.
// @Description: Vertical time before landing point at which to lock heading and flare with the motor stopped. This is vertical time, and is calculated based solely on the current height above the ground and the current descent rate. Set to 0 if you only wish to flare based on altitude (see LAND_FLARE_ALT).
// @Units: seconds
// @Increment: 0.1
// @User: Advanced

View File

@ -45,15 +45,16 @@ static bool verify_land()
/* Set land_complete (which starts the flare) under 3 conditions:
1) we are within LAND_FLARE_ALT meters of the landing altitude
2) we are within LAND_FLARE_SEC of the landing point vertically
by the calculated sink rate
by the calculated sink rate (if LAND_FLARE_SEC != 0)
3) we have gone past the landing point and don't have
rangefinder data (to prevent us keeping throttle on
after landing if we've had positive baro drift)
*/
if (height <= g.land_flare_alt ||
height <= auto_state.land_sink_rate * aparm.land_flare_sec ||
(!rangefinder_state.in_range && location_passed_point(current_loc, prev_WP_loc, next_WP_loc)) ||
(fabsf(auto_state.land_sink_rate) < 0.2f && !is_flying())) {
(aparm.land_flare_sec != 0 &&
(height <= auto_state.land_sink_rate * aparm.land_flare_sec ||
(!rangefinder_state.in_range && location_passed_point(current_loc, prev_WP_loc, next_WP_loc)))) ||
(fabsf(auto_state.land_sink_rate) < 0.2f && !is_flying()) ) {
if (!auto_state.land_complete) {
if (!is_flying() && (hal.scheduler->millis()-auto_state.last_flying_ms) > 3000) {