Plane: Qautotune: use new disarmed call and add new aux function

This commit is contained in:
Iampete1 2024-08-05 11:54:15 +01:00 committed by Randy Mackay
parent f6da3ce764
commit 698f8fb40e
2 changed files with 11 additions and 6 deletions

View File

@ -370,12 +370,8 @@ bool AP_Arming_Plane::disarm(const AP_Arming::Method method, bool do_disarm_chec
change_arm_state();
#if QAUTOTUNE_ENABLED
//save qautotune gains if enabled and success
if (plane.control_mode == &plane.mode_qautotune) {
plane.quadplane.qautotune.save_tuning_gains();
} else {
plane.quadplane.qautotune.reset();
}
// Possibly save auto tuned parameters
plane.quadplane.qautotune.disarmed(plane.control_mode == &plane.mode_qautotune);
#endif
// re-initialize speed variable used in AUTO and GUIDED for

View File

@ -169,6 +169,9 @@ void RC_Channel_Plane::init_aux_function(const RC_Channel::AUX_FUNC ch_option,
case AUX_FUNC::FW_AUTOTUNE:
case AUX_FUNC::VFWD_THR_OVERRIDE:
case AUX_FUNC::PRECISION_LOITER:
#if QAUTOTUNE_ENABLED
case AUX_FUNC::AUTOTUNE_TEST_GAINS:
#endif
break;
case AUX_FUNC::SOARING:
@ -441,6 +444,12 @@ bool RC_Channel_Plane::do_aux_function(const AUX_FUNC ch_option, const AuxSwitch
// handled by lua scripting, just ignore here
break;
#if QAUTOTUNE_ENABLED
case AUX_FUNC::AUTOTUNE_TEST_GAINS:
plane.quadplane.qautotune.do_aux_function(ch_flag);
break;
#endif
default:
return RC_Channel::do_aux_function(ch_option, ch_flag);
}