The Dual-use 3 way switch

Programing help and example for all firmwares based on thus's th9 firmware.
Post Reply
DaveTheKiwi
Posts: 2
Joined: Mon Feb 17, 2014 9:05 am
Country: -

The Dual-use 3 way switch

Post by DaveTheKiwi »

Hi everyone, hope I've come to the right place!

I have a Turnigy 9x flashed with ER9x. Unfortunately the radio only has a single 3-way switch, and I really want two of them. One for my flaps, the other for the autopilot. The two functions don't need to be used at the same time, so I want to use another switch (Aileron Sw) to toggle what the 3-way switch does. I have it working. Mostly.

Now I'm not sure if I'm just doing it wrong, or if I'm trying to break the laws of physics, or I've found an issue in the firmware. Hopefully someone can set me straight.

Here is what is happening:
In landing mode (ailsw=1), the flaps work completely as desired. In flight mode (ailsw=0), the 3pos switch does nothing (as designed - I don't have the autopilot, and will add that to the mixes when I do).
The issue is where I switch from flight mode to landing mode. The flaps go full deflection and then retract again. This is obviously not desirable.

How the radio is set up:
To achieve the dual use I've set up a set of custom switches:
S1 AND ID0 AIL ---
S2 AND ID1 AIL ---
S3 AND ID2 AIL ---
S4 AND ID0 !AIL ---
S5 AND ID1 !AIL ---
S6 AND ID2 !AIL ---

This is the mix that is doing the magic:
CH5 83 HALF SW1 *
+ 40 HALF SW2 *
+ 0 HALF SW3 *
R 83 HALF SW4 *
R 83 HALF SW5 *
R 83 HALF SW6 *

I.e. if SW1-3 set the flaps as appropriate, and SW4-6 force the flaps to stay up (83). As mentioned before I haven't added the autopilot yet, so I haven't added this mix in for a different channel. No doubt it will look pretty similar, with the only difference being that I can get away with "Replace" mixes rather than the "Add" ones I've listed above. I don't really have any concerns that I will be able to get that working fine.

If I replace all the 'Add' mixes above with Replace, then the issue goes away. I.e. I don't get a full flaps deflection when toggling the Ail SW. The issue there is that I seem to lose the slow down/up that I have programmed into those mixes - i.e. those settings just have no effect any more. I'm not sure why this would be either?

Does anyone have any insights as to what is occurring here? Am I trying to get the radio to do something illogical or plain impossible? Please help!

User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: The Dual-use 3 way switch

Post by MikeB »

Try:
CH5: +83% HALF ID0
+40% HALF ID1
R 100% CH5 !AIL

If ID2 is on, no mix is enabled so you get 0% anyway, you only need a mix if you want something other than 0 with ID2.
The Replace mix simply holds channel 5 where it is.

What revision of er9x do you have? Since June last year (r794) I added a mix option called "Late Offset". You can use this, along with 3POS as the mix source for the flaps:
CH5: -43% 3POS Offset(40%) (late) Diff(-7) Slow(u1:d1)
R 100% CH5 !AIL

-43% 3POS gives you +43% for ID0, 0% for ID1 and -43% for ID2. Adding the Diff(erential) of -7 adjusts the -43% of ID2 to -40%. Finally the (Late) offset of 40% shifts all the value up to- +83%, +40% and 0%.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
DaveTheKiwi
Posts: 2
Joined: Mon Feb 17, 2014 9:05 am
Country: -

Re: The Dual-use 3 way switch

Post by DaveTheKiwi »

Thanks Mike for your reply. I've been under the weather a little the last few days, so when I'm feeling better I'll definitely give you suggestions a go and answer your questions.

Post Reply

Return to “er9x / gruvin9x / th9 based firmwares”