-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
feat(color): enhancements for Lua widget scripts. #5926
base: main
Are you sure you want to change the base?
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. |
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.
aa423fc
to
97c2625
Compare
The |
Regarding the widget name on create function, I wonder what is the relation between the folder name of the widget, and the name passed int the "return {name="the widget name", " |
Having the directory passed as third argument to The |
I encountered a problem with the function |
In my understanding Regarding to key events, this should have some exceptions: the page keys should still work to switch the screen. If a widget wants also to use the page keys, it should be able to do that (maybe an entry in the return-table of the widget chunk or a possiblity to install a page key event handler). I hope that makes any sense ... |
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 required for #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: