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
1 changed files with 10 additions and 8 deletions

View File

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