Copter: Allow manual autorotations without enabling arot flight mode

This commit is contained in:
Gone4Dirt 2020-04-01 15:42:39 +01:00 committed by Bill Geyer
parent b2d2bf61da
commit 9269ee50ed

View File

@ -193,17 +193,21 @@ void Copter::heli_update_rotor_speed_targets()
void Copter::heli_update_autorotation()
{
#if MODE_AUTOROTATE_ENABLED == ENABLED
// check if flying and interlock disengaged
if (!ap.land_complete && !motors->get_interlock()) {
if (!flightmode->has_manual_throttle() && g2.arot.is_enable()) {
// set autonomous autorotation flight mode
if (!ap.land_complete && !motors->get_interlock() && !flightmode->has_manual_throttle() && g2.arot.is_enable()) {
heli_flags.in_autorotation = true;
set_mode(Mode::Number::AUTOROTATE, ModeReason::AUTOROTATION_START);
}
// set flag to facilitate both auto and manual autorotations
heli_flags.in_autorotation = true;
} else {
heli_flags.in_autorotation = false;
}
// sets autorotation flags through out libraries
heli_set_autorotation(heli_flags.in_autorotation);
if (!ap.land_complete && g2.arot.is_enable()) {
if (!ap.land_complete) {
motors->set_enable_bailout(true);
} else {
motors->set_enable_bailout(false);
@ -215,7 +219,7 @@ void Copter::heli_update_autorotation()
}
#if MODE_AUTOROTATE_ENABLED == ENABLED
// heli_set_autorotation - set the autorotation f`lag throughout libraries
// heli_set_autorotation - set the autorotation flag throughout libraries
void Copter::heli_set_autorotation(bool autorotation)
{
motors->set_in_autorotation(autorotation);