Upgrade to ESP-IDF 5.3.2 (#145)

This also fixes the touch driver issue.
I also fixed an unrelated touch driver cleanup issue.
This commit is contained in:
Ken Van Hoeylandt
2025-01-02 22:04:20 +01:00
committed by GitHub
parent a7d15056d8
commit ec90198dbf
9 changed files with 73 additions and 56 deletions
+20 -11
View File
@@ -11,20 +11,12 @@
bool YellowTouch::start(lv_display_t* display) {
TT_LOG_I(TAG, "Starting");
esp_lcd_panel_io_handle_t ioHandle;
esp_lcd_touch_handle_t touchHandle;
const esp_lcd_panel_io_i2c_config_t touch_io_config = ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG();
// TODO: Check when ESP-IDF publishes fix (5.3.2 or 5.4.x)
static_assert(ESP_IDF_VERSION == ESP_IDF_VERSION_VAL(5, 3, 1));
esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)TWODOTFOUR_TOUCH_I2C_PORT, &touch_io_config, &ioHandle);
/*
if (esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)TWODOTFOUR_TOUCH_I2C_PORT, &touch_io_config, &ioHandle) != ESP_OK) {
TT_LOG_E(TAG, "Touch I2C IO init failed");
return false;
}
*/
esp_lcd_touch_config_t config = {
.x_max = 240,
@@ -48,6 +40,7 @@ bool YellowTouch::start(lv_display_t* display) {
if (esp_lcd_touch_new_i2c_cst816s(ioHandle, &config, &touchHandle) != ESP_OK) {
TT_LOG_E(TAG, "Driver init failed");
cleanup();
return false;
}
@@ -59,6 +52,7 @@ bool YellowTouch::start(lv_display_t* display) {
deviceHandle = lvgl_port_add_touch(&touch_cfg);
if (deviceHandle == nullptr) {
TT_LOG_E(TAG, "Adding touch failed");
cleanup();
return false;
}
@@ -67,8 +61,23 @@ bool YellowTouch::start(lv_display_t* display) {
}
bool YellowTouch::stop() {
tt_assert(deviceHandle != nullptr);
lv_indev_delete(deviceHandle);
deviceHandle = nullptr;
cleanup();
return true;
}
void YellowTouch::cleanup() {
if (deviceHandle != nullptr) {
lv_indev_delete(deviceHandle);
deviceHandle = nullptr;
}
if (touchHandle != nullptr) {
esp_lcd_touch_del(touchHandle);
touchHandle = nullptr;
}
if (ioHandle != nullptr) {
esp_lcd_panel_io_del(ioHandle);
ioHandle = nullptr;
}
}