splitted ui_toggle_view_event_cb into synced and asynced variant

This commit is contained in:
Timo Niemann
2026-07-01 15:29:52 +02:00
parent f428bef893
commit 1298347404
+7 -4
View File
@@ -17,13 +17,17 @@ ui_view_t ui_current_view(void){
return current_view; return current_view;
} }
static void ui_toggle_view_event_cb(lv_event_t *event){ static void ui_toggle_view_async_cb(void *param){
if(lv_event_get_code(event) != LV_EVENT_CLICKED) return; (void)param;
if(current_view == UI_VIEW_IMAGE_BROWSER) ui_build_log_view_locked(); if(current_view == UI_VIEW_IMAGE_BROWSER) ui_build_log_view_locked();
else ui_build_image_browser_view_locked(); else ui_build_image_browser_view_locked();
} }
static void ui_toggle_view_event_cb(lv_event_t *event){
if(lv_event_get_code(event) != LV_EVENT_CLICKED) return;
lv_async_call(ui_toggle_view_async_cb, NULL);
}
void ui_attach_toggle(lv_obj_t *object){ void ui_attach_toggle(lv_obj_t *object){
lv_obj_add_flag(object, LV_OBJ_FLAG_CLICKABLE); lv_obj_add_flag(object, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event_cb(object, ui_toggle_view_event_cb, LV_EVENT_CLICKED, NULL); lv_obj_add_event_cb(object, ui_toggle_view_event_cb, LV_EVENT_CLICKED, NULL);
@@ -55,7 +59,6 @@ void create_log_ui(void){
ui_build_log_view_locked(); ui_build_log_view_locked();
lvgl_port_unlock(); lvgl_port_unlock();
ui_log_append("Boot UI ready");
ESP_LOGI(TAG, "Log UI created"); ESP_LOGI(TAG, "Log UI created");
ui_log_append("Log UI created"); ui_log_append("Log UI created");
} }