refactor: improve watchdog handling and screen loading in UI and display handlers
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "ui/root_layout.h"
|
||||
#include "ui/app_registry.h"
|
||||
#include "esp_log.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
#define TAG "UIHandler"
|
||||
|
||||
@@ -45,8 +46,14 @@ esp_err_t UIHandler::init(void) {
|
||||
ESP_LOGW(TAG, "Failed to render app icons");
|
||||
}
|
||||
|
||||
// Load the main screen
|
||||
lv_screen_load(_main_screen);
|
||||
// Defer screen loading to prevent blocking during initialization
|
||||
// Use LVGL timer to load screen after allowing watchdog reset
|
||||
lv_timer_create([](lv_timer_t* timer) {
|
||||
lv_obj_t* screen = static_cast<lv_obj_t*>(lv_timer_get_user_data(timer));
|
||||
ESP_LOGI("UIHandler", "Loading main screen via timer");
|
||||
lv_screen_load(screen);
|
||||
lv_timer_del(timer);
|
||||
}, 100, _main_screen); // 100ms delay to allow watchdog reset
|
||||
|
||||
ESP_LOGI(TAG, "UIHandler initialized successfully");
|
||||
return ESP_OK;
|
||||
|
||||
Reference in New Issue
Block a user