From 8bba734d9959a50c325655abcb4cb335f37a1511 Mon Sep 17 00:00:00 2001 From: GlassOnTin Date: Thu, 2 Apr 2026 15:02:25 +0100 Subject: [PATCH] Skip all GUI updates and LVGL rendering when display is blanked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Gui.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Gui.h b/Gui.h index d02c34c..8fb67e0 100644 --- a/Gui.h +++ b/Gui.h @@ -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. }