Replies: 2 comments 6 replies
-
Thanks for you suggestion. I would propose to extend it with the following:
It means that the 3 alternatives would be valid: # option 1 - as above
list_to_point_arr([ [1,2], [3,4] ])
# option 2 - flat list
list_to_point_arr([ 1,2, 3,4 ])
# option 3 - flat arguments as lists
list_to_point_arr([1,2], [3,4])
# option 4 - flat arguments as numbers
list_to_point_arr(1,2, 3,4)
# and mixing
list_to_point_arr( [1,2], 3,4) |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is not a 'bug' but an improvement proposal of the LVGL API in berry for Tasmota based on some Github Discussions and the Discord:
Problem Statement:
Using the line widget is very verbose right now in berry because of the object oriented notation which requires to create an empty point object and then seperately set x and y of the point.
For more complex lines this becomes very clunky very quickly. In C, this is implicitly solved by casting. You can just write down a list of lists with either coordinates or lv.pct() values and the point setting function takes care.
This makes for much more condensed and elegant code.
Hence, I would propose the following helper function:
This will allow a complex line widget to be created as follows (example from my app where I stumbled across this issue, this draws a complete map of a basement):
The result of the function can then be directly passed into the set_points function.
This saves the preallocation of empty point objects and counting the entries, which set_points requires.
If you are willing to take this in, I would need some guidance as to where to add it, then I can turn this into a PR.
hope it helps.
Beta Was this translation helpful? Give feedback.
All reactions