RudolphRiedel / FT800-FT813

Multi-Platform C code Library for EVE graphics controllers from FTDI / Bridgetek (FT810, FT811, FT812, FT813, BT815, BT816, BT817, BT818)
MIT License
133 stars 58 forks source link

Experimental approach for widgets #100

Closed mjerjawi closed 1 year ago

mjerjawi commented 1 year ago

I'm interested in contributing to the development of widgets for EVE displays. While I'm relatively new to working with EVE displays, I'm eager to assist primarily with documentation due to my limited experience.

RudolphRiedel commented 1 year ago

Oh, I would have been better to not open with a pull-request but rather a discussion. :-) As much as I like the participation and I admit that I put very little documentation in, I just uploaded the two files only yesterday though and I am not sure so far where this is actually going. :-)

And while I only disagree with the documentation part in minor details, you kind of broke the two functions in a couple of ways. :-)

if (border)

This is a coding guideline violation, although I obviously did not put out any coding guidelines. :-) This is doing a boolean comparision on a non-boolean variable. As that may, providing a border-value of zero would make the two functions pointless, the result would be just a dot or a rectangle but with too much code. :-)

EVE_cmd_dl(POINT_SIZE(radius 16 + border 16)); EVE_cmd_dl(POINT_SIZE(radius * 16));

So the result would be a circle that is larger on the outside than the given radius. And I deliberately left out the *16 as to allow for more freedom when using the function.

uint32_t bordercolor

That I left out this parameter was on purpose, this is an optimization and allows for something like this: EVE_color_rgb(PURPLE); EVE_widget_circle(400, 200, 45 16, 10 16, WHITE); EVE_widget_circle(500, 200, 45 16, 2 16, WHITE); EVE_widget_rectangle(400, 300, 50, 30, 10, 10 16, WHITE); EVE_widget_rectangle(500, 300, 50, 30, 2, 2 16, WHITE);

Ok, these are nothing but commodity functions, like the built-in widgets they have quite some overhead. Like the EVE_cmd_dl_burst(DL_SAVE_CONTEXT); / EVE_cmd_dl_burst(DL_RESTORE_CONTEXT); that is only needed to reset from the second color. Or when not doing one circle but 10 you could easily optimize this with using only a single EVE_cmd_dl(DL_BEGIN | EVE_POINTS); / EVE_cmd_dl(DL_END); pair and only two EVE_cmd_dl(POINT_SIZE(xxx)); calls. Just draw ten larger dots, change the size, draw ten smaller dots.

The genereal idea with EVE_supplemental is to provide more interesting options, for example inspired by the additional widgets that the Eve Screen Designer provides. But it was too early to even put this out, yet. :-)

mjerjawi commented 1 year ago

I believe I got a bit too excited about opening a pull request :-) . I plan to close it now.

When it comes to performance, I acknowledge that every framework has a little trade-off in terms of performance. However, I believe a framework's primary role should be to facilitate development, particularly for less experienced individuals, allowing them to create a decent UI.

I am relatively new to working with EVE displays, and I must admit that I feel a bit lost. As we both know, the programming guide isn't the most intuitive resource to work with, lacking precise guidelines on how to structure commands. Initially, it took me a while to grasp the concept of using "VERTEX2F" just to draw a basic square :( .

I wonder if it would be possible to initiate a new discussion dedicated solely to the new widgets? I am enthusiastic about participating in any way I can :) .

RudolphRiedel commented 1 year ago

As I still would like to use the documentation, if you are up for it, please re-open the pull-request and dial it down a bit. I could just add it anyway but that would not give you any credit for your pull-request.

The part of this library beeing some sort of framework is actually tricky. For the most part this is merely a wrapper library to make the EVE chips API easier to use, plus a little extra. This is why most of the updates I do are to add more hardware support, display modules and host controllers, increase compliance with coding guidelines like Barr-C 2018 or MISRA and occasionally fix bugs. And as I strive for efficiency and speed, adding functions like the two in EVE_supplemntal is actually a contradiction for me. The overhead for a single call is fine. But if I needed ten rectangles for ten simple buttons, I would not use the rectangle function but rather go with an optimized approach in order to reduce the SPI traffic.

And discussions, of course, feel free to open a discussion for anything you would like to discuss or ask.