Skip all GUI updates and LVGL rendering when display is blanked

gui_update_data() returns early when display_blanked — no LVGL label
updates, no bubble physics, no dirty pixels. lv_timer_handler() also
skipped — no SPI traffic to a sleeping display.

On unblank, lv_obj_invalidate(gui_screen) triggers a full-frame
render on the next loop, so the display recovers immediately.

Saves CPU, SPI bus time, and display controller power during sleep.
This commit is contained in:
GlassOnTin 2026-04-02 15:02:25 +01:00
commit 8bba734d99

13
Gui.h
View file

@ -695,6 +695,10 @@ static bool gui_is_scrolling() {
static void gui_update_data() {
if (!gui_time_label) return;
// Skip all GUI updates when display is blanked — no point rendering
// to a sleeping display. Saves CPU, SPI writes, and display power.
if (display_blanked) return;
// Skip data updates during scroll animation — frees CPU for rendering
if (gui_is_scrolling()) return;
@ -1602,9 +1606,12 @@ void gui_update() {
gui_update_data();
gui_render_start = micros();
lv_timer_handler();
gui_render_us_last = micros() - gui_render_start;
// Skip LVGL rendering when display is blanked — no SPI traffic to sleeping display
if (!display_blanked) {
gui_render_start = micros();
lv_timer_handler();
gui_render_us_last = micros() - gui_render_start;
}
// After lv_timer_handler, a new DMA may be queued via gui_flush_cb.
// It runs in background on SPI3 until the next gui_update() call.
}