Fix display not init

This commit is contained in:
GW_MC
2026-01-25 18:57:41 +08:00
parent 259660a0bc
commit 5865f6d383
2 changed files with 52 additions and 27 deletions

View File

@@ -118,12 +118,23 @@ void DisplayHandler::_epd_init(void) {
epd_write_cmd(0x04); // Power ON
vTaskDelay(pdMS_TO_TICKS(100)); // Wait for power on
// Check BUSY pin
ESP_LOGI("DisplayHandler", "Waiting for EPD to be ready...");
// Check BUSY pin with detailed logging
ESP_LOGI("DisplayHandler", "Waiting for EPD to be ready after power on...");
ESP_LOGI("DisplayHandler", "BUSY pin level after power on: %d (0=BUSY, 1=FREE)", gpio_get_level(PIN_BUSY));
int busy_timeout = 0;
while (gpio_get_level(PIN_BUSY) == BUSY_ACTIVE_LEVEL) { // BUSY is active LOW
vTaskDelay(pdMS_TO_TICKS(10));
busy_timeout++;
if (busy_timeout > 500) { // 5 second timeout
ESP_LOGE("DisplayHandler", "EPD power on timeout! BUSY pin stuck at 0");
break;
}
if (busy_timeout % 50 == 0) { // Log every 500ms
ESP_LOGW("DisplayHandler", "Still waiting for EPD power on, timeout: %d/500", busy_timeout);
}
}
ESP_LOGI("DisplayHandler", "EPD is ready.");
ESP_LOGI("DisplayHandler", "EPD power on complete after %d * 10ms, BUSY pin: %d", busy_timeout, gpio_get_level(PIN_BUSY));
const uint8_t booster_data[] = { 0x27, 0x27, 0x18, 0x17 };
epd_write_cmd_with_data(0x06, booster_data, 4); // Booster Soft Start
vTaskDelay(pdMS_TO_TICKS(10));