Plane: Don't check FS_SHORT_TIMEOUT if it's disabled

Also renames the check_minimum_altitude() to reflect that it's only used
for FBWB.
This commit is contained in:
Michael du Breuil 2017-11-22 21:56:08 -07:00 committed by Tom Pittenger
parent 5ee9361941
commit 1a3ca43e86
5 changed files with 5 additions and 6 deletions

View File

@ -35,7 +35,7 @@ bool AP_Arming_Plane::pre_arm_checks(bool report)
// Check airspeed sensor
ret &= AP_Arming::airspeed_checks(report);
if (plane.g.long_fs_timeout < plane.g.short_fs_timeout) {
if (plane.g.long_fs_timeout < plane.g.short_fs_timeout && plane.g.short_fs_action != SHORT_FS_ACTION_DISABLED) {
if (report) {
gcs().send_text(MAV_SEVERITY_CRITICAL, "PreArm: FS_LONG_TIMEOUT < FS_SHORT_TIMEOUT");
}

View File

@ -501,7 +501,7 @@ const AP_Param::Info Plane::var_info[] = {
// @Param: FS_SHORT_ACTN
// @DisplayName: Short failsafe action
// @Description: The action to take on a short (FS_SHORT_TIMEOUT) failsafe event. A short failsafe even can be triggered either by loss of RC control (see THR_FS_VALUE) or by loss of GCS control (see FS_GCS_ENABL). If in CIRCLE or RTL mode this parameter is ignored. A short failsafe event in stabilization and manual modes will cause an change to CIRCLE mode if FS_SHORT_ACTN is 0 or 1, and a change to FBWA mode if FS_SHORT_ACTN is 2. In all other modes (AUTO, GUIDED and LOITER) a short failsafe event will cause no mode change is FS_SHORT_ACTN is set to 0, will cause a change to CIRCLE mode if set to 1 and will change to FBWA mode if set to 2. Please see the documentation for FS_LONG_ACTN for the behaviour after FS_LONG_TIMEOUT seconds of failsafe.
// @Values: 0:CIRCLE/no change(if already in AUTO|GUIDED|LOITER),1:CIRCLE,2:FBWA
// @Values: 0:CIRCLE/no change(if already in AUTO|GUIDED|LOITER),1:CIRCLE,2:FBWA,3:Disable
// @User: Standard
GSCALAR(short_fs_action, "FS_SHORT_ACTN", 0),

View File

@ -857,7 +857,7 @@ private:
void set_target_altitude_proportion(const Location &loc, float proportion);
void constrain_target_altitude_location(const Location &loc1, const Location &loc2);
int32_t calc_altitude_error_cm(void);
void check_minimum_altitude(void);
void check_fbwb_minimum_altitude(void);
void reset_offset_altitude(void);
void set_offset_altitude_location(const Location &loc);
bool above_location_current(const Location &loc);

View File

@ -312,7 +312,7 @@ int32_t Plane::calc_altitude_error_cm(void)
/*
check for FBWB_min_altitude_cm violation
*/
void Plane::check_minimum_altitude(void)
void Plane::check_fbwb_minimum_altitude(void)
{
if (g.FBWB_min_altitude_cm == 0) {
return;

View File

@ -288,8 +288,7 @@ void Plane::update_fbwb_speed_height(void)
target_altitude.last_elevator_input = elevator_input;
}
// check for FBWB altitude limit
check_minimum_altitude();
check_fbwb_minimum_altitude();
altitude_error_cm = calc_altitude_error_cm();