Add virtual inputs and virtual switches #5885
Add virtual inputs and virtual switches #5885wimalopaan wants to merge 18 commits intoEdgeTX:mainfrom
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
0c8ed57 to
7f3a149
Compare
e837be6 to
f296d20
Compare
|
The complete API for the virtual controls (virtual inputs, virtual switches) now comprises the following LUA functions:
|
|
@elecpower What does the label "needs: companion" mean? |
|
Literally that - some form of Companion support needed. i.e. I guess
Companion needs to know virtual sources/inputs exist so when you
read/write it doesn't delete them all! ;)
…On Mon, 31 Mar 2025, 10:59 pm Wilhelm, ***@***.***> wrote:
@elecpower <https://github.com/elecpower> What does the label "needs:
companion" mean?
—
Reply to this email directly, view it on GitHub
<#5885 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJ66KITPLMIV3EA3BY6IWT2XE34LAVCNFSM6AAAAABWYAJFTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRWGE2TAMJSHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
[image: wimalopaan]*wimalopaan* left a comment (EdgeTX/edgetx#5885)
<#5885 (comment)>
@elecpower <https://github.com/elecpower> What does the label "needs:
companion" mean?
—
Reply to this email directly, view it on GitHub
<#5885 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJ66KITPLMIV3EA3BY6IWT2XE34LAVCNFSM6AAAAABWYAJFTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRWGE2TAMJSHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
Ok, think I need some advice here ;-) In firmware/simulator a widget activates virtual sources / switches. This is to prevent littering the sources lists / switches lists with unused virtual controls. The question is now how to emulate this activation process, since widget installation in simulation started from companion is not persistent. So, this activation hast to be done by other means. Maybe an extra dialog for the model config? But that wouldn't exist in firmware/simulator. |
|
As a guide Companion:
|
|
Also populate lookup lists eg sources and switches |
319fdb8 to
a7fef4f
Compare
6d9ee20 to
10bf69e
Compare
10bf69e to
277cb6f
Compare
d7202a2 to
39a7816
Compare
3195023 to
0e8d54b
Compare
5048a24 to
e2734bf
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.
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
lvglLUA 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: