From d0f45d2744d8afa7d611cb2e5e1647e775497d09 Mon Sep 17 00:00:00 2001 From: ainyan03 <205502311+ainyan03@users.noreply.github.com> Date: Wed, 21 Oct 2026 08:50:55 +0000 Subject: [PATCH] Panel_M5HDMI: count the command sent right after a busy wait _check_busy() reset _total_send to 0 after waiting, so the command it was called for went uncounted. After a long COPYRECT the next _set_window(force) skipped the busy check and streamed the pixel data while the FPGA was still copying. The FPGA keeps about 2 KB of received bytes and drops the rest, so the WRITE_RAW never got all its pixels and the display answered busy until it was power-cycled. Seen on ESP32-P4 with Module Display (bundled bitstream) at 1280x720 24bpp: copyRect 617x341 followed by a 76x71 RGB888 pushImage hung 3 of 3 times; with this change 0 of 3. --- src/lgfx/v1/panel/Panel_M5HDMI.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lgfx/v1/panel/Panel_M5HDMI.cpp b/src/lgfx/v1/panel/Panel_M5HDMI.cpp index 929200a4..5f67b856 100644 --- a/src/lgfx/v1/panel/Panel_M5HDMI.cpp +++ b/src/lgfx/v1/panel/Panel_M5HDMI.cpp @@ -969,7 +969,9 @@ namespace lgfx if ((force && _total_send) || (_total_send += length) >= 512) { - _total_send = 0; + // Count the command sent right after this wait. Otherwise a long COPYRECT goes unchecked, + // and the next pixel stream overflows the FPGA's ~2 KB receive queue (excess bytes are dropped). + _total_send = length; uint32_t wait = 0; _bus->beginRead(); while (_bus->readData(8) == 0x00)