-
-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add virtual inputs and virtual switches #5885
base: main
Are you sure you want to change the base?
Conversation
Please do not add something like this on bw, it will make scrolling a nightmare! (And likely Colors too) |
On BW it should be not available (need to check COLORLCD) On COLORLCD: why do you think scrolling would be an issue? |
I added the possibility to explicitly activate a virtual control (input, switch). If no LUA script activates some virtual controls, they do not show up at all.
|
ba8f0ba
to
d62a841
Compare
a5ae59f
to
0c8ed57
Compare
… This way the list of available sources and switches is as short as possible, if a LUA script sets the activation accordingly. If no LUA script does activation, the virtuals do not show up at all.
0c8ed57
to
7f3a149
Compare
This PR adds virtual inputs (Vin1 ... Vin16) and virtual switches (V01 ... V64) and neccessary LUA support functions
setVirtualInput()
setVirtualSwitch()
getVirtualSwitch()
A LUA widget
lvglControls
(see: https://github.com/wimalopaan/LUA/tree/main/WIDGETS/lvglControls ) is provided for demonstration a simple use case: extending the number of physical inputs and physical switches of the radio via a widget that provides some virtual touch controls for these virtual inputs and virtual switches.Another purpose is to extend the amount of physical knobs, etc. of the radio by connecting some external device via serial (AUX1, AUX2) to the radio, and installing a custom widget, that reads from the serial and uses the above functions to set the virtual inputs and virtual switches.
A proposal for such a serial protocol can be found: https://github.com/wimalopaan/Electronics?tab=readme-ov-file#hwext
Rationale:
In the good old days there were radios like the FrSky X9E that provide a large amount of potentiometers and switches. This type of radio was/is very popular for controlling crawler/ships- or other functional-models. The number of these physical items is still limited and due to their physical nature, the labels for all these elements are also handwritten on paper.
With the advent of the
lvgl
LUA support it is possible to create virtual controls that perfectly fit into the UI look-and-feel of EdgeTx and also are not very compute-intensive. This opens the way to use widgets to provide arbitrary virtual controls and switches with customisable labes and colors. It also opens the way to use widgets to read from serials like AUX1/AUX2 and get controls data from some external devices (e.g. a µC with some physical potiometers, switches, incrementals, ... connected).Alternative:
There is a cumbersome alternative way to achieve a similar but very limited result: a widget could use the function
shmSet()
to transport up to 16 values, to a mixer script which could pick them up viashmGet()
and simple return them (only up to 6). These output values of the mixer script could then be used as mixer-inputs. There is no such a way for switches.Example Widget: