next iteration on display, still some artifacting issues, and ux with buttons states and updating
This commit is contained in:
1 parent
45998b6176
commit
ae5d12b3a2
14 files changed
+860
-398
No files matched your search
@@ -108,14 +108,24 @@ static void rgb_flush_cb(lv_display_t *display, const lv_area_t *area, uint8_t *
|
||||
lv_display_flush_ready(display);
|
||||
}
|
||||
|
||||
esp_err_t display_init(void)
|
||||
/*
|
||||
* Phase 1: allocate everything, scan nothing.
|
||||
*
|
||||
* Called BEFORE wifi_init_sta(), on a heap nothing else has touched. The
|
||||
* bounce buffers need two contiguous 25.6KB DMA-capable internal blocks, and
|
||||
* WiFi's dynamic RX buffers churn that same pool hard enough to fragment it:
|
||||
* observed on hardware (2026-08-04) as "no mem for bounce buffer" with 84KB
|
||||
* of total free heap -- plenty of bytes, no block big enough, and retries
|
||||
* useless because the fragmentation is not transient.
|
||||
*
|
||||
* Allocating first is deterministic where retrying was a dice roll. The
|
||||
* panel is NOT scanning after this returns -- scan-out (and with it the
|
||||
* PSRAM-reading refill ISR that flash writes would fault) starts only in
|
||||
* display_start().
|
||||
*/
|
||||
esp_err_t display_alloc(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing 800x480 RGB panel (CrowPanel Advance)");
|
||||
|
||||
/* lv_display_create() below allocates from LVGL's heap. Without lv_init()
|
||||
* that heap is a null pool and the call faults with LoadProhibited. */
|
||||
ESP_RETURN_ON_FALSE(lv_is_initialized(), ESP_ERR_INVALID_STATE, TAG,
|
||||
"lv_init() must run before display_init()");
|
||||
ESP_LOGI(TAG, "Allocating 800x480 RGB panel (CrowPanel Advance)");
|
||||
|
||||
const esp_lcd_rgb_panel_config_t panel_config = {
|
||||
.clk_src = LCD_CLK_SRC_DEFAULT,
|
||||
@@ -175,6 +185,29 @@ esp_err_t display_init(void)
|
||||
|
||||
ESP_RETURN_ON_ERROR(esp_lcd_new_rgb_panel(&panel_config, &panel), TAG,
|
||||
"esp_lcd_new_rgb_panel failed");
|
||||
|
||||
ESP_LOGI(TAG, "Panel buffers allocated; free internal heap: %u KB",
|
||||
(unsigned)(heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024));
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Phase 2: start scan-out and hand the framebuffers to LVGL.
|
||||
*
|
||||
* From esp_lcd_panel_init() onward the bounce-refill ISR is reading PSRAM
|
||||
* continuously, so every flash write (NVS, WiFi PHY calibration) must already
|
||||
* be done -- see the init-order comment in main.c.
|
||||
*/
|
||||
esp_err_t display_start(void)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(panel != NULL, ESP_ERR_INVALID_STATE, TAG,
|
||||
"display_alloc() must run before display_start()");
|
||||
|
||||
/* lv_display_create() below allocates from LVGL's heap. Without lv_init()
|
||||
* that heap is a null pool and the call faults with LoadProhibited. */
|
||||
ESP_RETURN_ON_FALSE(lv_is_initialized(), ESP_ERR_INVALID_STATE, TAG,
|
||||
"lv_init() must run before display_start()");
|
||||
|
||||
ESP_RETURN_ON_ERROR(esp_lcd_panel_reset(panel), TAG, "panel reset failed");
|
||||
ESP_RETURN_ON_ERROR(esp_lcd_panel_init(panel), TAG, "panel init failed");
|
||||
|
||||
|
||||
Reference in new issue
Block a user