Plane: Address Randy review comments

This commit is contained in:
Dr.-Ing. Amilcar do Carmo Lucas 2020-12-14 13:47:05 +01:00 committed by Peter Barker
parent aae092b88f
commit fef8b37b11
2 changed files with 14 additions and 8 deletions

View File

@ -54,13 +54,16 @@ float Plane::get_speed_scaler(void)
*/ */
bool Plane::stick_mixing_enabled(void) bool Plane::stick_mixing_enabled(void)
{ {
#if AC_FENCE == ENABLED
const bool stickmixing = fence_stickmixing();
#else
const bool stickmixing = true;
#endif
if (control_mode->does_auto_throttle() && plane.control_mode->does_auto_navigation()) { if (control_mode->does_auto_throttle() && plane.control_mode->does_auto_navigation()) {
// we're in an auto mode. Check the stick mixing flag // we're in an auto mode. Check the stick mixing flag
if (g.stick_mixing != STICK_MIXING_DISABLED && if (g.stick_mixing != STICK_MIXING_DISABLED &&
g.stick_mixing != STICK_MIXING_VTOL_YAW && g.stick_mixing != STICK_MIXING_VTOL_YAW &&
#if AC_FENCE == ENABLED stickmixing &&
fence_stickmixing() &&
#endif
failsafe.state == FAILSAFE_NONE && failsafe.state == FAILSAFE_NONE &&
!rc_failsafe_active()) { !rc_failsafe_active()) {
// we're in an auto mode, and haven't triggered failsafe // we're in an auto mode, and haven't triggered failsafe

View File

@ -186,13 +186,16 @@ void Plane::read_radio()
control_failsafe(); control_failsafe();
#if AC_FENCE == ENABLED
const bool stickmixing = fence_stickmixing();
#else
const bool stickmixing = true;
#endif
airspeed_nudge_cm = 0; airspeed_nudge_cm = 0;
throttle_nudge = 0; throttle_nudge = 0;
if (g.throttle_nudge && channel_throttle->get_control_in() > 50 if (g.throttle_nudge
#if AC_FENCE == ENABLED && channel_throttle->get_control_in() > 50
&& fence_stickmixing() && stickmixing) {
#endif
) {
float nudge = (channel_throttle->get_control_in() - 50) * 0.02f; float nudge = (channel_throttle->get_control_in() - 50) * 0.02f;
if (ahrs.airspeed_sensor_enabled()) { if (ahrs.airspeed_sensor_enabled()) {
airspeed_nudge_cm = (aparm.airspeed_max * 100 - aparm.airspeed_cruise_cm) * nudge; airspeed_nudge_cm = (aparm.airspeed_max * 100 - aparm.airspeed_cruise_cm) * nudge;