From c5bfcd5059cec56623ae380a5159ed532506307c Mon Sep 17 00:00:00 2001 From: Liu Zhongwei Date: Fri, 12 Apr 2024 13:03:22 +0800 Subject: [PATCH] fix(display): rgb_lcd_8bit build error --- .../display/lcd/rgb_lcd_8bit/main/lvgl_port.c | 19 +++++++++++++++---- .../sdkconfig.ci.avoid_tear_mode1 | 2 +- .../sdkconfig.ci.avoid_tear_mode2 | 2 +- .../sdkconfig.ci.avoid_tear_mode3 | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/examples/display/lcd/rgb_lcd_8bit/main/lvgl_port.c b/examples/display/lcd/rgb_lcd_8bit/main/lvgl_port.c index 36970f855..5c40aee5f 100644 --- a/examples/display/lcd/rgb_lcd_8bit/main/lvgl_port.c +++ b/examples/display/lcd/rgb_lcd_8bit/main/lvgl_port.c @@ -19,6 +19,7 @@ typedef struct { esp_lcd_panel_handle_t lcd_handle; esp_lcd_touch_handle_t tp_handle; + bool is_init; } lvgl_port_task_param_t; static const char *TAG = "lv_port"; @@ -328,8 +329,11 @@ void flush_callback(lv_display_t *disp, const lv_area_t *area, uint8_t *color_p) /* Switch the current RGB frame buffer to `next_fb` */ esp_lcd_panel_draw_bitmap(panel_handle, offsetx1, offsety1, offsetx2 + 1, offsety2 + 1, next_fb); #else - disp->draw_buf->buf1 = color_p; - disp->draw_buf->buf2 = lvgl_port_flush_next_buf; + if (disp->buf_act == disp->buf_1) { + disp->buf_2->data = lvgl_port_flush_next_buf; + } else { + disp->buf_1->data = lvgl_port_flush_next_buf; + } lvgl_port_flush_next_buf = color_p; /* Switch the current RGB frame buffer to `color_p` */ @@ -498,6 +502,8 @@ static void lvgl_port_task(void *arg) #endif } + param->is_init = true; + uint32_t task_delay_ms = LVGL_PORT_TASK_MAX_DELAY_MS; while (1) { if (lvgl_port_lock(-1)) { @@ -515,9 +521,10 @@ static void lvgl_port_task(void *arg) esp_err_t lvgl_port_init(esp_lcd_panel_handle_t lcd_handle, esp_lcd_touch_handle_t tp_handle) { - lvgl_port_task_param_t param = { + lvgl_port_task_param_t lvgl_task_param = { .lcd_handle = lcd_handle, .tp_handle = tp_handle, + .is_init = false }; lvgl_mux = xSemaphoreCreateRecursiveMutex(); @@ -525,13 +532,17 @@ esp_err_t lvgl_port_init(esp_lcd_panel_handle_t lcd_handle, esp_lcd_touch_handle ESP_LOGI(TAG, "Create LVGL task"); BaseType_t core_id = (LVGL_PORT_TASK_CORE < 0) ? tskNO_AFFINITY : LVGL_PORT_TASK_CORE; - BaseType_t ret = xTaskCreatePinnedToCore(lvgl_port_task, "lvgl", LVGL_PORT_TASK_STACK_SIZE, ¶m, + BaseType_t ret = xTaskCreatePinnedToCore(lvgl_port_task, "lvgl", LVGL_PORT_TASK_STACK_SIZE, &lvgl_task_param, LVGL_PORT_TASK_PRIORITY, &lvgl_task_handle, core_id); if (ret != pdPASS) { ESP_LOGE(TAG, "Failed to create LVGL task"); return ESP_FAIL; } + while (!lvgl_task_param.is_init) { + vTaskDelay(pdMS_TO_TICKS(10)); + } + return ESP_OK; } diff --git a/examples/display/lcd/rgb_lcd_8bit/sdkconfig.ci.avoid_tear_mode1 b/examples/display/lcd/rgb_lcd_8bit/sdkconfig.ci.avoid_tear_mode1 index a6386af3a..cd41684e5 100644 --- a/examples/display/lcd/rgb_lcd_8bit/sdkconfig.ci.avoid_tear_mode1 +++ b/examples/display/lcd/rgb_lcd_8bit/sdkconfig.ci.avoid_tear_mode1 @@ -1,3 +1,3 @@ -CONFIG_EXAMPLE_LVGL_AVOID_TEAR=y +CONFIG_EXAMPLE_LVGL_PORT_AVOID_TEAR_ENABLE=y CONFIG_EXAMPLE_LVGL_PORT_AVOID_TEAR_MODE_1=y CONFIG_EXAMPLE_LVGL_PORT_AVOID_TEAR_MODE=1 diff --git a/examples/display/lcd/rgb_lcd_8bit/sdkconfig.ci.avoid_tear_mode2 b/examples/display/lcd/rgb_lcd_8bit/sdkconfig.ci.avoid_tear_mode2 index 05be1a7c4..75c8be190 100644 --- a/examples/display/lcd/rgb_lcd_8bit/sdkconfig.ci.avoid_tear_mode2 +++ b/examples/display/lcd/rgb_lcd_8bit/sdkconfig.ci.avoid_tear_mode2 @@ -1,3 +1,3 @@ -CONFIG_EXAMPLE_LVGL_AVOID_TEAR=y +CONFIG_EXAMPLE_LVGL_PORT_AVOID_TEAR_ENABLE=y CONFIG_EXAMPLE_LVGL_PORT_AVOID_TEAR_MODE_2=y CONFIG_EXAMPLE_LVGL_PORT_AVOID_TEAR_MODE=2 diff --git a/examples/display/lcd/rgb_lcd_8bit/sdkconfig.ci.avoid_tear_mode3 b/examples/display/lcd/rgb_lcd_8bit/sdkconfig.ci.avoid_tear_mode3 index 69bbc9b07..450a8ed12 100644 --- a/examples/display/lcd/rgb_lcd_8bit/sdkconfig.ci.avoid_tear_mode3 +++ b/examples/display/lcd/rgb_lcd_8bit/sdkconfig.ci.avoid_tear_mode3 @@ -1,3 +1,3 @@ -CONFIG_EXAMPLE_LVGL_AVOID_TEAR=y +CONFIG_EXAMPLE_LVGL_PORT_AVOID_TEAR_ENABLE=y CONFIG_EXAMPLE_LVGL_PORT_AVOID_TEAR_MODE_3=y CONFIG_EXAMPLE_LVGL_PORT_AVOID_TEAR_MODE=3