feat(color): telemetry queues for Lua, enhance default widget options#5926
Conversation
|
Added support for the default value of a SWITCH or SOURCE option to be a table of possible values. { "volt_sensor", SOURCE, {"cell","VFAS","RxBt","A1", "A2"} } |
751a48a to
e26392e
Compare
|
The |
|
The position of all objects can be set with the 'pos()' function. {type="rectangle", filled=true,
color=getFillColor,
size=(function() return fw, math.floor(wgt.vPercent / 100 * (fh)) end),
pos=(function() return 0, fh - math.floor(wgt.vPercent / 100 * (fh)) end)}, |
Perfect! Sorry, I missed that in the docu .... Does One problem with |
Parent. I've updated the gitbook docs.
Triangle is complicated as Lvgl does not have a native triangle object. |
Yes. Most libs have to notion of an origin of the drawing canvas. And the rotation rotates around this origin. But I don't know if that's possible for
Mmh, this should be mostly the same as using the |
I am assuming you would only call 'set()' when something changes so it does not check. |
Ok, then maybe saving the |
|
Perfect! |
|
I noticed a new (!) problem with the
Now see, that the I don't think that this is intentional, because the Unfortunately I have no small(!) example widget ... will need some time. |
It may be a few weeks before I can look at this. |
Ok, take your time ;-) Then I have enough time to create a minimal verifying example ... |
|
In the process creating an example i noticed that the problem I reported in #5926 (comment) was my fault! I forgot to use |
|
I do not really understand, what the meaning of This would be my understanding, but maybe I'm totally wrong here. |
|
isAppMode() function can be used when building the widget layout to determine if user input controls can be used for an app mode widget. But looking at the code, we currently have the states show below.
So isAppMode() is somewhat redundant as isFullScreen() would also work. I see two options:
Thoughts? |
|
I would go for:
|
|
In my opinion, the app-mode is NOT the layout, So i suggest to change the AppMode() to reflect that.
|
That would make it redundant as it becomes identical to isFullScreen() (which was traditionally used for this purpose). |
|
Please correct me if this is wrong, but does "Normal layout, full screen" also not necessarily mean touch input? It seems to me that 3 & 4 should both be true for isAppMode(), and you know the widget has touch input focus if
|
|
Ok, so fullscreen represent the ability to use touch (bad name, but it is what it is) |
|
The API has the two functions I came across an use case where it would be best to have a function e.g. |
|
The refresh function is called first. You could do the calculations there and store the result in local variables to be used in pos and size functions. |
1340bda to
d245306
Compare
|
@pfeerick Can we get this added to 2.11. I think the fixes may be needed for the dev competition entries. |
|
@philmoz Yup, no problem... will test it in the next day or two. @offer-shmuely You should be able to download the build artefact from https://github.com/EdgeTX/edgetx/actions/runs/13882610494 once it's done. |
|
Tested it the last weeks: works for me ;-) |
|
What do you think about #5926 (comment) ? |
I downloaded the previous one, most of the requested are working ok, (except the option to supply boolean to "visible") but it look this branch is behind the master, since some previous changes stopped working (like the getSwitchIndex("SF".. CHAR_UP) |
The getSwitchIndex() and getSourceIndex() changes are part of this PR and are working for me. |
my mistake |
Send path name of widget folder to script 'create()' function. Enhancements for widgets option default values, getSwitchIndex() and getSourceIndex() Lua function.
…ine if line or triangle points have changed.
…how error message.
7327716 to
d2baa5e
Compare
|
Checked Ghost, CRSF and ELRS telemetry on T15, and FrSky X2 on X9D+ internal RF, and Spektrum DSM via MPM ... telemetry, Lua and widgets all look good! |
Summary:
Details:
This PR allow the Lua API functions to access the widget or stand alone script that called the function. In addition this adds the telemetry queue per widget in an alternate manner to #5773.
The code now sends the path of the widget being loaded to the script 'create()' function (as the 3rd parameter).
The following changes have been made to the getSwitchIndex() and getSourceIndex() API functions:
For the widget 'options' table, entries of type SWITCH and SOURCE, can set their default, min and max values from a string. This is a shortcut to using getSwitchIndex() or getSourceIndex() in the option table.
E.G. these two lines are equivalent:
{ "Switch", SWITCH, "SF"..CHAR_DOWN }, { "Switch", SWITCH, getSwitchIndex("SF"..CHAR_DOWN) },