LVGL config in VSCode ESP-IDF extension

This is probably more of an ESP-IDF question but asking here as it’s to do with configuring LVGL.

So I am using a Waveshare 7" ESP32-P4 development board which uses LVGL 9.2.2 and the drivers in the example they give. This all builds no problem and flashes etc so I know the environment is generally set up correctly. It’s using the esp-idf VScode extension which means there isn’t a need for an lv_conf.h in the example.

So I am now trying to use LVGL Pro to do some UX design and moving the example to running a generated UX through the tool.

However when compiling I get the following error

testing_gen.c:46:5: error: implicit declaration of function ‘lv_obj_set_name_static’; did you mean ‘lv_obj_set_state’? [-Wimplicit-function-declaration]
46 | lv_obj_set_name_static(lv_obj_0, “testing_#”);
| ^~~~~~~~~~~~~~~~~~~~~~
| lv_obj_set_state

So the call to lv_obj_set_name_static is in the LVGL Pro auto generated code from the XML so I clearly need to address this rather than edit the code.

from what I can determine it looks like I need to define

LV_USE_OBJ_ID=1

but I haven’t found a way to get this to work with the esp-idf extension.

I’ve tried to put an lv_conf.h in my build but that caused issues with error saying the header file didn’t exist, which it clearly does, so I’ve gone back to trying to work out how to define this separately.

I’ve tried idf_build_set_property(COMPILE_OPTIONS “-DLV_USE_OBJ_ID=1” APPEND) in the top level CMakeLists.txt but that hasn’t helped, I’ve tried defining it in a number of other places too but no joy as yet.

Am I trying to take this the wrong way entirely? I’m clearly missing something.

Thanks

Pete

OK so a little update, it seems I needed at least LVGL 9.3.0 for that function. So I’ve updated to 9.4.0 and now I’m seeing the compile work fine.

However, it seems I just get a white screen when calling the init function of the LVGL Pro generated UX. The demos work, but the LVGL Pro UX doesn’t for some reason.

Hi @petestewardson

Yes, LVGL Pro supports the latest version of LVGL, so upgrading to v9.4 was a good idea

A white screen might indicate that the screen you created is not being loaded. Could you try creating a loading the screen you created via xml?

It would also help if you could share a snippet of code about how you’re loading the ui project and the internals of the initialization function you called

EDIT:

I just clarified internally, the generated code doesn’t load the screens automatically, the user must load it after it’s created. See the documentation here: Using the Exported C Code - LVGL 9.5 documentation

Note that “init” function creates only the permanent screens but doesn’t load any screens. However, this can be done easily by calling lv_screen_load(screen1).

1 Like

Ah perfect, thanks for your help that was exactly the issue. I’d completely missed that bit in the documentation and I’d supposedly read it 2 or 3 times :slight_smile:

All working perfectly now.

1 Like