purduesigbots / liblvgl

2 stars 3 forks source link

LVGL 5.3: lcd::print() is broken #25

Open Richard-Stump opened 1 year ago

Richard-Stump commented 1 year ago

Task:

The lcd::print function for llemu.cpp/hpp is not printing anything. An example of this can be seen with the default main.cpp:

...
while (true) {
        pros::lcd::print(0, "%d %d %d", (pros::lcd::read_buttons() & LCD_BTN_LEFT) >> 2,
                       (pros::lcd::read_buttons() & LCD_BTN_CENTER) >> 1,
                       (pros::lcd::read_buttons() & LCD_BTN_RIGHT) >> 0);
...

This should print the states of the 3 buttons as 0 or 1 on the first line, but currently seems to print nothing. It should look like: image

Beta Server Link:

https://discordapp.com/channels/1025259843763847229/1029666535553384498/1071536722996887602

Testing:

This can be tested using the default main.cpp. The button states should be printed at the top, and change when the buttons are pressed.

WillXuCodes commented 1 year ago

Def something to do with the weak symbol not being overidden. Probably because it's one of the functions inside screen.hpp

WillXuCodes commented 1 year ago

This is going to be the order of troubleshooting for some poor soul that actually has time to do this:

  1. Add some sort of print statement or feedback to the lcd::print statement on the Kernel side.
  2. Turn Kernel into template, apply it to a default project, y'all know the drill w/ that.
  3. Apply current version of liblvgl to that. 4a. See if feedback occurs. If feedback does occur, we need to figure out how to create a templated function that is also considered with attribute weak. 4b. While my initial google search did not yield anything of substance, attempting to RTFM more or moving the "attribute(weak)" before the template part might work? We might also want to consider dynamically figuring out if the print func is initialized and calling some new "dummy" printv weak function that uses a variadic argument parameter instead of the argument list which may allow us to bypass using a template.
Richard-Stump commented 1 year ago

Update: The weak symbol works as intended, and the api.h file in the kernel simply does not include the llemu headers, since they were pulled out of the kernel repo.

Richard-Stump commented 1 year ago

We need to somehow make it so that they are included in API.h, only when liblvgl is applied to the project. I am currently trying to figure out the best way to go about this.

WillXuCodes commented 1 year ago

Update: This is now only a liblvgl 5.3 (legacy) issue. Would be nice to solve ASAP but higher priority tasks such as doxygen and Okapi should be finished first before working on this backwards compatibility version working.