I have had a good troll through the attitude.pde code (2.24) and see that support is there for putting a second aileron servo on channel 5 or 6, driven from channel 1.
I am basing the following discussion on the fact that only one aileron channel (ch-1) is being sent to the APM. This may not be in keeping with the way the code was written in that the code may require a left and right channel (Ch-1, Ch-6 or 6) to be sent to the APM to correctly handle dual ailerons. Please put me right on this if you have relevant info.
Anyway, if the ailerons are only controlled by one channel, then a problem came up that caught me out.
A second aileron (lets say ch-5) works fine in any of the auto modes, as it uses roll information to drive the second aileron channel. However when manual is selected the code just passes the channel 5 (or 6) radio IN info through to the servo output, and because in my case there is no servo input going into channel 5, you loose the second aileron. The following code fixes this. See Attitude.pde
/* SG this are original Lines
if (g.rc_5_funct == RC_5_FUNCT_AILERON) g.rc_5.radio_out = g.rc_5.radio_in;
if (g.rc_6_funct == RC_6_FUNCT_AILERON) g.rc_6.radio_out = g.rc_6.radio_in; */
/* Start of modified Code */
if (g.rc_5_funct == RC_5_FUNCT_AILERON)
g.rc_5.servo_out = g.channel_roll.servo_out; //forces servo_out_5 to be coupled to Roll_servo_out if RC_5 set to Aileron
g.rc_5.radio_out = g.rc_5.radio_in;
if (g.rc_6_funct == RC_6_FUNCT_AILERON)
g.rc_6.servo_out = g.channel_roll.servo_out; //forces servo_out_6 to be coupled to Roll_servo_out if RC_6 set to Aileron
g.rc_6.radio_out = g.rc_6.radio_in;
/* End of modified Code */
You have to pass the roll signal through the calc_pwm() class to get the channel inversion incorporated into the signal. I have not as yet looked at other places where xx_FUNCT_AILERON is used, such as trim storage, so other changes may also be required else where. But the above mods do work correctly for all modes using just one Aileron inpt channel.
As this is a discussion forum I look forward to having the above shot down in flames or otherwise.
Just like to add a little more to this thread re the new release 2.26. The code around the use of Ch5 and Ch6 in Attitude.pde has had quite alot of surgery on it. What I am interested in is should the code support the separate aileron on channel 5 in manual mode or not, as currently if you set up ch5 as an aileron channel, it works a treat until you switch to manual at which time only one aileron works. I would have thought that if ch5 is selected as a second aileron servo drive then it probably should operate in manual as well as other modes. I am not proficient enough with C++ to sugest a code update with the new code structure in Attitude.pde, but the same concept as shown above should be possible.
Please note that there is no ppm passtrough on ch5. This means if you apm hangs or stop working properly whatever is connected to ch5 output will go random. your plane will have an aileron fault. I found this very dangerous especially for firsts flight
Yes, the code already passes the second aileron channel through in manual mode. However, as Frank mentions this is only a software function and not supported by the hardware multiplexer, meaning it works fine but there is no hardware failsafe through the mux for the second aileron channel if APM hangs.