fix(display): Initialize display on queue as well.

This commit is contained in:
Peter Johanson 2022-01-24 14:34:48 -05:00 committed by Pete Johanson
parent 54aa3e6a1e
commit c4a47c08de

View file

@ -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;