I’m going through the CYD book, and I’m up to module 2.5. It compiles fine, but all the examples take ages to compile the first time. Taking module 2.5 Basic Slider it takes 8 minutes to just compile, if I then upload it to the CYD device it takes 2 minutes to compile and upload. If I compile a Nano board with a large program it only takes 55 secs. Is this normal? My pc is i5 intel with 16mb ram just for your info. Many thanks
Hi.
Yes. It’s normal.
When you compile one of those LVGL codes for the first time it will take a considerable amount of time.
The second time you compile, it will be faster.
If you prefer, you can use VS Code instead of Arduino IDE, which is usually faster.
Regards,
Sara
Hi Sara,
I have been trying all this time to get this running under Vscode PlatformIO. I have tried to follow the book regarding downloading a new lvgl.h file setup, and placing it in the right place, But I really don’t know the right place to do all of the changes. I seem somehow to have loaded the library lvgl but it seemed to have downloaded version 9.2.2.
Could you please possibly steer me in the right direction
If you want to use VS Code, we have this guide on our blog:
I hope this helps.
Regards,
Sara
OK , just had a problem installing LVGL library, Went to search for it and it came up with 29 possibles, so not knowing which to select I inserted the library into the platformio.ini file:
lib_deps =
https://github.com/PaulStoffregen/XPT2046_Touchscreen.git
bodmer/TFT_eSPI@^2.5.43
lvgl@9.2.0
I hope this was ok. it seemed to work with the hello world, button, toggle and slider program.
Also have tried 2_5 example, Basic Slider, this compiles ok in Arduino IDE using the same setup in VSCode that worked with the test program: hello world, button, toggle and slider program. comes with an error:
Start your code here
* Executing task in folder CYD_2_5_Basic_Slider: C:\Users\Richard\.platformio\penv\Scripts\platformio.exe run
Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
————————————————————————————————————–Verbose mode can be enabled via `-v, –verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.4.0+sha.a9b9d09) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
– framework-arduinoespressif32 @ 3.20011.230801 (2.0.11)
– tool-esptoolpy @ 1.40501.0 (4.5.1)
– toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 36 compatible libraries
Scanning dependencies…
Dependency Graph
|– XPT2046_Touchscreen @ 1.4.0+sha.f956c5d
|– TFT_eSPI @ 2.5.43
|– lvgl @ 9.2.0
Building in release mode
Compiling .pio\build\esp32dev\src\main.cpp.o
src/main.cpp: In function ‘void setup()’:
src/main.cpp:178:3: error: ‘ledcAttachChannel’ was not declared in this scope
ledcAttachChannel(CYD_LED_RED, freq, resolution, ledChannel);
^~~~~~~~~~~~~~~~~
src/main.cpp:178:3: note: suggested alternative: ‘ledcAttachPin’
ledcAttachChannel(CYD_LED_RED, freq, resolution, ledChannel);
^~~~~~~~~~~~~~~~~
ledcAttachPin
*** [.pio\build\esp32dev\src\main.cpp.o] Error 1
Is there any difference to the program which I copied from the Arduino IDE to VSCode?
that needs to change, ?
Hi.
So do I have to create the lv_conf.h file every new project? Yes!
That error is probably because you’re using an older version of the ESP32 boards.
Check the boards version you have installed in VS Code.
Regards,
Sara
I’m sorry.
I’m referring to the ESP32 installation on VS Code. The ESP32-Arduino core.
Not sure how to check what ESP32 core is installed on PlatformIO, The program compiles right to the end but still fails on
ledcAttachChannel(CYD_LED_RED, freq, resolution, ledChannel);
So I think I will return to Arduino IDE 2 at least it works.
Many thanks for your time and wish you both a Happy Christmas
Either way, for using the oldest version, you must replace:
ledcAttachChannel(CYD_LED_RED, freq, resolution, ledChannel);
with
ledcSetup(ledChannel, freq, resolution);
ledcAttachPin(CYD_LED_RED, ledChannel);
And then, when calling the ledcWrite(), you must pass as argument the ledChannel instead of the GPIO.
Instead of this:
ledcWrite(CYD_LED_RED, map((int)lv_slider_get_value(slider), 0, 100, 255, 0))
Use this:
ledcWrite(ledChannel , map((int)lv_slider_get_value(slider), 0, 100, 255, 0))
ALTERNATIVELY:
Edit your platformio.ini file with the platform as follows:
platform = espressif32@6.1.0 ;
After saving the platformio.ini file with this new setting, the original code should work without changes.
Let me know if this helps.
Regards,
Sara