Plane: Soaring: Use circling time as timeout if less than 20s.

This commit is contained in:
Samuel Tabor 2020-07-13 14:10:05 +01:00 committed by Tom Pittenger
parent 6de4967a3d
commit e0f524d425
2 changed files with 4 additions and 1 deletions

View File

@ -111,8 +111,9 @@ void Plane::update_soaring() {
// Some other loiter status, we need to think about exiting loiter.
const uint32_t time_in_loiter_ms = AP_HAL::millis() - plane.soaring_mode_timer_ms;
const uint32_t timeout = MIN(1000*g2.soaring_controller.get_circling_time(), 20000);
if (!soaring_exit_heading_aligned() && loiterStatus!=SoaringController::LoiterStatus::ALT_TOO_LOW && time_in_loiter_ms < 20000) {
if (!soaring_exit_heading_aligned() && loiterStatus != SoaringController::LoiterStatus::ALT_TOO_LOW && time_in_loiter_ms < timeout) {
// Heading not lined up, and not timed out or in a condition requiring immediate exit.
break;
}

View File

@ -127,6 +127,8 @@ public:
float get_alt_cutoff() const {return alt_cutoff;}
float get_circling_time() const {return _vario.tau;}
private:
// slow down messages if they are the same. During loiter we could smap the same message. Only show new messages during loiters
LoiterStatus _cruise_criteria_msg_last;