feat(display): Add optional full refresh timer.
* Useful for EPD that ghost after several partial updates. Only a temporary fix, tracking number of partial updates and triggering full refreshes based on that would be better.
This commit is contained in:
parent
e780a61671
commit
310ff449d8
2 changed files with 25 additions and 0 deletions
|
@ -176,6 +176,13 @@ choice ZMK_LV_FONT_DEFAULT_SMALL
|
|||
select LV_FONT_UNSCII_16
|
||||
endchoice
|
||||
|
||||
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
|
||||
|
|
|
@ -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() { k_work_submit_to_queue(zmk_display_work_q(), &display_tick_work); }
|
||||
|
||||
K_TIMER_DEFINE(display_timer, display_timer_cb, NULL);
|
||||
|
@ -57,6 +68,10 @@ K_TIMER_DEFINE(display_timer, display_timer_cb, NULL);
|
|||
void unblank_display_cb(struct k_work *work) {
|
||||
display_blanking_off(display);
|
||||
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)
|
||||
|
@ -64,6 +79,9 @@ void unblank_display_cb(struct k_work *work) {
|
|||
void blank_display_cb(struct k_work *work) {
|
||||
k_timer_stop(&display_timer);
|
||||
display_blanking_on(display);
|
||||
#if CONFIG_ZMK_DISPLAY_FULL_REFRESH_PERIOD > 0
|
||||
k_timer_stop(&full_refresh_timer);
|
||||
#endif
|
||||
}
|
||||
K_WORK_DEFINE(blank_display_work, blank_display_cb);
|
||||
K_WORK_DEFINE(unblank_display_work, unblank_display_cb);
|
||||
|
|
Loading…
Add table
Reference in a new issue