Plane: fixed is_flying() for VTOL flight

otherwise we may disarm mid-flight!
This commit is contained in:
Andrew Tridgell 2016-04-22 20:20:06 +10:00
parent 76400a9959
commit 0aa1ae048d
3 changed files with 15 additions and 0 deletions

View File

@ -170,6 +170,9 @@ void Plane::update_is_flying_5Hz(void)
bool Plane::is_flying(void)
{
if (hal.util->get_soft_armed()) {
if (quadplane.is_flying_vtol()) {
return true;
}
// when armed, assume we're flying unless we probably aren't
return (isFlyingProbability >= 0.1f);
}

View File

@ -553,6 +553,15 @@ bool QuadPlane::should_relax(void)
return relax_loiter;
}
// see if we are flying in vtol
bool QuadPlane::is_flying_vtol(void)
{
if (in_vtol_mode() && millis() - motors_lower_limit_start_ms > 5000) {
return true;
}
return false;
}
/*
smooth out descent rate for landing to prevent a jerk as we get to
land_final_alt.

View File

@ -63,6 +63,9 @@ public:
int8_t forward_throttle_pct(void);
float get_weathervane_yaw_rate_cds(void);
// see if we are flying from vtol point of view
bool is_flying_vtol(void);
struct PACKED log_QControl_Tuning {
LOG_PACKET_HEADER;
uint64_t time_us;