I've added a few explanatory comments and renamed the array "channel[]" to "contrl_pos[]" as it actually depicts control positions, hopefully avoiding the confusion with receiver output channels. No code changes.
Code: Select all
// Optionally, and only if you fully understand the array allocations, you can set any unused analogues here instead of
// paralleling unused analogue inputs. Either method prevents floating inputs 'wandering' or following an adjacent pin.
// Physical wiring is: A0=aileron stick pot, A1=elevator, A2=rudder, A3=throttle, A4=aux1, A5=aux2, and
// A0 is your 'primary steering' control - on a rudder/elevator/throttle set, the rudder servo is plugged into the aileron channel. SOP.
// Array numbering is: contrl_pos[0]=aileron stick pot, contrl_pos[1]=elevator, contrl_pos[2]=rudder, contrl_pos[3]=throttle,
// contrl_pos[4]=aux1, contrl_pos[5]=aux2.
// So for example on a 3ch set, zero the rudder, aux1 & aux2 elements (contrl_pos[0] is primary steering) like this:
// contrl_pos[2]=0; contrl_pos[4]=0; contrl_pos[5]=0 // example for a 3ch rudder-elevator-throttle set
// contrl_pos[4]=0; contrl_pos[5]=0; // example for a 4ch aileron-elevator-rudder-throttle set
No Bo, contrl_pos[0] is your primary steering channel, in a 3ch set rudder is primary steering.Bo Edstrom wrote: ↑15 Dec 2019, 02:05 ...
So if I for example would not use aileron one would zeroing contrl_pos[0]
Is this correct?
You would never disable the aileron channel unless you fly some weird mode (3?) with steering on the secondary stick. When you fit out a 3ch rudder-elevator-throttle model, its expected that you'd plug the rudder servo into the receiver aileron channel... thats how its always been
The single-channel emulation operates on array element "contrl_pos[0]" as your primary steering channel, as do the V-tail and elevon mixes.
Its unfortunate that I initially used the word 'channel[]' as the name for the servo position array, as occasionally people confuse it with R/C channels and the order of channels output by the receiver.
So on a 3-channel set, you would zero contrl_pos[2], contrl_pos[4] and contrl_pos[5], leaving contrl_pos[0], contrl_pos[1] and contrl_pos[3] active for rudder, elevator and throttle respectively.
No you dont Max, its either tie unused inputs OR code them out. The document is aimed at non-tech people who use my pre-programmed 7ch boards, or who are not adept at code changes, and they should tie unused inputs.
For those who can code, who fully understand the sketch and are blowing their own boards from it, zeroing unused contrl_pos[n]=0 is an alternative. Nothing has changed in this respect from the earlier code!
To be honest this urge for first-time-users to change a perfectly stable project before even trying it makes me nervous. If anyone is not absolutely 100% on how the code works I'd be much happier if they leave it as-is and parallel unused inputs exactly as per the document, many hundreds have been done this way, exactly as per the document, and it works!
Cheers
Phil