Skip to content

Commit

Permalink
Plane: Qautotune: use new disrmed call and add new aux function
Browse files Browse the repository at this point in the history
  • Loading branch information
IamPete1 committed Aug 5, 2024
1 parent 8a4f16e commit 92b8ed3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ArduPlane/AP_Arming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions ArduPlane/RC_Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_SWITCH:
#endif
break;

case AUX_FUNC::SOARING:
Expand Down Expand Up @@ -439,6 +442,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_SWITCH:
plane.quadplane.qautotune.do_aux_function(ch_flag);
break;
#endif

default:
return RC_Channel::do_aux_function(ch_option, ch_flag);
}
Expand Down

0 comments on commit 92b8ed3

Please sign in to comment.