`getfieldInfo` can now also take a source index as argument. Plus it was modified to also handle "telem1+" etc.
New functions `getSourceIndex(sourceName)` and `getSourceName(sourceIndex)` were added, which use the names shown on the
screen instead of the special names table used by `getFieldInfo` and `getValue`.
Indices are the same for all of the functions, so `getValue(sourceIndex)` also works with indices from `getSourceIndex`.
New iterator functions `sources([first[, last]])` and `switches([first[, last]])` for getting ranges of sources and switches.
`getPhysicalSwitches` was removed, as I consider the iterator function to be a better solution.
[Lua] Add setStickySwitch and getLogicalSwitchValue (#1056)
* Adds setStickySwitch to set the value of a stick logical switch
* Adds getLogicalSwitchValue to get the value of a logical switch by index
* Add filename to lua `model.getInfo()`
* Make `getModelNumberStr()` globally available
* Move variable extern
* Move constexpr to header, remove externs
* Perhaps .cpp should include its OWN header
* Relax assumptions about when Lua is called in foreground and background
* Start Lua cycle timer both in foreground and background
Do not assume that background/foreground alternates
* Lua is called at every Standalone GUI cycle instead of 5 Hz
Since Lua preempts every 50 ms or so, the GUI should remain responsive.
* In standalone script, only call Lua once per GUI cycle, to avoid messing up buffer handling.
* Revamped error reporting for Standalone and Telemetry Lua scripts
* Font size for Lua error is reduced from XL to L on color if LCD_W < LCD_H
* In drawTextLines, also possible linebreaks for opening brackets.
* Smaller font for error message on tall color screen
* Make titlebar height match font size on narrow LCD
* Issue #132
Added 16 shared memory variables which can be accessed bot from Lua widgets and other Lua scripts.
* Notice Only available on radios with color display
* Preliminary trims as keys for lua
Largely based on open-flysky implementation
* Add `isLuaStandaloneRunning()`
* Add more virtual events
* Tweak virtual events further
* Finish remapping keys to virtual events
* Move some virtuals to right trim hat
* Add missing "defined"
* Revert to common EVT_VIRTUAL_MENU mapping
* Make keys/trims reset backlight like other radios
* Fixed a bug where a standalone Lua script w/o a run function will hang the GUI on non-color radios
* Prevent Lua standalone window from opening if Lua failed on load
* Fixed scroll down key in TX12 simulator
Copied key definitions from TX16S
* Fixed the Lua error trying to call nil value when no scripts are loaded.
* I messed up in the previous commit; now it does not freeze and it does not call nil.
* Do not reload bitmps during theme update, unless reload argument is true
Trying to optimize speed for theme color changes.
FlySky is not optimized yet.
* Do not update theme from Lua lcd.setColor(CUSTOM_COLOR, x)
Some widgets like e.g. Timer2 constantly change CUSTOM_COLOR, and this seems to slow down things
* Lua function lcd.setColor() only updates if color is changed
To avoid that scripts calling lcd.setColor() repeatedly trash performance