From c0020812cbc99e873c2844376006125ae40c4f8b Mon Sep 17 00:00:00 2001 From: Brad Barnett <127794626+bdbarnett@users.noreply.github.com> Date: Mon, 5 Oct 2026 15:12:21 -0500 Subject: [PATCH] DotClockFramebuffer: the bounce_rows range is defined where the constructor can see it #42 defined DCFB_BOUNCE_ROWS_MAX/MIN inside the 'defined(ESP_PLATFORM) && SOC_LCD_RGB_SUPPORTED' block, but the constructor that checks bounce_rows= against them is outside it. The esp32 port compiles user C modules a second time in the executable's own target, without ESP_PLATFORM, and there the block is empty: every esp32 build that carries displayif fails with 'DCFB_BOUNCE_ROWS_MAX undeclared'. Found building ESP32_GENERIC_P4 for the micropython-pydevices reorg; the old board-dir build configures the file the same way. --- src/ports/esp32/mod_dotclockframebuffer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ports/esp32/mod_dotclockframebuffer.c b/src/ports/esp32/mod_dotclockframebuffer.c index 76446c8..b3d7990 100644 --- a/src/ports/esp32/mod_dotclockframebuffer.c +++ b/src/ports/esp32/mod_dotclockframebuffer.c @@ -35,6 +35,12 @@ #define DCFB_MAX_DATA_PINS 18 #define DCFB_NUM_FBS 2 #define DCFB_PRESENT_TIMEOUT_US 100000 +// The bounce-buffer row range bounce_rows= is checked against. Outside the +// SOC_LCD_RGB_SUPPORTED block below, because the constructor that checks it +// is too: the esp32 port compiles user C modules a second time in the +// executable's own target, without ESP_PLATFORM, and there the block is empty. +#define DCFB_BOUNCE_ROWS_MAX 20 +#define DCFB_BOUNCE_ROWS_MIN 4 #if defined(ESP_PLATFORM) #include "esp_heap_caps.h" @@ -201,8 +207,6 @@ static void dotclockframebuffer_fill_data_pins(dotclockframebuffer_obj_t *self, // counts that divide v_res, and if none fit, say what we needed and what the // heap had. Smaller bounce buffers cost more refill interrupts per frame, not // correctness — the same bytes are copied either way. -#define DCFB_BOUNCE_ROWS_MAX 20 -#define DCFB_BOUNCE_ROWS_MIN 4 // At least the strictest alignment gdma_get_alignment_constraints() reports for // internal memory on any supported target, so the probe is never more // optimistic than the allocation ESP-IDF makes moments later.