AP_Soaring: Ensure minimum cruise times are respected when RC switch position is changed.

This commit is contained in:
Samuel Tabor 2021-03-21 09:46:11 +00:00 committed by Peter Barker
parent 9a7f80789f
commit e78d6fee0a
1 changed files with 9 additions and 10 deletions

View File

@ -405,21 +405,20 @@ void SoaringController::update_active_state()
case ActiveStatus::MANUAL_MODE_CHANGE:
// It's enabled, but wasn't on the last loop.
gcs().send_text(MAV_SEVERITY_INFO, "Soaring: Enabled, manual mode changes.");
set_throttle_suppressed(true);
// We changed mode - if we're in LOITER this means we should exit gracefully.
// This has no effect if we're cruising as it is reset on thermal entry.
_exit_commanded = true;
break;
case ActiveStatus::AUTO_MODE_CHANGE:
gcs().send_text(MAV_SEVERITY_INFO, "Soaring: Enabled, automatic mode changes.");
set_throttle_suppressed(true);
// We changed mode - if we're in LOITER this means we should exit gracefully.
// This has no effect if we're cruising as it is reset on thermal entry.
_exit_commanded = true;
break;
}
if (_last_update_status == ActiveStatus::SOARING_DISABLED) {
// We have switched from disabled into an active mode, start cruising.
init_cruising();
} else if (status != ActiveStatus::SOARING_DISABLED) {
// We switched between active modes. If we're in THERMAL this means we should exit gracefully.
// This has no effect if we're cruising as it is reset on thermal entry.
_exit_commanded = true;
}
}
_last_update_status = status;