본문 바로가기
IT/Platform

[아두이노] ESP32-2423: #2 PlatformIO & LVGL

by 블랙오닉스 2024. 11. 24.

2024.11.24

LVGL 테스트 ->  3_4-5_LVGL_Arduino의 내용을 현재 *.ino 에 복붙 했다.

platformio.ini에도 라이브러리 추가

lib_deps =
monitor_speed = 115200

빌드 -> lv_demo_widgets이 없다고 에러

lv_conf_template.h를 lv_conf.h로 복사하고 수정

#if 1 /*Set it to "1" to enable content*/

/*===================
 * DEMO USAGE
 ====================*/

/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1

컴파일 통과 -> 링크 에러

C:/Users/user/Documents/PlatformIO/Projects/241123-221553-esp32dev/src/3_4_TFT_Rainbow.ino:369: undefined reference to `lv_demo_widgets'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1

데모 라이브러리 확인

데모 팩토리 샘플에 lv_conf.h를 복사 -> 같은 에러

LVGL의 demo와 src가 같은 레벨이라 위치를 못찾는 것 같다.

데모의 readme를 열어보니 

3. If your development environment or toolchain does not add source files inside '***lvgl***' folder automatically, ensure the `demos` folder is included for compilation.
4. Include "***demos/lv_demos.h***" in your application source file, for example:

 

->

build_flags = -I"C:\Users\user\Documents\PlatformIO\Projects\241123-221553-esp32dev\.pio\libdeps\esp32dev\lvgl\demos"

안된다.


그냥 데모 말고 버튼 해보니 된다.

#if 1
 
//    lv_obj_t *label = lv_label_create( lv_scr_act() );
//    lv_label_set_text( label, LVGL_Arduino.c_str() );
//    lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
     lv_example_btn();
#else
    // uncomment one of these demos
    lv_demo_widgets();            // OK
    // lv_demo_benchmark();          // OK
    // lv_demo_keypad_encoder();     // works, but I haven't an encoder
    // lv_demo_music();              // NOK
    // lv_demo_printer();
    // lv_demo_stress();             // seems to be OK
#endif

build_src_filter = +<*> +<C:\Users\user\Documents\PlatformIO\Projects\241123-221553-esp32dev\.pio\libdeps\esp32dev\lvgl\demos>

 데모 디렉토리 소스를 컴파일하도록 하여 해결됨

 

"lvgl demo platformio"로 구글링

상대 path로 먼저 시도 했는데 안되는 것 같음

build_flags = -DLV_USE_DEMO_WIDGETS

도 추가함