Use a single if instead of four

This commit is contained in:
Amilcar Lucas 2011-10-09 14:31:08 +02:00
parent 758ae5a78e
commit 02f023a9ec

View File

@ -370,14 +370,16 @@ static void set_servos(void)
} else { } else {
flapSpeedSource = g.throttle_cruise; flapSpeedSource = g.throttle_cruise;
} }
if (g_rc_function[RC_Channel_aux::k_flap_auto] != NULL) {
if ( flapSpeedSource > g.flap_1_speed) { if ( flapSpeedSource > g.flap_1_speed) {
G_RC_AUX(k_flap_auto)->servo_out = 0; g_rc_function[RC_Channel_aux::k_flap_auto]->servo_out = 0;
} else if (flapSpeedSource > g.flap_2_speed) { } else if (flapSpeedSource > g.flap_2_speed) {
G_RC_AUX(k_flap_auto)->servo_out = g.flap_1_percent; g_rc_function[RC_Channel_aux::k_flap_auto]->servo_out = g.flap_1_percent;
} else { } else {
G_RC_AUX(k_flap_auto)->servo_out = g.flap_2_percent; g_rc_function[RC_Channel_aux::k_flap_auto]->servo_out = g.flap_2_percent;
}
g_rc_function[RC_Channel_aux::k_flap_auto]->calc_pwm();
} }
G_RC_AUX(k_flap_auto)->calc_pwm();
} }
#if HIL_MODE == HIL_MODE_DISABLED || HIL_SERVOS #if HIL_MODE == HIL_MODE_DISABLED || HIL_SERVOS