model.getGlobalVariable(0, 0), because GV1 is the first global variable, and FM0 is the first flight mode. But as long as you remember that all direct indices start with 0 for the first one, you should be fine!
idwith the function
getValue(id)to read the current value. You can also use
namedirectly, but this is less efficient, as EdgeTX does a linear search for the name every time it is called. Therefore, the procedure of first extracting the meta-index from
getFieldInfo(name).id, and then using that, is recommended.
getLogicalSwitchValue(index)uses a direct index to read this specific type of switch sources, again using the
index0 for LS1 etc. But there are also several types of switch sources, such as:
model.setGlobalVariable(index, fm, value). If you use the default GV setting, where all other flight modes use the value of FM0, then you can use 0 for
STICKYtype logical switch, and then use
indexis from the above.
model.getFlightMode, which is a completely different function!
fm, or you can setup the GV to always use the value from FM0.
STICKYtype logical switch.