Play a track when a switch or condition changes?

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
mtschaff
Posts: 1
Joined: Tue Sep 06, 2022 10:11 pm
Country: -

Play a track when a switch or condition changes?

Post by mtschaff »

I have an Ultra-Stick, which has individual channels for each aileron and each flap. I use SB to enable(SB-)/disable(!SB-) what I call Aerobatic Mode, and SG to switch between the three aerobatic modes (flaperons, flaps, and crow). I'm using Special Functions to play a track when Aerobatic Mode is enabled/disabled, and to play a track indicating which mode is currently active (depending on the position of SG).

I'm using L01 to indicate flaperons are active, L02 to indicate flaps are active, and L03 to indicate crow mode is active. L01, L02, and L03 will only become true if SB- is true (acro mode on).

From a control perspective, everything works as intended. But from an audio perspective, there's a slight wrinkle. I have the Special Functions configured as follows:

Code: Select all

SF14   SB-  Play Track      acromd       1x
SF15   SB-  Play Track      actv         1x
SF16   !SB- Play Track      acromd       1x
SF17   !SB- Play Track      dactvd       1x
SF18   L01  Play Track      flpail      15s
SF19   L02  Play Track      flapdn      15s
SF20   L03  Play Track      crowon      15s
Let's say I have SG set to SG-, which activates flaps (L02) when SB is set to SB-. The wrinkle is that when I toggle SB to the SB- position, Special Function SF19 activates before SF14, so that the transmitter plays "Flaps down acro mode active", rather than "Acro mode active flaps down".

Q1: Is there any way to alter the sequence of the tracks, so that I can specify an order of occurrence? If not, I understand that I can add two additional SFs for each of the aerobatic modes, and have them depend on L01, L02, and L03, but that seems a bit of overkill. It would also result in "Acro mode active" being repeated even if it's already active and I'm just switching between aerobatic modes. I'd like to avoid that.

Q2: Is there a way to play a track based on a condition changing, rather than on the position of a switch? For example, if I have acro mode activated (SB-) and flaps on (SG-), I'd like to play the flapup track if I move SB to the down (or up) position. I'd also like to have flapup play if I'm in acro mode with flaps (SB-, SG-) and I change to crow mode (SG down) or flaperon mode (SG up).

A better example is crow. If I have crow activated (SB-, SG down), and I move SB to down, I'd like to play the crowof track. I don't want the track to play depending on the condition of L03, as that will produce incorrect results. If I play crowof when acro mode is enabled (SB-) and L03 is false, that means it will play if I switch between flaperon mode and flaps mode. What I'd really like is to play crowof when L03 changes to false, as opposed to when it IS false. I would leave the existing SF18-SF20 alone, as I like them to repeat every 15 seconds when they are active, as the current settings provide.

To summarize, I'd like flpdn to play any time L02 is true, and to continue repeating occasionally as long as L02 is true. But if L02 changes to false for any reason, I'd like flapup to play once.

Thanks in advance for your thoughts on this. I appreciate you taking the time to read through this, and hope it makes sense. If it does not, please let me know, and I'll try to explain more thoroughly. I saw a post yesterday talking about aileron + rudder mixing, and the author described his mixing logic (which used a Sticky condition) as creating something of a latch. The condition in his code stayed on until something turned it off, then it stayed off until something turned it on. That's a solution that I haven't investigated yet for this problem, but I suppose it would work as a potential solution.

I look forward to any suggestions - thanks again!

Post Reply

Return to “openTx”