Plane: system: don't try and switch to VTOL modes if quadplane is not enabled

This commit is contained in:
Iampete1 2021-09-04 20:24:10 +01:00 committed by Andrew Tridgell
parent e4feea9457
commit a985e47d45

View File

@ -215,6 +215,16 @@ bool Plane::set_mode(Mode &new_mode, const ModeReason reason)
return true;
}
if (new_mode.is_vtol_mode() && !plane.quadplane.available()) {
// dont try and switch to a Q mode if quadplane is not enabled and initalized
gcs().send_text(MAV_SEVERITY_INFO,"Q_ENABLE 0");
// make sad noise
if (reason != ModeReason::INITIALISED) {
AP_Notify::events.user_mode_change_failed = 1;
}
return false;
}
#if !QAUTOTUNE_ENABLED
if (&new_mode == &plane.mode_qautotune) {
gcs().send_text(MAV_SEVERITY_INFO,"QAUTOTUNE disabled");