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
bc179b1030
commit
fefc31c14c
2 changed files with 25 additions and 0 deletions
|
@ -71,6 +71,13 @@ endchoice
|
||||||
|
|
||||||
endif # ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN
|
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"
|
rsource "widgets/Kconfig"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -50,6 +50,17 @@ struct k_work_q *zmk_display_work_q() {
|
||||||
#endif
|
#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() {
|
void display_timer_cb() {
|
||||||
lv_tick_inc(TICK_MS);
|
lv_tick_inc(TICK_MS);
|
||||||
k_work_submit_to_queue(zmk_display_work_q(), &display_tick_work);
|
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_work_submit_to_queue(zmk_display_work_q(), &unblank_display_work);
|
||||||
|
|
||||||
k_timer_start(&display_timer, K_MSEC(TICK_MS), K_MSEC(TICK_MS));
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stop_display_updates() {
|
static void stop_display_updates() {
|
||||||
|
@ -81,6 +96,9 @@ static void stop_display_updates() {
|
||||||
k_work_submit_to_queue(zmk_display_work_q(), &blank_display_work);
|
k_work_submit_to_queue(zmk_display_work_q(), &blank_display_work);
|
||||||
|
|
||||||
k_timer_stop(&display_timer);
|
k_timer_stop(&display_timer);
|
||||||
|
#if CONFIG_ZMK_DISPLAY_FULL_REFRESH_PERIOD > 0
|
||||||
|
k_timer_stop(&full_refresh_timer);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int zmk_display_is_initialized() { return initialized; }
|
int zmk_display_is_initialized() { return initialized; }
|
||||||
|
|
Loading…
Add table
Reference in a new issue