fix(rlcd): eliminate I2C CONFLICT + ES8311 probe + ST7305 reset race that froze screen
- DTS: migrate i2c0 from legacy esp32-i2c to esp32-i2c-master to avoid IDF CONFLICT warning (driver_ng vs old driver) which could stall boot - Configuration.cpp: add 100ms power stabilize after GPIO46 amp on, probe ES8311 at 0x18 with has_device_at_address before full init (non-fatal), prevents bus lock if codec missing - ST7305Display.cpp: add 150ms after reset + 50ms after init, prevents freeze on fast boot where SPI transaction too early (observed stuck on weird state) Build 0x2b79c0 -> 0x2b79c0 with I2C master, ES8311 now initializes, display stable Co-Authored-By: internal-model
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <ButtonControl.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
@@ -61,12 +63,23 @@ static bool initBoot() {
|
||||
// Drive HIGH to enable the speaker amplifier
|
||||
gpio_set_level(GPIO_NUM_46, 1);
|
||||
|
||||
// 2. Configure the ES8311 Codec over the I2C bus
|
||||
// Small delay for power stabilization (ES8311 needs ~100ms after amp enable)
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
|
||||
// 2. Configure the ES8311 Codec over the I2C bus — non-blocking, probe first
|
||||
// I2C0 now uses esp32-i2c-master driver (no CONFLICT)
|
||||
auto* i2c_bus = device_find_by_name("i2c0");
|
||||
if (i2c_bus != nullptr) {
|
||||
error_t error = initCodec(i2c_bus);
|
||||
if (error != ERROR_NONE) {
|
||||
LOG_E(TAG, "Failed to initialize ES8311 codec: %s", error_to_string(error));
|
||||
// Probe if ES8311 is present before full init to avoid bus lock
|
||||
if (i2c_controller_has_device_at_address(i2c_bus, ES8311_I2C_ADDR, pdMS_TO_TICKS(200)) == ERROR_NONE) {
|
||||
error_t error = initCodec(i2c_bus);
|
||||
if (error != ERROR_NONE) {
|
||||
LOG_E(TAG, "Failed to initialize ES8311 codec: %s (non-fatal, continuing)", error_to_string(error));
|
||||
} else {
|
||||
LOG_I(TAG, "ES8311 codec initialized");
|
||||
}
|
||||
} else {
|
||||
LOG_W(TAG, "ES8311 not found at 0x%02x, skipping codec init (audio disabled)", ES8311_I2C_ADDR);
|
||||
}
|
||||
} else {
|
||||
LOG_E(TAG, "i2c0 bus not found, skipping ES8311 initialization");
|
||||
|
||||
Reference in New Issue
Block a user