From 585be4c53d2ee528243b5c4f12220601f21f91b1 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Mon, 25 Apr 2022 22:07:21 -0400 Subject: [PATCH] feat(display): Blank on idle optionally. * Add new defaulted-on Kconfig option to control if displays are blanked/unblanked on idle/activity. --- app/src/display/Kconfig | 4 ++++ app/src/display/main.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/display/Kconfig b/app/src/display/Kconfig index 8023025a..ee977556 100644 --- a/app/src/display/Kconfig +++ b/app/src/display/Kconfig @@ -11,6 +11,10 @@ menuconfig ZMK_DISPLAY if ZMK_DISPLAY +config ZMK_DISPLAY_BLANK_ON_IDLE + bool "Blank display on idle" + default y + choice LVGL_TXT_ENC default LVGL_TXT_ENC_UTF8 diff --git a/app/src/display/main.c b/app/src/display/main.c index 79a054a7..9de0ad7f 100644 --- a/app/src/display/main.c +++ b/app/src/display/main.c @@ -111,8 +111,6 @@ void initialize_display(struct k_work *work) { 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), @@ -125,6 +123,7 @@ int zmk_display_init() { return 0; } +#if IS_ENABLED(CONFIG_ZMK_DISPLAY_BLANK_ON_IDLE) int display_event_handler(const zmk_event_t *eh) { struct zmk_activity_state_changed *ev = as_zmk_activity_state_changed(eh); if (ev == NULL) { @@ -148,3 +147,5 @@ int display_event_handler(const zmk_event_t *eh) { ZMK_LISTENER(display, display_event_handler); ZMK_SUBSCRIPTION(display, zmk_activity_state_changed); + +#endif /* IS_ENABLED(CONFIG_ZMK_DISPLAY_BLANK_ON_IDLE) */ \ No newline at end of file