fix(display): Tweak init state to avoid race.
* Move "initialized" state early, to avoid race condition causing listener events to get lost during startup sequence.
This commit is contained in:
parent
8c863ef205
commit
ee54632140
1 changed files with 6 additions and 2 deletions
|
@ -73,6 +73,8 @@ static void start_display_updates() {
|
|||
k_timer_start(&display_timer, K_MSEC(TICK_MS), K_MSEC(TICK_MS));
|
||||
}
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_DISPLAY_BLANK_ON_IDLE)
|
||||
|
||||
static void stop_display_updates() {
|
||||
if (display == NULL) {
|
||||
return;
|
||||
|
@ -83,6 +85,8 @@ static void stop_display_updates() {
|
|||
k_timer_stop(&display_timer);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int zmk_display_is_initialized() { return initialized; }
|
||||
|
||||
void initialize_display(struct k_work *work) {
|
||||
|
@ -94,6 +98,8 @@ void initialize_display(struct k_work *work) {
|
|||
return;
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
|
||||
screen = zmk_display_status_screen();
|
||||
|
||||
if (screen == NULL) {
|
||||
|
@ -104,8 +110,6 @@ void initialize_display(struct k_work *work) {
|
|||
lv_scr_load(screen);
|
||||
|
||||
start_display_updates();
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
K_WORK_DEFINE(init_work, initialize_display);
|
||||
|
|
Loading…
Add table
Reference in a new issue