From 2205e56c32513c6047a7608c7907b18c5c8615b0 Mon Sep 17 00:00:00 2001 From: Neil Arora Date: Wed, 14 Jan 2026 21:48:59 +0530 Subject: [PATCH] Reduce SPI clock and add panel stabilization delays Lowered the SPI clock to 5MHz to reduce power consumption and avoid brownout issues. Added delays after panel reset and initialization to ensure proper stabilization. Introduced ENABLE_BACKLIGHT macro and conditional backlight control logic. Updated .gitignore to exclude build and managed_components directories in 05_LVGL_WITH_RAM. Updated dependency and sdkconfig files to reflect new local paths and component versions. --- .gitignore | 4 +++- 05_LVGL_WITH_RAM/dependencies.lock | 10 +++++----- 05_LVGL_WITH_RAM/sdkconfig | 6 ++++++ dependencies.lock | 2 +- main/main.c | 17 +++++++++++++++-- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 2a1d0af..926bd60 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ /managed_components .vscode/settings.json /ref_demo -/.cache \ No newline at end of file +/.cache +/05_LVGL_WITH_RAM/build +/05_LVGL_WITH_RAM/managed_components diff --git a/05_LVGL_WITH_RAM/dependencies.lock b/05_LVGL_WITH_RAM/dependencies.lock index 5ee8d85..6887d31 100644 --- a/05_LVGL_WITH_RAM/dependencies.lock +++ b/05_LVGL_WITH_RAM/dependencies.lock @@ -2,7 +2,7 @@ dependencies: esp_lcd_sh8601: dependencies: [] source: - path: C:\Users\neila\Downloads\ESP32-S3-Touch-AMOLED-1.8-Demo\ESP-IDF-v5.3.2\05_LVGL_WITH_RAM\components\esp_lcd_sh8601 + path: /Users/neil/Coding/iroBot/05_LVGL_WITH_RAM/components/esp_lcd_sh8601 type: local version: 1.0.0 espressif/cmake_utilities: @@ -16,7 +16,7 @@ dependencies: type: service version: 0.5.3 espressif/esp_io_expander: - component_hash: abf3ea0d71407d79d15500550aa3ba433848459b0fa94717cf9478822593ee5d + component_hash: 034903704f65e3994d7cce9d080b19d89525cf6d416574b932826adf680f3942 dependencies: - name: idf require: private @@ -24,7 +24,7 @@ dependencies: source: registry_url: https://components.espressif.com type: service - version: 1.1.0 + version: 1.2.0 espressif/esp_io_expander_tca9554: component_hash: e9e49ddb1038c2b54b13c51b5e3e6dbdd10a878959c8ab0e0a7c8206316add61 dependencies: @@ -42,13 +42,13 @@ dependencies: espressif/esp_lcd_touch: dependencies: [] source: - path: C:\Users\neila\Downloads\ESP32-S3-Touch-AMOLED-1.8-Demo\ESP-IDF-v5.3.2\05_LVGL_WITH_RAM\components\espressif__esp_lcd_touch + path: /Users/neil/Coding/iroBot/05_LVGL_WITH_RAM/components/espressif__esp_lcd_touch type: local version: 1.1.1 espressif/esp_lcd_touch_ft5x06: dependencies: [] source: - path: C:\Users\neila\Downloads\ESP32-S3-Touch-AMOLED-1.8-Demo\ESP-IDF-v5.3.2\05_LVGL_WITH_RAM\components\espressif__esp_lcd_touch_ft5x06 + path: /Users/neil/Coding/iroBot/05_LVGL_WITH_RAM/components/espressif__esp_lcd_touch_ft5x06 type: local version: 1.0.6 idf: diff --git a/05_LVGL_WITH_RAM/sdkconfig b/05_LVGL_WITH_RAM/sdkconfig index 190f273..b1346e7 100644 --- a/05_LVGL_WITH_RAM/sdkconfig +++ b/05_LVGL_WITH_RAM/sdkconfig @@ -2274,6 +2274,12 @@ CONFIG_ESP_LCD_TOUCH_MAX_POINTS=5 CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS=1 # end of ESP LCD TOUCH +# +# ESP IO Expander +# +# CONFIG_IO_EXPANDER_ENABLE_GPIO_API_WRAPPER is not set +# end of ESP IO Expander + # # LVGL configuration # diff --git a/dependencies.lock b/dependencies.lock index eab9fb6..760203e 100644 --- a/dependencies.lock +++ b/dependencies.lock @@ -2,7 +2,7 @@ dependencies: esp_lcd_sh8601: dependencies: [] source: - path: C:\Users\neila\Coding\iroBotAMOLED\components\esp_lcd_sh8601 + path: /Users/neil/Coding/iroBot/components/esp_lcd_sh8601 type: local version: 1.0.0 espressif/esp_io_expander: diff --git a/main/main.c b/main/main.c index 2fa2250..1256c24 100644 --- a/main/main.c +++ b/main/main.c @@ -80,7 +80,7 @@ static const char *TAG = "LVGL_AMOLED"; #define PIN_NUM_TOUCH_RST (-1) #define PIN_NUM_TOUCH_INT (GPIO_NUM_21) -#define USE_TOUCH 1 +#define ENABLE_BACKLIGHT 0 /* IO Expander Pins */ #define IO_EXPANDER_PIN_NUM_0 (1 << 0) @@ -485,8 +485,9 @@ void app_main(void) { esp_lcd_panel_io_spi_config_t io_config = SH8601_PANEL_IO_QSPI_CONFIG( PIN_NUM_LCD_CS, notify_lvgl_flush_ready, &disp_drv); + // Reduce SPI clock to 5MHz to lower power consumption and avoid brownout io_config.pclk_hz = - 40 * 1000 * 1000; /* Reduced to 40MHz for stability (matching demo) */ + 5 * 1000 * 1000; /* 5MHz for stability */ ESP_ERROR_CHECK(esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)LCD_HOST, &io_config, &lcd_io)); @@ -507,11 +508,23 @@ void app_main(void) { ESP_ERROR_CHECK(esp_lcd_new_panel_sh8601(lcd_io, &panel_config, &lcd_panel)); ESP_LOGI(TAG, "Resetting panel"); ESP_ERROR_CHECK(esp_lcd_panel_reset(lcd_panel)); + // Small delay to allow the panel to stabilize after reset + vTaskDelay(pdMS_TO_TICKS(100)); ESP_LOGI(TAG, "Initializing panel"); ESP_ERROR_CHECK(esp_lcd_panel_init(lcd_panel)); + // Additional delay before turning the panel on + vTaskDelay(pdMS_TO_TICKS(200)); ESP_LOGI(TAG, "Turning panel ON"); ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(lcd_panel, true)); ESP_LOGI(TAG, "Panel init complete"); + #if ENABLE_BACKLIGHT + // Turn off backlight initially via IO expander to reduce power draw + esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_2, 0); + // Short delay to ensure panel is stable + vTaskDelay(pdMS_TO_TICKS(100)); + // Enable backlight after panel is on + esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_2, 1); +#endif /* Touch Driver Setup (FT5x06) */ #if USE_TOUCH