Skip to content

Conversation

@dejaloomer
Copy link

This patch adds a simple scripting system to expose the ScreenManager's drawing functions. This enables drawing widgets from a host/server.
The patch hooks this ability into mqtt, though it could be used in any widget that can receive strings.
Also fixed the mqtt connection retry so it doesn't block in the widget.

@brett-dot-tech
Copy link
Collaborator

I'll look a bit deeper into this in a sec but have you looked at @ericthelin's web data widget? Based on your comment it sounds like its very similar in functionality to this

@dejaloomer
Copy link
Author

yeah, I didn't realize what webdata was until after I had done this. :^/
However, I think this script is significantly easier to generate and more compact than the json in the webdata. Since it maps directly to ScreenManager drawing calls it also makes for easy prototyping of widget draw code.
Since it just parses a string, it could also be integrated into WebData and provide an additional mechanism to the json there as well.

@dejaloomer
Copy link
Author

for example, here is the script to replicate the stock widget's drawing. It's basically a 1-1 lift from the cpp code. I think this could be helpful for widget developers to iterate their designs.

font,default
fill,black
fr,0,70,240,49,white
fr,0,111,240,20,lightgrey
fcol,white
fbcol,black
textc,52 Week,120,185,11
textc,H: $250.12,120,200,11
textc,L: $100.88,120,215,11
text,MegaCo,120,121,11,mc,black,lightgrey
ftri,110,11,130,11,120,23,red
arc,120,120,120,118,0,360,red,black
text,12%,120,48,29,mc,red,black
text,MGCO,120,92,29,mc,black,white
text,$288.60,120,155,29,mc,white,black

@brett-dot-tech
Copy link
Collaborator

Nice I see, Im going to leave this PR open until I have some time to dig deeper into it, and ultimately I think we'll need to figure out how it exists along the web data widget whether as a replacement, improvement, or if it exists as a separate thing.

With how limited flash is we just need to take caution with redundant features; though I do really like how you've done this, I just think merging it will require some consideration/changes to webdata and I just need the post-holidays time to sit down and think that through (:

@dejaloomer
Copy link
Author

cool thanks!

@dejaloomer dejaloomer force-pushed the drawscript branch 2 times, most recently from f51d49a to 5315fba Compare March 11, 2025 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants