el512: refresh health counters and quiet warnings

The panel driver counts ring refills, the largest gap between refills,
frame swaps, swap timeouts and I2S TX FIFO underruns (takeStats()). The
ESPHome component checks them every 10 s and logs a warning only when the
ESP32 side of the signal had a problem, plus a debug summary per minute.

Measured with Wi-Fi on: ~4600 refills/s, max gap < 0.4 ms (lead 1.7 ms),
no underruns or timeouts, so remaining blinks come from the signal being
disturbed on the wires (Wi-Fi transmit bursts), not from the refresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-18 20:52:10 +02:00
1 parent 963590cdfe
commit f3212ea969
4 files changed
+80 -1

No files matched your search

+18
View File
@@ -103,6 +103,18 @@ class EL512Panel {
// ROW_BYTES bytes in DMA order. Lines >= HEIGHT produce blanking.
void encodeRow(uint16_t line, uint8_t* out) const;
// Refresh health counters since the last call (then reset): ring refills,
// the largest gap between two refills in CPU cycles, frame swaps, and
// show() calls that gave up waiting for a swap.
struct Stats {
uint32_t refills;
uint32_t maxGapCycles;
uint32_t swaps;
uint32_t showTimeouts;
uint32_t underruns; // refills that saw the TX FIFO empty or hung
};
Stats takeStats();
// Frame refresh rate implied by the timing constants.
static constexpr float refreshHz() {
return (float)PIXEL_CLOCK_HZ / ((float)CLOCKS_PER_ROW * LINES_PER_FRAME);
@@ -122,6 +134,12 @@ class EL512Panel {
intr_handle_data_t* _intr = nullptr;
uint16_t _chunkLine[CHUNK_COUNT] = {}; // first line currently in each chunk
volatile bool _swapPending = false;
volatile uint32_t _refills = 0;
volatile uint32_t _swaps = 0;
volatile uint32_t _maxGap = 0;
volatile uint32_t _lastIsrCycle = 0;
uint32_t _showTimeouts = 0;
volatile uint32_t _underruns = 0;
bool _running = false;
bool _enabled = false;
bool _lowPower = false;