From c4a47c08def72ae0b096e949f4388e5a539187b6 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Mon, 24 Jan 2022 14:34:48 -0500 Subject: [PATCH] fix(display): Initialize display on queue as well. --- app/src/display/main.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/app/src/display/main.c b/app/src/display/main.c index 5dfad910..79a054a7 100644 --- a/app/src/display/main.c +++ b/app/src/display/main.c @@ -85,26 +85,20 @@ static void stop_display_updates() { int zmk_display_is_initialized() { return initialized; } -int zmk_display_init() { +void initialize_display(struct k_work *work) { LOG_DBG(""); display = device_get_binding(ZMK_DISPLAY_NAME); if (display == NULL) { LOG_ERR("Failed to find display device"); - return -EINVAL; + return; } -#if IS_ENABLED(CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED) - k_work_queue_start(&display_work_q, display_work_stack_area, - K_THREAD_STACK_SIZEOF(display_work_stack_area), - CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_PRIORITY, NULL); -#endif - screen = zmk_display_status_screen(); if (screen == NULL) { LOG_ERR("No status screen provided"); - return 0; + return; } lv_scr_load(screen); @@ -112,6 +106,20 @@ int zmk_display_init() { start_display_updates(); initialized = true; +} + +K_WORK_DEFINE(init_work, initialize_display); + +int zmk_display_init() { + LOG_DBG(""); + +#if IS_ENABLED(CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED) + k_work_queue_start(&display_work_q, display_work_stack_area, + K_THREAD_STACK_SIZEOF(display_work_stack_area), + CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_PRIORITY, NULL); +#endif + + k_work_submit_to_queue(zmk_display_work_q(), &init_work); LOG_DBG(""); return 0;