"Sticky Logical Switch" like OpenTX

More
29 Jul 2022 15:19 #78032 by belrik
"Sticky Logical Switch" like OpenTX was created by belrik
Desired outcome:

Set output of channel high when a 2-pos switch is high AND momentary (trim button) is pressed.

Output remains high until 2-pos switch is low, despite momentary switch returning to low state.


How can this be achieved? In OpenTX are "logical switch" is created which goes high when the two inputs are high but only goes low when a single input goes low.

Please Log in or Create an account to join the conversation.

More
01 Aug 2022 18:15 - 01 Aug 2022 18:18 #78033 by -=Hubi-Dirk=-
Replied by -=Hubi-Dirk=- on topic "Sticky Logical Switch" like OpenTX
I have a suggestion for you, this is how I understood your request.

A complex mixer has to be programmed on channel 7, see pictures.
1. If the HOLD switch is set to position 1, the value on CH7 remains at the minimum.
2. If the momentary switch TRN is pulled out, the value for CH7 goes to maximum.
3. When the TRN momentary switch is released, the value of CH7 remains at the maximum.
4. If the HOLD switch is turned to the 0 position, the value on CH7 goes to the minimum.

Unfortunately the minimum value is -150 and the maximum value is +150, the reason for this is still unclear to me. But the function fits.

By the way, unlike OpenTX or EdgeTX, you can't use the trim switches as momentary switches.
Attachments:
Last edit: 01 Aug 2022 18:18 by -=Hubi-Dirk=-.

Please Log in or Create an account to join the conversation.

More
01 Aug 2022 18:46 #78034 by belrik
Replied by belrik on topic "Sticky Logical Switch" like OpenTX
What prevents the trim switches from being used here? I am currently using the trim switches for momentary switches elsewhere in my DeviationTX control scheme.

-=Hubi-Dirk=- wrote: I have a suggestion for you, this is how I understood your request.

A complex mixer has to be programmed on channel 7, see pictures.
1. If the HOLD switch is set to position 1, the value on CH7 remains at the minimum.
2. If the momentary switch TRN is pulled out, the value for CH7 goes to maximum.
3. When the TRN momentary switch is released, the value of CH7 remains at the maximum.
4. If the HOLD switch is turned to the 0 position, the value on CH7 goes to the minimum.

Unfortunately the minimum value is -150 and the maximum value is +150, the reason for this is still unclear to me. But the function fits.

By the way, unlike OpenTX or EdgeTX, you can't use the trim switches as momentary switches.

Please Log in or Create an account to join the conversation.

More
02 Aug 2022 05:27 #78036 by -=Hubi-Dirk=-
Replied by -=Hubi-Dirk=- on topic "Sticky Logical Switch" like OpenTX
Here you go and very interesting, the option with the trim switches was not shown to me. I would be interested in how you program the trim switches. Maybe you can show an example here.

Please Log in or Create an account to join the conversation.

More
03 Aug 2022 00:36 #78037 by hexfet
Replied by hexfet on topic "Sticky Logical Switch" like OpenTX
Trims can be used as switches in several ways. It's in the users manual under Advanced Topics.

I'm sure there's multiple ways to do this. Mine is based on the sticky throttle hold I use for helis. It's not quite perfect as if the arming switch is active at power on the output is positive.

The below uses GEAR0 as the arming switch and trim L+ as the momentary. I used Devo10 emulator to set this up so your tx might not have this trim switch.

First set up Virt1 using a trim as a momentary switch.
[virtchan1]
template=complex
[mixer]
src=Virt1
dest=Virt1
curvetype=min/max
points=0

[trim5]
src=Virt1
pos=TRIM_L+
step=193
value=-100,0,0,0,0,0

Then set up Virt2 as the arming switch. The key is the second mixer which has itself as an input which gives the capability of holding a state.
[virtchan2]
template=complex
[mixer]
src=GEAR0
dest=Virt2
switch=GEAR1
usetrim=0
curvetype=min/max
points=0
[mixer]
src=Virt2
dest=Virt2
switch=GEAR0
usetrim=0
curvetype=min/max
points=0
[mixer]
src=GEAR0
dest=Virt2
switch=Virt1
scalar=103
usetrim=0
muxtype=add

Please Log in or Create an account to join the conversation.

More
03 Aug 2022 06:02 - 03 Aug 2022 08:12 #78038 by -=Hubi-Dirk=-
Replied by -=Hubi-Dirk=- on topic "Sticky Logical Switch" like OpenTX
Hello Hexfet,

thank you for your information that trim switches can be activated as triggers.

My example showed the programming via the GUI of the Devo 12s. A selection of Trim_L+ is not possible there, or is not displayed there.

How do you proceed here?

Edit: Hexfet, thank you for your reference to the documentation. I was able to reproduce the function for the trims without problems with the description.
Last edit: 03 Aug 2022 08:12 by -=Hubi-Dirk=-.

Please Log in or Create an account to join the conversation.

More
03 Aug 2022 10:12 - 04 Aug 2022 09:59 #78039 by belrik
Replied by belrik on topic "Sticky Logical Switch" like OpenTX
thanks Hexfet and Hubi Dirk. I find that for these complex configuration connecting USB and a text editor is the way to go, as my T8SGv2 seems unable to enter some of this correctly (or at least intuitively).

I had my trims mapped as virt1-virt4 so I removed that, inserted your virt1 trim and the channels exactly as you have written them but replacing "GEAR0" with "SW H0" and "GEAR1" with "SW H1".
Last edit: 04 Aug 2022 09:59 by belrik.

Please Log in or Create an account to join the conversation.

More
03 Aug 2022 12:43 #78040 by belrik
Replied by belrik on topic "Sticky Logical Switch" like OpenTX
ok, think I got it working. I had some inputs inverted as my arming position was the opposite.

One sticking <ahem> point is that the arming channel goes high only when trim is pressed *after* the switch is moved, holding trim whilst moving the switch appears not to work.

Working config:
[channel5]
safetysw=!Virt2
safetyval=-100
template=expo_dr
[mixer]
src=SW H1
dest=Ch5
curvetype=fixed
[mixer]
src=SW H1
dest=Ch5
switch=SW H1
scalar=-100
curvetype=fixed
[mixer]
src=SW H1
dest=Ch5
switch=SW H0
curvetype=fixed

[virtchan1]
template=complex
[mixer]
src=Virt1
dest=Virt1
curvetype=min/max
points=0

[virtchan2]
template=complex
[mixer]
src=!SW H1
dest=Virt2
switch=!SW H0
usetrim=0
curvetype=min/max
points=0
[mixer]
src=Virt2
dest=Virt2
switch=!SW H1
usetrim=0
curvetype=min/max
points=0
[mixer]
src=!SW H1
dest=Virt2
switch=Virt1
scalar=103
usetrim=0
muxtype=add

[trim1]
src=Virt1
pos=TRIMRH-
step=193
value=-100,

Please Log in or Create an account to join the conversation.

Time to create page: 0.072 seconds
Powered by Kunena Forum