From 1c00d1ffe3854bfac8e871c9b93d61309789f976 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Sun, 27 May 2012 22:15:08 -0700 Subject: [PATCH] ArduPlane: Fix effect of ELEVON_REVERSE * Previously, the ELEVON_REVERSE parameter was equivelant in function to the ELEVON_CH1_REVERSE parameter. These parameter values are found in g.reverse_elevons and g.reverse_ch1_elevon, and used to map to the radio_out channels in ArduPlane/Attitude.pde * It seems the author's intent was for ELEVON_REVERSE to change the sign for the combination of pitch & roll into ch1 & ch2, as there are already parameters which change just the sign of ch1 and just the sign of ch2. * Discovered this bug because I happened to build an elevon airframe which was not possible to setup with the existing ELEVON_ and RCn_REV parameters. * This will break existing elevon setups if the user used ELEVON_REVERSE instead of ELEVON_CH1_REVERSE, since they were previously interchangable. --- ArduPlane/Attitude.pde | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArduPlane/Attitude.pde b/ArduPlane/Attitude.pde index c7104896fd..a1b598dd24 100644 --- a/ArduPlane/Attitude.pde +++ b/ArduPlane/Attitude.pde @@ -323,8 +323,8 @@ static void set_servos(void) /*Elevon mode*/ float ch1; float ch2; - ch1 = BOOL_TO_SIGN(g.reverse_elevons) * (g.channel_pitch.servo_out - g.channel_roll.servo_out); - ch2 = g.channel_pitch.servo_out + g.channel_roll.servo_out; + ch1 = g.channel_pitch.servo_out - (BOOL_TO_SIGN(g.reverse_elevons) * g.channel_roll.servo_out); + ch2 = g.channel_pitch.servo_out + (BOOL_TO_SIGN(g.reverse_elevons) * g.channel_roll.servo_out); g.channel_roll.radio_out = elevon1_trim + (BOOL_TO_SIGN(g.reverse_ch1_elevon) * (ch1 * 500.0/ SERVO_MAX)); g.channel_pitch.radio_out = elevon2_trim + (BOOL_TO_SIGN(g.reverse_ch2_elevon) * (ch2 * 500.0/ SERVO_MAX)); }