LVGL Issues

Hi everyone, I’ve been playing around with LVGL recently to make a more robust autonomous selector. Unfortunately, I have run into a few issues.

The first is that the objects that I define do not appear until they are clicked on. As suggested in other threads, I have made sure to add delay statements in my other tasks, but it seems to do no good.

The second is that making any changes to styles has no effect. I can copy styles like lv_style_pretty, but using switchStyle.body.main_color = LV_COLOR_CYAN has no effect. I tried the same with a button object, but the color still did not change.

What should I do? I’m currently using PROS Kernel version 3.2.0, LVGL is version 5.3.0.

lv_obj_t * Switch;
static lv_style_t switchStyle;

void initialize() {
Switch = lv_sw_create(lv_scr_act(), NULL);
lv_obj_set_size(Switch, 36, 12);
lv_obj_set_pos(Switch, 20, 30);

lv_style_copy(&switchStyle, &lv_style_pretty);
switchStyle.body.main_color = LV_COLOR_CYAN;

lv_obj_set_style(Switch, &switchStyle);

For the style, switch object has more then one style and you have to set it differently. Look at lvgl’s docs on how to do this.

As for the objects not appearing, I am not sure. It could possibly be caused by incorrect style (since you set the style incorrectly).

Awesome, the changes are taking effect now! The issue with it not appearing still persists, unfortunately.

Could you post a picture of the screen, someone had an issue with something not showing up and it turned out to be in the wrong position and blended in with the background. Also is that all your code that does stuff with lvgl, because it seems like it should be working.

Yeah, I copied the sample switch styles from the Documentation, but other than that, that’s all I have. I’ve attached my code and the V5 Brain display below.code lvglissue
(Sorry for bad quality)

It might be the lack of lv_obj_align for the switches.

I’ve added the switch example to the v5gui example found here

1 Like

The issue unfortunately still persists. I’ve added several instances of lv_obj_align, and nothing is changing.

Can you get the example gui working?
When I get home I’ll create a project for 3.2 etc. My GitHub example is 3.1.6.
In the meantime you can try to strip the code down to just the switch create and the align. I wonder if you need the call back function.

The GitHub project works fine on 3.1.6, but updating it to 3.2.0 seems to cause the issue. Should I just go back to the 3.1.6 kernel?

If you’re working on the GUI it might be a good idea for now to use 3.1.6.
Also, maybe @Hotel or @theol0403 can comment on issues upgrading to LVGL 5.3.

Hmm, that’s a shame. I think I’m just going to use 3.2.0 and hope that the issues get fixed soon. LVGL 5.1.0 doesn’t appear to have image buttons, and those are pretty vital to my program. Guess I’ll just have to make do.

I was able to update my example v5gui to pros 3.20. I only had to fix a typo that was in a LVGL constant to get it to work. The project is pushed to Github at the head of the same link.

I’m taking my dog for a walk now, if I have time I’ll try to replicate your code example.

I created a new project with “prosv5 c new .” Removed all code in existing functions. Added the code in your OP. It works just fine. The only difference I see is that I have my screen inverted. So, I un-inverted it (i.e. selected “normal”). And guess what. I see the same issue. No slider until I touch the screen.

edit 2:
So all of my LVGL test cases run fine with inverted screen. However, with normal screen, more often than not they show a blank until an active object gets touched. Try running in inverted screen mode see what happens.

1 Like

Forgive me for my ignorance, but how do you invert the screen? I can’t find it in the docs.

on the main brain menu select “settings” then “rotation”.

Oh, I thought you meant that LVGL let you invert the screen, my bad. Yeah, it seems to work now. That’s really odd, but thanks for sharing.

that is, indeed, incredibly odd. I’m not sure why that would be the case, nor am I sure how I’d even go about debugging it.

I’m tempted to just let the workaround stand on its own, until we can get LVGL decoupled from the kernel, which should make debugging stuff easier (as long as it’s not some weird vexOS interaction issue)


Yeah, I’m fine with that. The inversion workaround works just fine, and I’d rather you guys just spend time decoupling LVGL from the kernel than fixing an issue with an easy workaround.

1 Like

It’s some sort of PROS lvgl initialization issue, adding small delay fixes it.

void initialize() {
	// pros::lcd::initialize();
	// pros::lcd::set_text(1, "Hello PROS User!");
	// pros::lcd::register_btn1_cb(on_center_button);

exactly why the inverted screen changes the timing I’m not sure. I pulled the same code into my VEXcode LVGL project and it’s runs without issue in either case, no delay needed.