diff options
| author | Luke Hoersten <[email protected]> | 2026-06-14 21:13:01 -0500 |
|---|---|---|
| committer | Luke Hoersten <[email protected]> | 2026-06-14 21:13:01 -0500 |
| commit | 7b04ad6faf3bb70a0c3783e8446275f6f152b61e (patch) | |
| tree | d43992d8c645b204d2a24a774667da5b92f73aae /main | |
| parent | 0f0f5dfd4f2910eb8d0e4360d27b7e51a9a14fe7 (diff) | |
state_machine: wait one panel-refresh after paint before lighting backlight (33 ms)
Diffstat (limited to 'main')
| -rw-r--r-- | main/state_machine.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/main/state_machine.c b/main/state_machine.c index c2b43c8..5e688bc 100644 --- a/main/state_machine.c +++ b/main/state_machine.c @@ -3,6 +3,8 @@ #include "esp_check.h" #include "esp_log.h" #include "esp_timer.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" #include "display.h" #include "local_screens.h" @@ -55,13 +57,15 @@ esp_err_t state_machine_set(viewport_run_state_t target) if (target == VIEWPORT_STATE_AWAKE) { if (display_is_up()) { - // Paint the placeholder BEFORE turning the backlight on so the - // user never glimpses the stale /frame contents from the - // previous wake cycle. Configured devices show "Loading…" until - // Scrypted pushes a /frame; a device with no scrypted URL - // shows the info screen since there's no Scrypted to push. + // Paint the placeholder BEFORE turning the backlight on, then + // wait ~33 ms (two 60 Hz refresh cycles) so the DSI engine + // actually pushes the new framebuffer to the panel before the + // backlight comes up. Without the delay, esp_lcd_panel_draw_bitmap + // returns before the panel has been refreshed and the user sees + // a flash of the previous /frame's contents. if (configured) local_screens_show_loading(); else local_screens_show_info(); + vTaskDelay(pdMS_TO_TICKS(33)); display_wake(); } arm_idle_timer(idle_ms); |
