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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 73 additions and 56 deletions

View File

@ -20,7 +20,7 @@ runs:
- name: 'Build'
uses: espressif/esp-idf-ci-action@main
with:
esp_idf_version: v5.3.1
esp_idf_version: v5.3.2
target: ${{ inputs.arch }}
path: './'
- name: 'Release'

View File

@ -20,7 +20,7 @@ runs:
- name: 'Build'
uses: espressif/esp-idf-ci-action@main
with:
esp_idf_version: v5.3.1
esp_idf_version: v5.3.2
target: ${{ inputs.arch }}
path: './'
- name: 'Release'

View File

@ -4,4 +4,4 @@ dependencies:
espressif/esp_lcd_touch_gt911: "1.1.1~2"
espressif/esp_lcd_touch_ft5x06: "1.0.6~1"
espressif/esp_lcd_touch: "1.1.2"
idf: '5.3.1'
idf: '5.3.2'

View File

@ -3,7 +3,6 @@
#include "esp_err.h"
#include "esp_lcd_touch_gt911.h"
#include "Log.h"
#include "kernel/Kernel.h"
#include "esp_lvgl_port.h"
#define TAG "tdeck_touch"
@ -16,25 +15,10 @@
bool TdeckTouch::start(lv_display_t* display) {
const esp_lcd_panel_io_i2c_config_t io_config = ESP_LCD_TOUCH_IO_I2C_GT911_CONFIG();
// TODO: Revert on new ESP-IDF version
static_assert(ESP_IDF_VERSION == ESP_IDF_VERSION_VAL(5, 3, 1));
esp_lcd_new_panel_io_i2c(
(esp_lcd_i2c_bus_handle_t)TDECK_TOUCH_I2C_BUS_HANDLE,
&io_config,
&ioHandle
);
/*
if (
esp_lcd_new_panel_io_i2c(
(esp_lcd_i2c_bus_handle_t)TDECK_TOUCH_I2C_BUS_HANDLE,
&touch_io_config,
&ioHandle
) != ESP_OK
) {
if (esp_lcd_new_panel_io_i2c(TDECK_TOUCH_I2C_BUS_HANDLE, &io_config, &ioHandle) != ESP_OK) {
TT_LOG_E(TAG, "touch io i2c creation failed");
return false;
}
*/
esp_lcd_touch_config_t config = {
.x_max = TDECK_TOUCH_X_MAX,
@ -58,7 +42,7 @@ bool TdeckTouch::start(lv_display_t* display) {
if (esp_lcd_touch_new_i2c_gt911(ioHandle, &config, &touchHandle) != ESP_OK) {
TT_LOG_E(TAG, "GT199 driver init failed");
// TODO: De-init IO
cleanup();
return false;
}
@ -71,6 +55,7 @@ bool TdeckTouch::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;
}
@ -78,19 +63,23 @@ bool TdeckTouch::start(lv_display_t* display) {
}
bool TdeckTouch::stop() {
if (esp_lcd_touch_del(touchHandle) == ESP_OK) {
touchHandle = nullptr;
} else {
TT_LOG_E(TAG, "Deleting driver failed");
return false;
}
if (esp_lcd_panel_io_del(ioHandle) == ESP_OK) {
ioHandle = nullptr;
} else {
TT_LOG_E(TAG, "Deleting IO handle failed");
return false;
}
cleanup();
return true;
}
void TdeckTouch::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;
}
}

View File

@ -10,6 +10,7 @@ private:
esp_lcd_panel_io_handle_t _Nullable ioHandle = nullptr;
esp_lcd_touch_handle_t _Nullable touchHandle = nullptr;
lv_indev_t* _Nullable deviceHandle = nullptr;
void cleanup();
public:
bool start(lv_display_t* display) override;
bool stop() override;

View File

@ -10,20 +10,13 @@
bool CoreS3Touch::start(lv_display_t* display) {
TT_LOG_I(TAG, "Starting");
esp_lcd_panel_io_handle_t ioHandle;
esp_lcd_touch_handle_t touchHandle;
esp_lcd_panel_io_i2c_config_t touch_io_config = ESP_LCD_TOUCH_IO_I2C_FT5x06_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(I2C_NUM_0, &touch_io_config, &ioHandle);
/*
if (esp_lcd_new_panel_io_i2c(I2C_NUM_0, &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 = 320,
@ -47,6 +40,7 @@ bool CoreS3Touch::start(lv_display_t* display) {
if (esp_lcd_touch_new_i2c_ft5x06(ioHandle, &config, &touchHandle) != ESP_OK) {
TT_LOG_E(TAG, "Driver init failed");
cleanup();
return false;
}
@ -58,6 +52,7 @@ bool CoreS3Touch::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;
}
@ -66,8 +61,23 @@ bool CoreS3Touch::start(lv_display_t* display) {
}
bool CoreS3Touch::stop() {
tt_assert(deviceHandle != nullptr);
lv_indev_delete(deviceHandle);
deviceHandle = nullptr;
cleanup();
return true;
}
void CoreS3Touch::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;
}
}

View File

@ -2,10 +2,14 @@
#include "hal/Touch.h"
#include "TactilityCore.h"
#include <esp_lcd_touch.h>
class CoreS3Touch : public tt::hal::Touch {
private:
esp_lcd_panel_io_handle_t ioHandle = nullptr;
esp_lcd_touch_handle_t touchHandle = nullptr;
lv_indev_t* _Nullable deviceHandle = nullptr;
void cleanup();
public:
bool start(lv_display_t* display) override;
bool stop() override;

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;
}
}

View File

@ -2,10 +2,14 @@
#include "hal/Touch.h"
#include "TactilityCore.h"
#include <esp_lcd_touch.h>
class YellowTouch : public tt::hal::Touch {
private:
esp_lcd_panel_io_handle_t ioHandle = nullptr;
esp_lcd_touch_handle_t touchHandle = nullptr;
lv_indev_t* _Nullable deviceHandle = nullptr;
void cleanup();
public:
bool start(lv_display_t* display) override;
bool stop() override;