Ease DSI PSRAM write bursts: bigger inv buffer + half-rate rain

Two secondary mitigations for the DSI underrun (the primary fix is the
reduced DPI clock in the BSP). Raise LV_INV_BUF_SIZE 32 -> 128 so the
busy rain states stay partial-redraw instead of collapsing into a
full-screen redraw, which dumps a ~1.3 MB PSRAM write burst that
competes with the DSI's continuous framebuffer read. Advance the matrix
rain every other tick (doubled step, visually identical) to halve how
often its ~80 labels invalidate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LKPbR6DY2JygHbyLjxm7Uu
This commit is contained in:
2026-07-15 14:43:32 +02:00
co-authored by Claude Opus 4.8
parent d1e1250016
commit 4c3718411e
2 changed files with 24 additions and 1 deletions
+14
View File
@@ -1,4 +1,18 @@
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# Grow LVGL's invalidation buffer (default 32) so the ~80 moving rain labels of the
# busy face states stay as separate partial-redraw rects instead of collapsing into
# one full-screen redraw. Secondary mitigation for the DSI PSRAM-bandwidth underrun
# (primary fix is the reduced DPI clock in the BSP): a full-screen redraw dumps a
# ~1.3 MB PSRAM write burst that competes with the DSI's continuous framebuffer read
# and can re-trigger the underrun; keeping busy states partial avoids that. Applied
# globally so LVGL and esp_lvgl_adapter (both size inv_areas[] by LV_INV_BUF_SIZE)
# agree. The partial-flush path's stack scales with this, so app_main starts the LVGL
# task with a 16 KB stack (see desklock_main.c) — the 8 KB default overflows at 128.
# Must sit after the project.cmake include (defines idf_build_set_property) and before
# project() consumes it.
idf_build_set_property(COMPILE_OPTIONS "-DLV_INV_BUF_SIZE=128" APPEND)
project(desklock)
+10 -1
View File
@@ -153,6 +153,15 @@ static void stream_hide(stream_t *s)
static void rain_tick(void)
{
const face_def_t *d = &DEFS[F.state];
/* Half-rate: advance the rain every OTHER tick (double the step so the fall
* looks identical). Halves how often the 80 rain labels invalidate, cutting the
* per-frame PSRAM write traffic that competes with the DSI framebuffer read on
* the same bus — a secondary easing of the underrun the reduced DPI clock fixes.
* The clock/face still update every tick. */
static uint8_t phase;
if (phase++ & 1) {
return;
}
/* Rain is the reachability signal: it only falls when the gateway is live.
* A disconnect drains it gracefully (streams finish falling, none respawn). */
int target = (F.power == 2 || !gw_connected()) ? 0 : d->rain_streams;
@@ -163,7 +172,7 @@ static void rain_tick(void)
continue;
}
alive++;
s->y += s->speed;
s->y += s->speed * 2;
lv_obj_set_pos(s->tail, s->x, s->y);
lv_obj_set_pos(s->head, s->x, s->y + s->len * 26);
if (F.mutate == 0 && (esp_random() % 3) == 0) {