From 3590ed454d95866133722a16e4eb411df74a0d01 Mon Sep 17 00:00:00 2001 From: ackPeng <1143590135@qq.com> Date: Tue, 7 Jan 2025 15:45:53 +0800 Subject: [PATCH] lvgl 9 some detail added --- .github/workflows/run-cl-arduino.yml | 102 ++++++++++++++++++ examples/HardwareTest/HardwareTest.ino | 5 +- examples/HardwareTest/lv_hardware_test.h | 2 + examples/LvglBenchmark/LvglBenchmark.ino | 7 +- .../TFT_eSPI_GifPlayer/TFT_eSPI_GifPlayer.ino | 6 +- src/lv_xiao_round_screen.h | 3 +- 6 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/run-cl-arduino.yml diff --git a/.github/workflows/run-cl-arduino.yml b/.github/workflows/run-cl-arduino.yml new file mode 100644 index 0000000..9fba1a1 --- /dev/null +++ b/.github/workflows/run-cl-arduino.yml @@ -0,0 +1,102 @@ +name: Run Ci Arduino + +on: + push: + pull_request: + repository_dispatch: + types: [trigger-workflow] + +jobs: + ci-arduino: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Checkout script repository + uses: actions/checkout@v4 + with: + repository: Seeed-Studio/ci-arduino + path: ci + + + - name: Setup arduino cli + uses: arduino/setup-arduino-cli@v2.0.0 + + - name: Create a depend.list file + run: | + # eg: echo "" >> depend.list + # echo "lvgl/lvgl" >> depend.list + # echo "lvgl/lv_demos" >> depend.list + echo "Bodmer/TFT_eSPI" >> depend.list + echo "moononournation/Arduino_GFX" >> depend.list + echo "tanakamasayuki/I2C_BM8563" >> depend.list + echo "arduino-libraries/SD" >> depend.list + echo "bitbank2/AnimatedGIF" >> depend.list + + + + - name: Create a ignore.list file + run: | + # eg: echo "," >> ignore.list + + # seeed_XIAO_m0 RAM and flash is too small + echo "HardwareTest,Seeeduino:samd:seeed_XIAO_m0" >> ignore.list + echo "LvglBenchmark,Seeeduino:samd:seeed_XIAO_m0" >> ignore.list + echo "TFT_Clock,Seeeduino:samd:seeed_XIAO_m0" >> ignore.list + + # XIAO_RA4M1 RAM and flash is too small + echo "HardwareTest,Seeeduino:renesas_uno:XIAO_RA4M1" >> ignore.list + echo "LvglBenchmark,Seeeduino:renesas_uno:XIAO_RA4M1" >> ignore.list + echo "TFT_eSPI_GifPlayer,Seeeduino:renesas_uno:XIAO_RA4M1" >> ignore.list + + # TFT_eSPI not support XIAO_ESP32C6 + echo "HardwareTest,esp32:esp32:XIAO_ESP32C6" >> ignore.list + echo "LvglBenchmark,esp32:esp32:XIAO_ESP32C6" >> ignore.list + echo "TFT_Clock,esp32:esp32:XIAO_ESP32C6" >> ignore.list + echo "TFT_eSPI_Clock,esp32:esp32:XIAO_ESP32C6" >> ignore.list + echo "TFT_eSPI_GifPlayer,esp32:esp32:XIAO_ESP32C6" >> ignore.list + + # AnimatedGIF not support XIAO_RP2040 + echo "TFT_eSPI_GifPlayer,rp2040:rp2040:seeed_xiao_rp2350" >> ignore.list + + - name: Install lvgl + run: | + mkdir -p /home/runner/Arduino/libraries + git clone --depth 1 https://github.com/lvgl/lvgl /home/runner/Arduino/libraries/lvgl + cp -r /home/runner/Arduino/libraries/lvgl/lv_conf_template.h /home/runner/Arduino/libraries/lv_conf.h + sed -i 's/#if 0/#if 1/' /home/runner/Arduino/libraries/lv_conf.h + sed -i 's/#define LV_USE_DEMO_WIDGETS 0/#define LV_USE_DEMO_WIDGETS 1/' /home/runner/Arduino/libraries/lv_conf.h + sed -i 's/#define LV_USE_DEMO_BENCHMARK 0/#define LV_USE_DEMO_BENCHMARK 1/' /home/runner/Arduino/libraries/lv_conf.h + sed -i 's/#define LV_FONT_MONTSERRAT_26 0/#define LV_FONT_MONTSERRAT_26 1/' /home/runner/Arduino/libraries/lv_conf.h + sed -i 's/#define LV_FONT_MONTSERRAT_14 0/#define LV_FONT_MONTSERRAT_14 1/' /home/runner/Arduino/libraries/lv_conf.h + sed -i 's/#define LV_FONT_MONTSERRAT_20 0/#define LV_FONT_MONTSERRAT_20 1/' /home/runner/Arduino/libraries/lv_conf.h + sed -i 's/#define LV_FONT_MONTSERRAT_24 0/#define LV_FONT_MONTSERRAT_24 1/' /home/runner/Arduino/libraries/lv_conf.h + + ln -s /home/runner/Arduino/libraries/lvgl/demos /home/runner/Arduino/libraries/lvgl/src/demos + + + + # git clone --depth 1 https://github.com/lvgl/lv_demos.git /home/runner/Arduino/libraries/lv_demos + # cp -r /home/runner/Arduino/libraries/lv_demos/lv_demo_conf_template.h /home/runner/Arduino/libraries/lv_demo_conf.h + # sed -i 's/#if 0/#if 1/' /home/runner/Arduino/libraries/lv_demo_conf.h + + + + - name: Build sketch + run: | + ./ci/tools/compile.sh + + - name: Build result + run: | + cat build.log + if [ ${{ github.event_name }} == 'pull_request' ] && [ -f compile.failed ]; then + exit 1 + fi + + - name: Generate issue + if: ${{ github.event_name != 'pull_request' }} + run: ./ci/tools/issue.sh + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/examples/HardwareTest/HardwareTest.ino b/examples/HardwareTest/HardwareTest.ino index 29dc649..986caae 100644 --- a/examples/HardwareTest/HardwareTest.ino +++ b/examples/HardwareTest/HardwareTest.ino @@ -13,7 +13,10 @@ void setup() Serial.println( "XIAO round screen - LVGL_Arduino" ); lv_init(); - + #if LVGL_VERSION_MAJOR == 9 + lv_tick_set_cb(millis); + #endif + lv_xiao_disp_init(); lv_xiao_touch_init(); diff --git a/examples/HardwareTest/lv_hardware_test.h b/examples/HardwareTest/lv_hardware_test.h index e936bbe..ed2ebb6 100644 --- a/examples/HardwareTest/lv_hardware_test.h +++ b/examples/HardwareTest/lv_hardware_test.h @@ -1,7 +1,9 @@ #include #include "I2C_BM8563.h" +#include +#include #define NUM_ADC_SAMPLE 20 #define RP2040_VREF 3300 // The actual voltage on 3V3 pin. (unit: mV) static lv_obj_t *slider_label; diff --git a/examples/LvglBenchmark/LvglBenchmark.ino b/examples/LvglBenchmark/LvglBenchmark.ino index 0be516b..28d73de 100644 --- a/examples/LvglBenchmark/LvglBenchmark.ino +++ b/examples/LvglBenchmark/LvglBenchmark.ino @@ -1,6 +1,5 @@ #include -#include - +#include // uncomment a library for display driver #define USE_TFT_ESPI_LIBRARY // #define USE_ARDUINO_GFX_LIBRARY @@ -14,6 +13,10 @@ void setup() lv_init(); + #if LVGL_VERSION_MAJOR == 9 + lv_tick_set_cb(millis); + #endif + lv_xiao_disp_init(); lv_xiao_touch_init(); diff --git a/examples/TFT_eSPI_GifPlayer/TFT_eSPI_GifPlayer.ino b/examples/TFT_eSPI_GifPlayer/TFT_eSPI_GifPlayer.ino index 94ad62d..77b55e2 100644 --- a/examples/TFT_eSPI_GifPlayer/TFT_eSPI_GifPlayer.ino +++ b/examples/TFT_eSPI_GifPlayer/TFT_eSPI_GifPlayer.ino @@ -1,8 +1,12 @@ #include +#include #include #include #include +#ifdef ARDUINO_ARCH_RP2350 +#undef PICO_BUILD +#endif #include "AnimatedGIF.h" AnimatedGIF gif; @@ -215,7 +219,7 @@ int getGifInventory( const char* basePath ) while( file ) { if(!file.isDirectory()) { - GifFiles.push_back( file.name() ); + GifFiles.push_back(std::string(file.name())); amount++; tft.drawString(String(amount), textPosX, textPosY ); file.close(); diff --git a/src/lv_xiao_round_screen.h b/src/lv_xiao_round_screen.h index a5b89b0..616dcdf 100644 --- a/src/lv_xiao_round_screen.h +++ b/src/lv_xiao_round_screen.h @@ -102,7 +102,8 @@ void lv_xiao_disp_init(void) xiao_disp_init(); #if LVGL_VERSION_MAJOR == 9 - static uint8_t draw_buf[ SCREEN_WIDTH * LVGL_BUFF_SIZE * LV_COLOR_DEPTH / 8 ]; + // static uint8_t draw_buf[ SCREEN_WIDTH * LVGL_BUFF_SIZE * LV_COLOR_DEPTH / 8 ]; + static uint32_t draw_buf[ SCREEN_WIDTH * LVGL_BUFF_SIZE * LV_COLOR_DEPTH / 8 / 4 ]; lv_display_t * disp = lv_display_create(SCREEN_WIDTH, SCREEN_HEIGHT); lv_display_set_flush_cb(disp, xiao_disp_flush); lv_display_set_buffers(disp, (void*)draw_buf, NULL, sizeof(draw_buf), LV_DISPLAY_RENDER_MODE_PARTIAL);