diff --git a/App/idf_component.yml b/App/idf_component.yml index 30944b9d..a9f6aa56 100644 --- a/App/idf_component.yml +++ b/App/idf_component.yml @@ -4,7 +4,7 @@ dependencies: espressif/esp_lcd_touch: "1.1.2" atanisoft/esp_lcd_touch_xpt2046: "1.0.5" espressif/esp_lcd_touch_cst816s: "1.0.3" - espressif/esp_lcd_touch_gt911: "1.1.1~2" + espressif/esp_lcd_touch_gt911: "1.1.3" espressif/esp_lcd_touch_ft5x06: "1.0.6~1" espressif/esp_io_expander: "1.0.1" espressif/esp_io_expander_tca95xx_16bit: "1.0.1" diff --git a/Drivers/GT911/Source/Gt911Touch.cpp b/Drivers/GT911/Source/Gt911Touch.cpp index ba9464f5..d911a35e 100644 --- a/Drivers/GT911/Source/Gt911Touch.cpp +++ b/Drivers/GT911/Source/Gt911Touch.cpp @@ -1,6 +1,7 @@ #include "Gt911Touch.h" #include +#include #include #include @@ -9,7 +10,21 @@ #define TAG "GT911" bool Gt911Touch::start(lv_display_t* display) { - const esp_lcd_panel_io_i2c_config_t io_config = ESP_LCD_TOUCH_IO_I2C_GT911_CONFIG(); + esp_lcd_panel_io_i2c_config_t io_config = ESP_LCD_TOUCH_IO_I2C_GT911_CONFIG(); + + /** + * When the interrupt pin is low, the address is 0x5D. Otherwise it is 0x14. + * There is not reset pin, and the current driver fails when you only specify the interrupt pin. + * Because of that, we don't use the interrupt pin and we'll simply scan the bus instead: + */ + if (tt::hal::i2c::masterHasDeviceAtAddress(configuration->port, ESP_LCD_TOUCH_IO_I2C_GT911_ADDRESS)) { + io_config.dev_addr = ESP_LCD_TOUCH_IO_I2C_GT911_ADDRESS; + } else if (tt::hal::i2c::masterHasDeviceAtAddress(configuration->port, ESP_LCD_TOUCH_IO_I2C_GT911_ADDRESS_BACKUP)) { + io_config.dev_addr = ESP_LCD_TOUCH_IO_I2C_GT911_ADDRESS_BACKUP; + } else { + TT_LOG_E(TAG, "No device found on I2C bus"); + return false; + } if (esp_lcd_new_panel_io_i2c(configuration->port, &io_config, &ioHandle) != ESP_OK) { TT_LOG_E(TAG, "Touch IO I2C creation failed"); @@ -67,10 +82,6 @@ void Gt911Touch::cleanup() { if (deviceHandle != nullptr) { lv_indev_delete(deviceHandle); deviceHandle = nullptr; - } - - if (touchHandle != nullptr) { - esp_lcd_touch_del(touchHandle); touchHandle = nullptr; } diff --git a/Tactility/Private/Tactility/service/loader/Loader_i.h b/Tactility/Private/Tactility/service/loader/Loader_i.h deleted file mode 100644 index 8e268ede..00000000 --- a/Tactility/Private/Tactility/service/loader/Loader_i.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -#include "Tactility/app/AppInstance.h" -#include "Tactility/app/AppManifest.h" -#include "Tactility/service/loader/Loader.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace tt::service::loader { - -// region LoaderMessage - -class LoaderMessageAppStart { -public: - std::string id; - std::shared_ptr _Nullable parameters; - - LoaderMessageAppStart() = default; - LoaderMessageAppStart(LoaderMessageAppStart& other) = default; - - LoaderMessageAppStart(const std::string& id, std::shared_ptr parameters) : - id(id), - parameters(std::move(parameters)) - {} - - ~LoaderMessageAppStart() = default; -}; - -class LoaderMessageAppStop { -public: - std::string id; - - LoaderMessageAppStop() = default; - LoaderMessageAppStop(LoaderMessageAppStop& other) = default; - - LoaderMessageAppStop(const std::string& id) : id(id) {} - - ~LoaderMessageAppStop() = default; -}; - -// endregion LoaderMessage - -struct Loader { - -}; - -} // namespace diff --git a/Tactility/Source/service/gui/Gui.cpp b/Tactility/Source/service/gui/Gui.cpp index 959b6075..ed9b39a3 100644 --- a/Tactility/Source/service/gui/Gui.cpp +++ b/Tactility/Source/service/gui/Gui.cpp @@ -2,7 +2,7 @@ #include "Tactility/lvgl/LvglSync.h" #include "Tactility/lvgl/Statusbar.h" #include "Tactility/lvgl/Style.h" -#include "Tactility/service/loader/Loader_i.h" +#include "Tactility/service/loader/Loader.h" #include #include diff --git a/Tactility/Source/service/loader/Loader.cpp b/Tactility/Source/service/loader/Loader.cpp index 7d691628..e8cd20bf 100644 --- a/Tactility/Source/service/loader/Loader.cpp +++ b/Tactility/Source/service/loader/Loader.cpp @@ -1,10 +1,14 @@ +#include "Tactility/service/loader/Loader.h" +#include "Tactility/app/AppInstance.h" #include "Tactility/app/AppManifest.h" #include "Tactility/app/ManifestRegistry.h" -#include "Tactility/service/loader/Loader_i.h" +#include +#include #include #include -#include + +#include #ifdef ESP_PLATFORM #include @@ -252,7 +256,6 @@ void LoaderService::transitionAppToState(const std::shared_ptr } void LoaderService::startApp(const std::string& id, std::shared_ptr parameters) { - auto message = std::make_shared(id, std::move(parameters)); dispatcherThread->dispatch([this, id, parameters]() { onStartAppMessage(id, parameters); }); diff --git a/Tactility/Source/service/wifi/WifiEsp.cpp b/Tactility/Source/service/wifi/WifiEsp.cpp index 6b58ec64..1573b3b0 100644 --- a/Tactility/Source/service/wifi/WifiEsp.cpp +++ b/Tactility/Source/service/wifi/WifiEsp.cpp @@ -844,7 +844,6 @@ static void dispatchDisconnectButKeepActive(std::shared_ptr wifi) { static bool shouldScanForAutoConnect(std::shared_ptr wifi) { auto lock = wifi->dataMutex.asScopedLock(); if (!lock.lock(100)) { - TT_LOG_W(TAG, "Auto-connect can't lock"); return false; } @@ -853,7 +852,6 @@ static bool shouldScanForAutoConnect(std::shared_ptr wifi) { !wifi->pause_auto_connect; if (!is_radio_in_scannable_state) { - TT_LOG_W(TAG, "Auto-connect: radio state not ok (%d, %d, %d)", (int)wifi->getRadioState(), wifi->isScanActive(), wifi->pause_auto_connect); return false; } @@ -862,7 +860,6 @@ static bool shouldScanForAutoConnect(std::shared_ptr wifi) { bool no_recent_scan = (current_time - wifi->last_scan_time) > (AUTO_SCAN_INTERVAL / portTICK_PERIOD_MS); if (!scan_time_has_looped && !no_recent_scan) { - TT_LOG_W(TAG, "Auto-connect: scan time looped = %d, no recent scan = %d", scan_time_has_looped, no_recent_scan); } return scan_time_has_looped || no_recent_scan;