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.
This commit is contained in:
17
main/main.c
17
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
|
||||
|
||||
Reference in New Issue
Block a user