feat(display): Blank on idle optionally.

* Add new defaulted-on Kconfig option to control if displays
  are blanked/unblanked on idle/activity.
This commit is contained in:
Peter Johanson 2022-04-25 22:07:21 -04:00 committed by Pete Johanson
parent e3efffa9a8
commit 90b45a1284
2 changed files with 7 additions and 2 deletions

View File

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

View File

@ -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) */