I’m trying to make a display of several screens (not much graphic intensive). i have created 2 tasks one for navigation and another for changing screens and dynamically updating labels.
What do you want to achieve?
I want to update labels/png/containers in my screen along with screens switching. but at certain screen the task_wdt triggers due to lv_timer_handler upon traceback there is some issue with label updating…
What have you tried so far?
I’ve Optimized the code to my best knowledge. Reduced the tasks working in parallel, applied mutex locks across any LVGL related activity still the error persists.
sharing a little snippet of the code.
Code to reproduce
E (57265) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
E (57265) task_wdt: - IDLE0 (CPU 0)
E (57265) task_wdt: Tasks currently running:
E (57265) task_wdt: CPU 0: LVGL
E (57265) task_wdt: CPU 1: IDLE1
E (57265) task_wdt: Print CPU 0 (current core) backtrace
Backtrace: 0x401124BF:0x3FFB10C0 0x401128DC:0x3FFB10E0 0x400834A1:0x3FFB1110 0x400EBCD7:0x3FFD6B20 0x400E8219:0x3FFD6C40 0x400E864C:0x3FFD6CC0 0x400EC0CD:0x3FFD6D60 0x400E976E:0x3FFD6D80 0x400E97B2:0x3FFD6DA0 0x400E97FD:0x3FFD6DC0 0x400E77E9:0x3FFD6DE0 0x400E7814:0x3FFD6E00 0x400E7896:0x3FFD6E20 0x400E85B5:0x3FFD6E40 0x400FB568:0x3FFD6E70 0x400FBBBA:0x3FFD6F30 0x40122FB9:0x3FFD6F80 0x400E1592:0x3FFD6FA0 0x400E1622:0x3FFD6FC0 0x400E5F60:0x3FFD7000 0x400E6265:0x3FFD7130 0x400E6016:0x3FFD7210 0x400
E6265:0x3FFD7340 0x400E6504:0x3FFD7420 0x400E6682:0x3FFD7440 0x400E682C:0x3FFD7470 0x400E6935:0x3FFD74B0 0x400E6AFB:0x3FFD74D0 0x400F1CC9:0x3FFD74F0 0x400F1D79:0x3FFD7510 0x400D6E25:0x3FFD7530 0x40087FF5:0x3FFD7550
--- 0x401124bf: task_wdt_timeout_handling at C:/ESP-IDF/esp-idf-v5.3.4/components/esp_system/task_wdt/task_wdt.c:434
--- 0x401128dc: task_wdt_isr at C:/ESP-IDF/esp-idf-v5.3.4/components/esp_system/task_wdt/task_wdt.c:507
--- 0x400834a1: _xt_lowint1 at C:/ESP-IDF/esp-idf-v5.3.4/components/xtensa/xtensa_vectors.S:1240
--- 0x400ebcd7: img_draw_core at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/draw/sw/lv_draw_sw_img.c:322
--- 0x400e8219: img_decode_and_draw at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/draw/lv_draw_image.c:285
--- 0x400e864c: lv_draw_image_normal_helper at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/draw/lv_draw_image.c:178
--- 0x400ec0cd: lv_draw_sw_image at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/draw/sw/lv_draw_sw_img.c:169
--- 0x400e976e: execute_drawing at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/draw/sw/lv_draw_sw.c:518
--- 0x400e97b2: execute_drawing_unit at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/draw/sw/lv_draw_sw.c:383
--- 0x400e97fd: dispatch at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/draw/sw/lv_draw_sw.c:463
--- 0x400e77e9: lv_draw_dispatch_layer at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/draw/lv_draw.c:276
--- 0x400e7814: lv_draw_dispatch at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/draw/lv_draw.c:182
--- 0x400e7896: lv_draw_finalize_task_creation at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/draw/lv_draw.c:147
--- 0x400e85b5: lv_draw_image at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/draw/lv_draw_image.c:122
--- 0x400fb568: draw_image at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/widgets/image/lv_image.c:794
--- 0x400fbbba: lv_image_event at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/widgets/image/lv_image.c:684
--- 0x40122fb9: lv_obj_event_base at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/core/lv_obj_event.c:89
--- 0x400e1592: event_send_core at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/core/lv_obj_event.c:364
--- 0x400e1622: lv_obj_send_event at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/core/lv_obj_event.c:67
--- 0x400e5f60: lv_obj_redraw at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/core/lv_refr.c:116
--- 0x400e6265: refr_obj at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/core/lv_refr.c:1032
--- 0x400e6016: lv_obj_redraw at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/core/lv_refr.c:167
--- 0x400e6265: refr_obj at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/core/lv_refr.c:1032
--- 0x400e6504: refr_obj_and_children at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/core/lv_refr.c:820
--- 0x400e6682: refr_area_part at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/core/lv_refr.c:753
--- 0x400e682c: refr_area at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/core/lv_refr.c:679
--- 0x400e6935: refr_invalid_areas at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/core/lv_refr.c:586
--- 0x400e6afb: lv_display_refr_timer at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/core/lv_refr.c:398
--- 0x400f1cc9: lv_timer_exec at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/misc/lv_timer.c:326
--- 0x400f1d79: lv_timer_handler at C:/ESP32/workspace/CDO_wall_station/components/lvgl/src/misc/lv_timer.c:107
--- 0x400d6e25: lvgl_port_task at C:/ESP32/workspace/CDO_wall_station/main/main.c:656
--- 0x40087ff5: vPortTaskWrapper at C:/ESP-IDF/esp-idf-v5.3.4/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139
lvgl port task inside main.c
static void lvgl_port_task(void *arg)
{
while (1) {
_lock_acquire(&lvgl_api_lock);
lv_timer_handler();
_lock_release(&lvgl_api_lock);
change_screen();
update_page();
vTaskDelay(pdMS_TO_TICKS(20));
}
vTaskDelete(NULL);
}
The menu labels are updating here and in change_page function the display is loading.
void update_page(){
if(current_page==ui_menu_screen){
ESP_LOGI("Screen Update", "Menu screen Updating");
lv_obj_set_style_text_color(ui_Label3, lv_color_hex(0x999999), LV_PART_MAIN);
lv_obj_set_style_text_color(ui_Label2, lv_color_hex(0x999999), LV_PART_MAIN);
lv_obj_set_style_text_color(ui_Label5, lv_color_hex(0x999999), LV_PART_MAIN);
// lv_obj_set_style_img_recolor(ui_Image2, lv_color_hex(0x6A758B), LV_STATE_DEFAULT);
// lv_obj_set_style_img_recolor(ui_Image4, lv_color_hex(0x6A758B), LV_STATE_DEFAULT);
// lv_obj_set_style_img_recolor(ui_Image5, lv_color_hex(0x6A758B), LV_STATE_DEFAULT);
switch (menu_nav) {
case 0:
// lv_obj_set_style_img_recolor(ui_Image2, lv_color_hex(0xB0C2E8), LV_STATE_DEFAULT);
lv_obj_set_style_text_color(ui_Label3, lv_color_hex(0xFFFFFF), LV_PART_MAIN);
lv_obj_set_pos(ui_Image1, -127, -51);
break;
case 1:
// lv_obj_set_style_img_recolor(ui_Image4, lv_color_hex(0xB0C2E8), LV_STATE_DEFAULT);
lv_obj_set_style_text_color(ui_Label2, lv_color_hex(0xFFFFFF), LV_PART_MAIN);
lv_obj_set_pos(ui_Image1, -127, 8);
break;
case 2:
// lv_obj_set_style_img_recolor(ui_Image5, lv_color_hex(0xB0C2E8), LV_STATE_DEFAULT);
lv_obj_set_style_text_color(ui_Label5, lv_color_hex(0xFFFFFF), LV_PART_MAIN);
lv_obj_set_pos(ui_Image1, -127, 62);
break;
}
ESP_LOGI("Screen Update", "After Menu screen updating");
}
}
void change_screen(){
_lock_acquire(&lvgl_api_lock);
if(current_page==ui_Screen1){ //starting screen should wait 2 secs
// vTaskDelay(pdMS_TO_TICKS(2000));
current_page=ui_home_screen;
} else if(current_page==ui_home_screen){
ESP_LOGI("Screen change","Screen 2 : home page");
lv_disp_load_scr(ui_home_screen);
}else if(current_page==ui_menu_screen){
pin_1=0,pin_2=0,pin_3=0,pin_4=0;
pin_col_val=0;
pin_Strval[0]='\0';
ESP_LOGI("Screen change","Screen 3 : menu page");
lv_disp_load_scr(ui_menu_screen);
start_buttons=1;
}else if(current_page==ui_menu_pin_screen){
lv_disp_load_scr(ui_menu_pin_screen);
}else if(current_page == ui_incorrect_pin){ //WRONG PIN PAGE
lv_disp_load_scr(ui_incorrect_pin);
pin_4=1;
pin_1=0,pin_2=0,pin_3=0,pin_4=0;
pin_col_val=0;
pin_Strval[0]='\0';
}else if(current_page==ui_correct_pin){
lv_disp_load_scr(ui_correct_pin);
lv_delay_ms(200);
current_page=ui_install_setup_screen;
pin_1=0,pin_2=0,pin_3=0,pin_4=0;
pin_col_val=0;
pin_Strval[0]='\0';
}
}
Screenshot and/or video
Environment
- MCU/MPU/Board: ESP32 Wrover E.
- LVGL version: v9.2.2
- IDE: Espressif IDE v3.1.0
- UI software: Squareline Studio v1.5.4