Mike Shellim
Last updated 6 April 2020
GVARs are one of the most powerful - and misunderstood - features of OpenTx. They are useful in two contexts: first, where you need to specify the same value in more than one place. And secondly, they provide a user-friendly front end for adjusting mixer weights etc.
Used sensibly, GVARs can greatly simplify the design and adjustability of your model! In this article, I'll describe how to use them effectively. I'll use a mixture of screen grabs and text representations as appropriate.
GVAR stands for 'global variable'. A GVAR represents a number, and you can use GVARs in many contexts where a number is used, e.g.
GVARs share a useful property with digital trims - they retain their values even after you switch off the transmitter. (In fact the the similarity between GVARs and digital trims run deeper, as we'll see.)
In this section we'll examine how to
OpenTx provides nine GVARS, named 'GV1', 'GV2'... 'GV9. They are managed in the GLOBAL VARS menu, where you can view and alter their values.
GVARs menu (first 7 shown)
Each GVAR has nine columns labeled FM0, FM1, ... FM8, representing the nine flight modes.
You can enter a different number for each flight mode. When a GVAR is referenced, OpenTx retrieves the value for the flight mode which is active. For example in the screenshot above: if FM1 is active, then GV1 returns '20'. If FM2 is active, GV1 returns '40'. And so on.
Remember that FM0 is the default flight mode: if you don't define any flight modes explicitly, then FM0 is always active.
In this section we'll see how to use a previously assigned GVAR. As an example we'll reference a GVAR in the weight field in a mixer.
Long press to display GVAR
OK, so that's the theory... let's see how GVARs are used in practice. As an example, create a simple glider setup, with channels 5 and 6 assigned to ailerons:
CH5 (left ail)
Src=Ail
CH6 (right ail)
Src=Ail
Now add some differential for each aileron servo.
To set differential: open the mixer editor, and to skip to the curve field. Specify 'diff' as the curve type, and enter a value. The diff value may be entered directly, or it may reference a GVAR.
Note: we are assuming that the mixer behave perfectly symmetrically. You can achieve this, regardless of mechanical differences, by calibrating your servos
First, let's specify diff by typing the value in directly:
CH5 (left ail)
Src=Ail Diff = 30
CH6 (right ail)
Src=Ail Diff = -30
There's one problem with this: In order to alter diff, we have to make two identical data entry operations, which is both tiresome and error prone. Let's see how to improve it!
Instead of specifying the value of diff directly, let's store the diff value in a GVAR and then reference it in the diff field.
GVAR
GV1=30 -- stores diff value
CH1 (left ail)
Src=Ail, diff = GV1
CH2 (right ail)
Src=Ail, diff = -GV1
To change diff in both mixes, only one adjustment is required, to GV1.
So far we've only used the default flight mode (FM0). Suppose our setup uses several flight modes.
We saw earlier that a single GVAR can provide different values for different flight modes - so we simply assign the required diff values to the appropriate flight modes in the GVAR menu.
GV1=30 (FM0), 45 (FM1) -- stores diff value for FM0 and FM1
CH1 (left ail)
Src=Ail, diff = GV1
CH2 (right ail)
Src=Ail, diff = -GV1
Compare this with the solution without using GVAR's:
CH5 (left ail)
Src=Ail Diff = 30 Flightmode = FM0
Src=Ail Diff = 45 Flightmode = FM1
CH6 (right ail)
Src=Ail Diff = -30 Flightmode = FM0
Src=Ail Diff = -45 Flightmode = FM1
The benefits of GVARs should be clear!
So far we've set our GVARs by typing in the value directly in the GVARs menu. However, OpenTx provides an alternative and very powerful mechanism for setting GVARs, using the 'Adjust GVAR' action in special functions. This opens up exciting possibilities for varying expo, diff etc. dynamically.
The Adjust GVAR action provides a way of altering the value of a GVAR in response to some event. Let's see how it works:
The action is executed the moment that the switch in step 4 becomes True. The switch may be any physical or logical switch. You can also specify 'ON' as the switch. This is triggers whenever the source value changes and is used to bind the GVAR to a source. We'll see why this is useful in the next section.
Sometimes it's useful for a GVAR to track the value of something, in other words to be 'bound' to a source. For example, you may wish to a GVAR to track the value of a channel output.
To implement binding,
In the screenshot below, GV1 is bound to CH8. In other words, GV1 will always report the value of CH8.
Binding GV1 to CH8
Say we want to vary aileron differential in flight, depending on the position of the rudder trim (TrmR). We can do this by binding GV1 to the rudder trim, then setting Diff = GV1.
The code is in three parts:
CH8 -- outputs between 20 and 60 depending on rudder trim
Src=TrmR wt=20 offset=40
SF1 -- Special Function which binds GV1 to CH8
switch="ON" Action="Adjust GV1" Parameters="Src=CH8"
CH1 -- aileron servo channel, with variable diff from GV1
Src=Ail, Diff=GV1
The benefits of GVARs are as follows
The drawbacks
GVARs can be used in conjunction with cascading mixers to create powerful and elegant solutions.