Help needed: switch+pot weight

openTx has introduced a range of new features, ideas and bling. It is fast becoming the firmware of choice for many users. openTx will run on ALL current hardware platforms, including the gruvin9x and sky9x boards. Work has already started to support the new FrSky X9D radio!
Post Reply
carlic
Posts: 3
Joined: Sun Apr 14, 2019 1:57 pm
Country: -

Help needed: switch+pot weight

Post by carlic »

Hi

Pretty fresh with the open tx so I do need some help mixing seemingly a easy task.
I would like to assign a channel to a 3 position switch and limit the amount of deflection (weight) in either direction by a potentiometer.

For example:
-center position of the switch is 0%
-the potentiometer should control the weight from 5% pot at min, and 20% pot at max. This should work in both directions of the switch symmetricaly.

Help is appreciated!

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

Re: Help needed: switch+pot weight

Post by MikeB »

Use 2 mixes on the channel (example using SA as the switch and S1 as the pot):
+ 50% SA
*= 15% S1 Offset(25%) - a multiply mix.

If you used 100% in the first mix, you would need 7.5% in the second mix, which is why I've suggested 50% and 15%.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
carlic
Posts: 3
Joined: Sun Apr 14, 2019 1:57 pm
Country: -

Re: Help needed: switch+pot weight

Post by carlic »

Worked like a charm!

Thank you!
carlic
Posts: 3
Joined: Sun Apr 14, 2019 1:57 pm
Country: -

Re: Help needed: switch+pot weight

Post by carlic »

Would you be so kind to write down the math used?

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

Re: Help needed: switch+pot weight

Post by MikeB »

You wanted to scale the normal 0-100% onto 5-20%. 5 to 20% is 12.5% +/- 7.5%.
Since you may only use whole numbers for the weight I suggested reducing the switch controlled mix to be 0-50%. Now the scaling to get between 5% and 20% is doubled to 10% to 40%. This is 25% +/- 15%, so the multiply mix uses a weight of 15% and an offset of 25%.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Post Reply

Return to “openTx”