This commit is contained in:
Pete Johanson 2023-03-27 12:27:19 +11:00 committed by GitHub
commit 5deada6aa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View file

@ -75,6 +75,13 @@ endchoice
endif # ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN
config ZMK_DISPLAY_FULL_REFRESH_PERIOD
int "(Optional) Period to issue a full refresh to the display (in seconds)"
default 0
help
Period in seconds for how often to completely refresh/redraw the whole screen.
Most useful for e-ink/EPD displays that require occasional full redraws.
rsource "widgets/Kconfig"
endif

View file

@ -50,6 +50,17 @@ struct k_work_q *zmk_display_work_q() {
#endif
}
#if CONFIG_ZMK_DISPLAY_FULL_REFRESH_PERIOD > 0
void full_refresh_work_cb(struct k_work *work) { lv_obj_invalidate(lv_scr_act()); }
K_WORK_DEFINE(full_refresh_work, full_refresh_work_cb);
void full_refresh_timer_cb() { k_work_submit_to_queue(zmk_display_work_q(), &full_refresh_work); }
K_TIMER_DEFINE(full_refresh_timer, full_refresh_timer_cb, NULL);
#endif
void display_timer_cb() {
lv_tick_inc(TICK_MS);
k_work_submit_to_queue(zmk_display_work_q(), &display_tick_work);
@ -71,6 +82,10 @@ static void start_display_updates() {
k_work_submit_to_queue(zmk_display_work_q(), &unblank_display_work);
k_timer_start(&display_timer, K_MSEC(TICK_MS), K_MSEC(TICK_MS));
#if CONFIG_ZMK_DISPLAY_FULL_REFRESH_PERIOD > 0
k_timer_start(&full_refresh_timer, K_SECONDS(CONFIG_ZMK_DISPLAY_FULL_REFRESH_PERIOD),
K_SECONDS(CONFIG_ZMK_DISPLAY_FULL_REFRESH_PERIOD));
#endif
}
#if IS_ENABLED(CONFIG_ZMK_DISPLAY_BLANK_ON_IDLE)
@ -83,6 +98,9 @@ static void stop_display_updates() {
k_work_submit_to_queue(zmk_display_work_q(), &blank_display_work);
k_timer_stop(&display_timer);
#if CONFIG_ZMK_DISPLAY_FULL_REFRESH_PERIOD > 0
k_timer_stop(&full_refresh_timer);
#endif
}
#endif