From ea27d1604a2107db4877d9bddb05221498f010f1 Mon Sep 17 00:00:00 2001 From: Amilcar Lucas Date: Sun, 9 Oct 2011 15:33:10 +0200 Subject: [PATCH] More optimizations I forgot these ones. --- ArduPlane/Attitude.pde | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ArduPlane/Attitude.pde b/ArduPlane/Attitude.pde index e6f8a1bfaa..8564690453 100644 --- a/ArduPlane/Attitude.pde +++ b/ArduPlane/Attitude.pde @@ -287,15 +287,19 @@ static void set_servos(void) g.channel_rudder.radio_out = g.channel_rudder.radio_in; // FIXME To me it does not make sense to control the aileron using radio_in in manual mode // Doug could you please take a look at this ? - if (g_rc_function[RC_Channel_aux::k_aileron] != rc_array[g.flight_mode_channel-1]) { - G_RC_AUX(k_aileron)->radio_out = g_rc_function[RC_Channel_aux::k_aileron]->radio_in; - } + if (g_rc_function[RC_Channel_aux::k_aileron]) { + if (g_rc_function[RC_Channel_aux::k_aileron] != rc_array[g.flight_mode_channel-1]) { + g_rc_function[RC_Channel_aux::k_aileron]->radio_out = g_rc_function[RC_Channel_aux::k_aileron]->radio_in; + } + } // only use radio_in if the channel is not used as flight_mode_channel - if (g_rc_function[RC_Channel_aux::k_flap_auto] != rc_array[g.flight_mode_channel-1]) { - G_RC_AUX(k_flap_auto)->radio_out = g_rc_function[RC_Channel_aux::k_flap_auto]->radio_in; - } else { - G_RC_AUX(k_flap_auto)->radio_out = g_rc_function[RC_Channel_aux::k_flap_auto]->radio_trim; - } + if (g_rc_function[RC_Channel_aux::k_flap_auto]) { + if (g_rc_function[RC_Channel_aux::k_flap_auto] != rc_array[g.flight_mode_channel-1]) { + g_rc_function[RC_Channel_aux::k_flap_auto]->radio_out = g_rc_function[RC_Channel_aux::k_flap_auto]->radio_in; + } else { + g_rc_function[RC_Channel_aux::k_flap_auto]->radio_out = g_rc_function[RC_Channel_aux::k_flap_auto]->radio_trim; + } + } } else { if (g.mix_mode == 0) { g.channel_roll.calc_pwm();