Multifunction Momentary Switch

Published by Mr. D on

This tutorial shows you how to get more out of your momentary switch. Its pretty simple to set up the momentary switch to do something, like reset a timer or read out your current altitude. But, what if we want it to do more than that? What if we want it to reset the timer and read out the current altitude, and I’m not talking stacking the special functions. We can do it so that a quick flick reads the altitude, a hold of 2-4 seconds tells you your pack voltage, 4-6 seconds enters the iNav OSD menu, and 6-8 seconds resets the timer. These are all just examples, what you can do is only limited by your imagination, how well you can remember a beep sequence, and how long you can hold your finger on the switch. The most important thing is to order your options, so that the things you may want to activate in flight are sooner, and things that can be done on the ground are later in the list.

How this is set up

I’ve tried to come up with a concept to easier explain this functionality. What I’ve come up with is to call each command a switch “position”. Each switch “position” is comprised of 2 logical switches and 2 special functions (for basic operations). The first logical switch sets the beginning of the position, which triggers a special function to make a sound. I’m just using beeps, but you could have a different sound for each position. You could even have a voice to say what each position is, but you would need to lengthen the size of the position. The idea is, as soon as you hear the sound you want, let go of the momentary switch.

The second logical switch defines the length of and captures the release of the momentary switch. In some cases, w need to add an extra logical switch. For example, if you want to have a switch position to enter the iNav OSD menu, we must make sure that the system is disarmed before we can grant access. The triggering of this logical switch will enable the special function to do it’s thing.

Example

In the example below, I have set up 4 switch positions:

  • Position 1 – When the switch is flicked, it will read out the altitude
  • Position 2 – Enter the iNav OSD menu
  • Position 3 – Calibrate the compass
  • Position 4 – Reset the flight timer

As I said earlier, you can pretty much get this to do anything. But, I thought these examples may be useful to people.

Full OpenTX Code

Select the first Logical Switch and first Special Function positions available on your Model

Logical Switches

# Function V1 V2 AND Switch Duration Delay Description
L01a > xSH90---0.00.1Position 1 sound trigger
L02EDGESH↓0.1 | 2.0---------Position 1 action
L03a > xSH90---0.02.1Position 2 sound trigger
L04EDGESH↓2.1 | 4.0SF↑------Position 2 armed action
L05EDGESH↓2.1 | 4.0SF↓1---Position 2 unarmed action
L06a > xSH90---0.04.1Position 3 sound trigger
L07EDGESH↓4.1 | 6.0SF↑------Position 3 armed action
L08EDGESH↓4.1 | 6.0SF↓1---Position 3 unarmed action
L09a > xSH90---0.06.1Position 4 sound trigger
L10EDGESH↓6.1 | 8.0---------Position 4 action

Special Functions

# Switch Action Parameters Enable Description
SF01L01Play SoundBeep 1No repeatPosition 1 sound
SF02L02Play ValueAltNo repeatPosition 1 action - play altitude
SF03L03Play SoundBeep 2No repeatPosition 2 sound
SF04L04Play TrackDisarmNo repeatPosition 2 action - we are armed, so play a track telling us to disarm
SF05L05Override CH2100✔ ONPosition 2 action - show OSD menu
SF06L05Override CH30✔ ONPosition 2 action - show OSD menu
SF07L05Override CH4-100✔ ONPosition 2 action - show OSD menu
SF08L06Play SoundBeep 3No repeatPosition 3 sound
SF09L07Play TrackDisarmNo repeatPosition 3 action - we are armed, so play a track telling us to disarm
SF10L08Override CH2-100✔ ONPosition 3 action - calibrate compass
SF11L08Override CH3100✔ ONPosition 3 action - calibrate compass
SF12L08Override CH4100✔ ONPosition 3 action - calibrate compass
SF13L09Play SoundBeep 1No repeatPosition 4 sound
SF14L10ResetTimer 1✔ ONPosition 4 action - reset the timer