From ba6be3c3bbb827df471e22bf2ecc54112d3fd82c Mon Sep 17 00:00:00 2001 From: mutatrum Date: Thu, 12 Dec 2024 01:22:05 +0100 Subject: [PATCH] Fix lvgl without display (#574) --- main/display.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/main/display.c b/main/display.c index 54428517..1efdd945 100644 --- a/main/display.c +++ b/main/display.c @@ -109,18 +109,19 @@ esp_err_t display_init(void * pvParameters) lv_disp_t * disp = lvgl_port_add_disp(&disp_cfg); - if (lvgl_port_lock(0)) { - lv_style_init(&scr_style); - lv_style_set_text_font(&scr_style, &lv_font_portfolio_6x8); - lv_style_set_bg_opa(&scr_style, LV_OPA_COVER); + if (esp_lcd_panel_init_err == ESP_OK) { - lv_theme_set_apply_cb(&theme, theme_apply); + if (lvgl_port_lock(0)) { + lv_style_init(&scr_style); + lv_style_set_text_font(&scr_style, &lv_font_portfolio_6x8); + lv_style_set_bg_opa(&scr_style, LV_OPA_COVER); - lv_display_set_theme(disp, &theme); - lvgl_port_unlock(); - } + lv_theme_set_apply_cb(&theme, theme_apply); + + lv_display_set_theme(disp, &theme); + lvgl_port_unlock(); + } - if (esp_lcd_panel_init_err == ESP_OK) { // Only turn on the screen when it has been cleared ESP_RETURN_ON_ERROR(esp_lcd_panel_disp_on_off(panel_handle, true), TAG, "Panel display on failed");