diff --git a/main/lcd/ui.c b/main/lcd/ui.c index f0aab58..2ea70b9 100644 --- a/main/lcd/ui.c +++ b/main/lcd/ui.c @@ -17,13 +17,17 @@ ui_view_t ui_current_view(void){ return current_view; } -static void ui_toggle_view_event_cb(lv_event_t *event){ - if(lv_event_get_code(event) != LV_EVENT_CLICKED) return; - +static void ui_toggle_view_async_cb(void *param){ + (void)param; if(current_view == UI_VIEW_IMAGE_BROWSER) ui_build_log_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){ lv_obj_add_flag(object, LV_OBJ_FLAG_CLICKABLE); 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(); lvgl_port_unlock(); - ui_log_append("Boot UI ready"); ESP_LOGI(TAG, "Log UI created"); ui_log_append("Log UI created"); }