Pioarduino will not "see" lvgl.h

It’s been an adventure…

I finally deleted everything and re-installed everything from scratch. No other projects show up in explorer (I didn’t want anything to cause any issues, and there have been many…).

I’ve got the one main.cpp file. lvgl in installed, and lvgl.h is included in the main.cpp. lv_conf.h has been modified from the template, with very few changes (first is the “enable this code” at the top of the file)

But when I compile, it throws out many errors related to lvgl. One of them says that “lvgl_conf.h” is probably not included. (but it is) Now the main error is ‘lv_display_t’ does not name a type; did you mean ‘lv_area_t’?

Now, in the main code, the only reference to lvgl besides the lvgl include is *lv_display_t disp; and it’s underlined in red, the co-pilot says it’s undefined. It also indicates that lvgl.h is not included, (but it is). I tried to add lv_obj_t as a test, and same thing, underlined in red, indicating lvgl is not being “seen”.

I’ve seen this issue multiple times (and never fixed) while trying to get this working again.

For whatever reason, pioarduino simply will not “see” lvgl.

devin at pioarduino has no answer or suggestions. I search the internet and not a lot comes up, but I think I saw something about a bug that causes this. I can’t find much at the moment, I’ve been working for days on this, deleting, installing, uninstalling, re-installing… now I’ve got a clean install, and it still shows up.

I thought it was related to the board def file but I’ve tried a couple different ones and no change. Moving/copying lv_conf.h and lvgl.h to the includes directory doesn’t help either.

Some time yesterday, I could use platformio co-pilot and add all the headers it suggested, but it’s the same headers that are included in the lvgl.h file.

So, I can include the same headers and the code (might) compile (no red underlines anyway). For some reason, lvgl.h just will not get used. There doesn’t seem to be a problem with any other of the libraries, just lvgl.

Any suggestions?

Here’'s the platformio.ini file: (The “-D RV” flag is used to chose which Shelly energy monitor I talk to, the one at home or the one in the RV. And the lvgl library IS in the paths.

[env:esp32-s3-devkitc-1-myboard]
platform = espressif32 @ 6.12.0
board = esp32-s3-devkitm-1
framework = arduino
monitor_speed = 115200
board_build.partitions = huge_app.csv
board_build.f_cpu = 240000000L
build_flags =
-D LV_CONF_INCLUDE_SIMPLE
-D RV
-I include
-mfix-esp32-psram-cache-issue
lib_deps =
lvgl/lvgl@^9.5.0
lovyan03/LovyanGFX@^1.2.20
tamctec/TAMC_GT911@^1.0.2
adafruit/Adafruit GFX Library@^1.12.6
maxpromer/PCA9557-arduino@^1.0.0
bblanchon/ArduinoJson@^7.2.2

It’s dirty, but if I copy the contents of the lvgl.h file, into an new file (my_lvgl.h) and put it in the include directory, and include that in my headers, it (seems to) works.

(but now I get a million errors about lvgl and lovyan color definitions colliding…) but that’s a different issue.

Actually I think that’s part of the same problem. The definitions are the same, so I think the compiler should be choosing one file over the other, but because “something” in the lvgl library isn’t also being seen, it doesn’t know so it’s seeing those two files as separate includes, and trying to use them both when it should know to use one over the other.

Sorry, I’m not able to solve your problem but I want to give you some adivces.

The platformio.ini is very sensitive to indentation. Maybe it’s just a display thing and your indentation is correct. Please post your platformio.ini as pre-formatted text. This will keep the indentation correct and such errors can be excluded by reviewers of your platformio.ini.

Remove the build flag -mfix-esp32-psram-cache-issue! This is only necessary for ESP32 (not the S3!) when PSRAM is used. Your configuration doesn’t even use PSRAM.

Also remove the build-flag -I include. The include directory is automatically included when searching for header files. There is no need to specify this explicitly - See build_flags — PlatformIO latest documentation

Keep things as simple as possible. Create a small, minimal project that allows you to reproduce the error and focus exclusively on it. Also, reduce the platformio.ini file to the bare essentials.

Thanks for looking at it anyway.

I removed the reference to PSRAM.
The include flag was added only as a way to try and force it to see the lvgl.h.

This is the whole ini file.

This was a working project, so it’s not like I just threw a bunch of stuff together and expected it to work. I only removed almost all the code except for a few lovyan and lvgl statements. Maybe, just maybe, if I can find where the statement that chooses those libraries to use, I can add that to my include (like I did with lvgl.h → my_lvgl.h), but I could end up with more errors.

I’ll probably revert back to the older platformio and arduino libraries for this project. When I got here, all I had to do was change the address of the Shelly Energy Meter. Everything was working on a different meter (it’s only an http.GET(); change, no code). I’ve spent a week messing with it, with no luck, so probably revert.

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32-s3-devkitc-1-myboard]
platform = espressif32 @ 6.12.0
board = esp32-s3-devkitm-1
framework = arduino
monitor_speed = 115200
board_build.partitions = huge_app.csv
board_build.f_cpu = 240000000L
build_flags = 
	-D LV_CONF_INCLUDE_SIMPLE
	-D RV
	-Isrc/
lib_deps = 
	lvgl/lvgl@^9.5.0
	lovyan03/LovyanGFX@^1.2.20
	tamctec/TAMC_GT911@^1.0.2
	adafruit/Adafruit GFX Library@^1.12.6
	maxpromer/PCA9557-arduino@^1.0.0
	bblanchon/ArduinoJson@^7.2.2