From 42f1dcb9d3fef894677567246d9a65975799065d Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sat, 24 Oct 2026 22:26:00 +0200 Subject: [PATCH 1/3] Fixes for deprecated pointer devices Replaced logic with touch and mouse devices. Removed support for deprecated pointer device. --- Apps/Doom/main/Source/Application.cpp | 22 ++++++---- Apps/Doom/main/Source/Application.h | 2 +- Apps/Doom/main/Source/main.cpp | 12 ++++-- .../main/Include/drivers/TouchDriver.h | 41 ++++++++++++++----- Apps/GraphicsDemo/main/Source/Application.cpp | 4 +- Apps/GraphicsDemo/main/Source/Main.cpp | 19 ++++++--- .../main/Include/drivers/TouchDriver.h | 41 ++++++++++++++----- Apps/MystifyDemo/main/Source/Application.cpp | 4 +- Apps/MystifyDemo/main/Source/Main.cpp | 19 ++++++--- tt.py | 15 +++++-- 10 files changed, 126 insertions(+), 53 deletions(-) diff --git a/Apps/Doom/main/Source/Application.cpp b/Apps/Doom/main/Source/Application.cpp index f05f3d3..0254110 100644 --- a/Apps/Doom/main/Source/Application.cpp +++ b/Apps/Doom/main/Source/Application.cpp @@ -1,7 +1,8 @@ #include "Application.h" #include "DoomEsp.h" -#include +#include +#include #include #include @@ -30,16 +31,19 @@ static void doomTask(void* arg) { vTaskDelete(nullptr); } -static bool isTouched(Device* touch) { - if (pointer_read_data(touch, 0) != ERROR_NONE) { - return false; +static bool isTouched(Device* touch, Device* mouse) { + if (touch != nullptr) { + uint16_t x, y, strength; + uint8_t pointCount = 0; + if (touch_read_data(touch, 0) == ERROR_NONE && touch_get_touched_points(touch, &x, &y, &strength, &pointCount, 1)) { + return true; + } } - uint16_t x, y, strength; - uint8_t pointCount = 0; - return pointer_get_touched_points(touch, &x, &y, &strength, &pointCount, 1); + bool pressed = false; + return mouse != nullptr && mouse_get_button_pressed(mouse, 0, &pressed) == ERROR_NONE && pressed; } -void runApplication(Device* display, Device* touch) { +void runApplication(Device* display, Device* touch, Device* mouse) { SemaphoreHandle_t doneSem = xSemaphoreCreateBinary(); if (doneSem == nullptr) { ESP_LOGE(TAG, "Failed to create shutdown semaphore"); @@ -62,7 +66,7 @@ void runApplication(Device* display, Device* touch) { // Wait until either the doom task exits on its own, or the user touches the screen while (xSemaphoreTake(doneSem, pdMS_TO_TICKS(EXIT_POLL_DELAY_MS)) == pdFALSE) { - if (isTouched(touch)) { + if (isTouched(touch, mouse)) { doomEsp_RequestStop(); xSemaphoreTake(doneSem, portMAX_DELAY); break; diff --git a/Apps/Doom/main/Source/Application.h b/Apps/Doom/main/Source/Application.h index 75d88ea..d1ecf8f 100644 --- a/Apps/Doom/main/Source/Application.h +++ b/Apps/Doom/main/Source/Application.h @@ -2,4 +2,4 @@ #include -void runApplication(struct Device* display, struct Device* touch); +void runApplication(struct Device* display, struct Device* touch, struct Device* mouse); diff --git a/Apps/Doom/main/Source/main.cpp b/Apps/Doom/main/Source/main.cpp index 686d166..f8a5c22 100644 --- a/Apps/Doom/main/Source/main.cpp +++ b/Apps/Doom/main/Source/main.cpp @@ -10,7 +10,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -65,8 +66,11 @@ int main(int argc, char* argv[]) { return 0; } - struct Device* touch_device; - if (device_get_first_active_by_type(&POINTER_TYPE, &touch_device) != ERROR_NONE) { + struct Device* touch_device = nullptr; + struct Device* mouse_device = nullptr; + device_get_first_active_by_type(&TOUCH_TYPE, &touch_device); + device_get_first_active_by_type(&MOUSE_TYPE, &mouse_device); + if (touch_device == nullptr && mouse_device == nullptr) { ESP_LOGE(TAG, "No touch device found"); showErrorAndWait(app_instance_id, "No touch device was found."); return 0; @@ -77,7 +81,7 @@ int main(int argc, char* argv[]) { // Run the main logic ESP_LOGI(TAG, "Running application"); - runApplication(display_device, touch_device); + runApplication(display_device, touch_device, mouse_device); // Restart LVGL to resume rendering of regular apps if (!module_is_started(&lvgl_module)) { diff --git a/Apps/GraphicsDemo/main/Include/drivers/TouchDriver.h b/Apps/GraphicsDemo/main/Include/drivers/TouchDriver.h index 4181f7b..1b75369 100644 --- a/Apps/GraphicsDemo/main/Include/drivers/TouchDriver.h +++ b/Apps/GraphicsDemo/main/Include/drivers/TouchDriver.h @@ -1,28 +1,49 @@ #pragma once #include -#include +#include +#include /** - * Wrapper for pointer_* device driver functions + * Wrapper for touch_* and mouse_* device driver functions. + * Either device can be absent. A press of the primary mouse button counts as a touch. */ class TouchDriver { - struct Device* device; + struct Device* touchDevice; + struct Device* mouseDevice; public: - explicit TouchDriver(struct Device* device) : device(device) { - device_get(device); + TouchDriver(struct Device* touchDevice, struct Device* mouseDevice) : touchDevice(touchDevice), mouseDevice(mouseDevice) { + if (touchDevice != nullptr) { + device_get(touchDevice); + } + if (mouseDevice != nullptr) { + device_get(mouseDevice); + } } ~TouchDriver() { - device_put(device); + if (touchDevice != nullptr) { + device_put(touchDevice); + } + if (mouseDevice != nullptr) { + device_put(mouseDevice); + } } - bool getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* count, uint8_t maxCount) const { - // Poll without blocking: perform one read attempt, then report whatever is cached. - pointer_read_data(device, 0); - return pointer_get_touched_points(device, x, y, strength, count, maxCount); + bool isTouched() const { + if (touchDevice != nullptr) { + uint16_t x, y, strength; + uint8_t count = 0; + // Poll without blocking: perform one read attempt, then report whatever is cached. + touch_read_data(touchDevice, 0); + if (touch_get_touched_points(touchDevice, &x, &y, &strength, &count, 1)) { + return true; + } + } + bool pressed = false; + return mouseDevice != nullptr && mouse_get_button_pressed(mouseDevice, 0, &pressed) == ERROR_NONE && pressed; } }; diff --git a/Apps/GraphicsDemo/main/Source/Application.cpp b/Apps/GraphicsDemo/main/Source/Application.cpp index 417cb1a..5fa7370 100644 --- a/Apps/GraphicsDemo/main/Source/Application.cpp +++ b/Apps/GraphicsDemo/main/Source/Application.cpp @@ -7,9 +7,7 @@ constexpr auto TAG = "Application"; static bool isTouched(TouchDriver* touch) { - uint16_t x, y, strength; - uint8_t pointCount = 0; - return touch->getTouchedPoints(&x, &y, &strength, &pointCount, 1); + return touch->isTouched(); } void createRgbRow(PixelBuffer& buffer) { diff --git a/Apps/GraphicsDemo/main/Source/Main.cpp b/Apps/GraphicsDemo/main/Source/Main.cpp index 6df7e5c..65334b9 100644 --- a/Apps/GraphicsDemo/main/Source/Main.cpp +++ b/Apps/GraphicsDemo/main/Source/Main.cpp @@ -11,7 +11,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -70,8 +71,11 @@ int main(int argc, char* argv[]) { return 0; } - struct Device* touch_device; - if (device_get_first_active_by_type(&POINTER_TYPE, &touch_device) != ERROR_NONE) { + struct Device* touch_device = nullptr; + struct Device* mouse_device = nullptr; + device_get_first_active_by_type(&TOUCH_TYPE, &touch_device); + device_get_first_active_by_type(&MOUSE_TYPE, &mouse_device); + if (touch_device == nullptr && mouse_device == nullptr) { ESP_LOGE(TAG, "No touch device found"); device_put(display_device); showErrorAndWait(app_instance_id, "No touch device was found."); @@ -86,8 +90,13 @@ int main(int argc, char* argv[]) { device_put(display_device); ESP_LOGI(TAG, "Creating touch driver"); - auto touch = new TouchDriver(touch_device); - device_put(touch_device); + auto touch = new TouchDriver(touch_device, mouse_device); + if (touch_device != nullptr) { + device_put(touch_device); + } + if (mouse_device != nullptr) { + device_put(mouse_device); + } // Run the main logic ESP_LOGI(TAG, "Running application"); diff --git a/Apps/MystifyDemo/main/Include/drivers/TouchDriver.h b/Apps/MystifyDemo/main/Include/drivers/TouchDriver.h index 4181f7b..1b75369 100644 --- a/Apps/MystifyDemo/main/Include/drivers/TouchDriver.h +++ b/Apps/MystifyDemo/main/Include/drivers/TouchDriver.h @@ -1,28 +1,49 @@ #pragma once #include -#include +#include +#include /** - * Wrapper for pointer_* device driver functions + * Wrapper for touch_* and mouse_* device driver functions. + * Either device can be absent. A press of the primary mouse button counts as a touch. */ class TouchDriver { - struct Device* device; + struct Device* touchDevice; + struct Device* mouseDevice; public: - explicit TouchDriver(struct Device* device) : device(device) { - device_get(device); + TouchDriver(struct Device* touchDevice, struct Device* mouseDevice) : touchDevice(touchDevice), mouseDevice(mouseDevice) { + if (touchDevice != nullptr) { + device_get(touchDevice); + } + if (mouseDevice != nullptr) { + device_get(mouseDevice); + } } ~TouchDriver() { - device_put(device); + if (touchDevice != nullptr) { + device_put(touchDevice); + } + if (mouseDevice != nullptr) { + device_put(mouseDevice); + } } - bool getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* count, uint8_t maxCount) const { - // Poll without blocking: perform one read attempt, then report whatever is cached. - pointer_read_data(device, 0); - return pointer_get_touched_points(device, x, y, strength, count, maxCount); + bool isTouched() const { + if (touchDevice != nullptr) { + uint16_t x, y, strength; + uint8_t count = 0; + // Poll without blocking: perform one read attempt, then report whatever is cached. + touch_read_data(touchDevice, 0); + if (touch_get_touched_points(touchDevice, &x, &y, &strength, &count, 1)) { + return true; + } + } + bool pressed = false; + return mouseDevice != nullptr && mouse_get_button_pressed(mouseDevice, 0, &pressed) == ERROR_NONE && pressed; } }; diff --git a/Apps/MystifyDemo/main/Source/Application.cpp b/Apps/MystifyDemo/main/Source/Application.cpp index 8c2d650..7a70909 100644 --- a/Apps/MystifyDemo/main/Source/Application.cpp +++ b/Apps/MystifyDemo/main/Source/Application.cpp @@ -9,9 +9,7 @@ constexpr auto TAG = "Application"; constexpr int MYSTIFY_FRAME_DELAY_MS = 50; // ~20 FPS for smooth animation static bool isTouched(TouchDriver* touch) { - uint16_t x, y, strength; - uint8_t pointCount = 0; - return touch->getTouchedPoints(&x, &y, &strength, &pointCount, 1); + return touch->isTouched(); } void runApplication(DisplayDriver* display, TouchDriver* touch) { diff --git a/Apps/MystifyDemo/main/Source/Main.cpp b/Apps/MystifyDemo/main/Source/Main.cpp index e9c1a76..cdab33d 100644 --- a/Apps/MystifyDemo/main/Source/Main.cpp +++ b/Apps/MystifyDemo/main/Source/Main.cpp @@ -11,7 +11,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -70,8 +71,11 @@ int main(int argc, char* argv[]) { return 0; } - struct Device* touch_device; - if (device_get_first_active_by_type(&POINTER_TYPE, &touch_device) != ERROR_NONE) { + struct Device* touch_device = nullptr; + struct Device* mouse_device = nullptr; + device_get_first_active_by_type(&TOUCH_TYPE, &touch_device); + device_get_first_active_by_type(&MOUSE_TYPE, &mouse_device); + if (touch_device == nullptr && mouse_device == nullptr) { ESP_LOGE(TAG, "No touch device found"); device_put(display_device); showErrorAndWait(app_instance_id, "No touch device was found."); @@ -86,8 +90,13 @@ int main(int argc, char* argv[]) { device_put(display_device); ESP_LOGI(TAG, "Creating touch driver"); - auto touch = new TouchDriver(touch_device); - device_put(touch_device); + auto touch = new TouchDriver(touch_device, mouse_device); + if (touch_device != nullptr) { + device_put(touch_device); + } + if (mouse_device != nullptr) { + device_put(mouse_device); + } // Run the main logic ESP_LOGI(TAG, "Running application"); diff --git a/tt.py b/tt.py index c98d529..ca4fe6a 100755 --- a/tt.py +++ b/tt.py @@ -21,7 +21,7 @@ import urllib.request import zipfile -TT_VERSION = "1.3.0" +TT_VERSION = "1.3.1" CDN_URL = os.environ.get("TT_CDN", "https://cdn.tactilityproject.org") HOME_DIRECTORY = os.path.join(os.path.expanduser("~"), ".tactility") INDEX_VALIDITY_SECONDS = 3600 @@ -297,13 +297,19 @@ def read_text(path): def is_installed_build(version_directory, index): - """True when the installed tools and platforms are of the build that the index describes""" + """True when the installed tools and platforms are of the build that the index describes. + Installed platforms that the index no longer has (e.g. after a rename) don't count: they can't be + updated, and "tt update-sdk" removes them.""" installed_tools_hash = read_text(os.path.join(version_directory, "tools.sha256")) if installed_tools_hash is not None and installed_tools_hash != index.get("tools", {}).get("sha256"): return False + available = index.get("platforms", {}) + prefix = "platform-" for name in os.listdir(version_directory): + if not name.startswith(prefix) or name[len(prefix):] not in available: + continue commit = read_text(os.path.join(version_directory, name, "commit")) - if name.startswith("platform-") and commit is not None and commit != index.get("gitCommit", ""): + if commit is not None and commit != index.get("gitCommit", ""): return False return True @@ -324,6 +330,9 @@ def prepare_sdk(version, platforms): os.makedirs(version_directory, exist_ok=True) if index is None: index = load_index(version, version_directory) + for platform in platforms: + if platform not in index.get("platforms", {}): + fail(f"platform {platform} is not available in SDK {version}") # The CDN only has the latest build of a version, so a newer build can't be mixed with the installed one if not is_installed_build(version_directory, index): if has_tools: From 765038c6b29f57f63672cea8caf6b1c24d0786e2 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sat, 24 Oct 2026 22:27:45 +0200 Subject: [PATCH 2/3] Bump versions --- Apps/Doom/manifest.properties | 4 ++-- Apps/GraphicsDemo/manifest.properties | 4 ++-- Apps/MystifyDemo/manifest.properties | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Apps/Doom/manifest.properties b/Apps/Doom/manifest.properties index b91afab..d09b667 100644 --- a/Apps/Doom/manifest.properties +++ b/Apps/Doom/manifest.properties @@ -2,8 +2,8 @@ manifest.version=0.3 target.sdk=0.8.0-dev target.platforms=esp32p4 id=tactility.doom -version.name=0.11.0 -version.code=11 +version.name=0.12.0 +version.code=12 name=Doom description=Classic DOOM. Tab5 only, keyboard required to play. app.0.id=tactility.doom diff --git a/Apps/GraphicsDemo/manifest.properties b/Apps/GraphicsDemo/manifest.properties index 7bb38f9..bc23255 100644 --- a/Apps/GraphicsDemo/manifest.properties +++ b/Apps/GraphicsDemo/manifest.properties @@ -2,8 +2,8 @@ manifest.version=0.3 target.sdk=0.8.0-dev target.platforms=esp32,esp32s3,esp32c6,esp32p4 id=tactility.graphicsdemo -version.name=0.18.0 -version.code=18 +version.name=0.19.0 +version.code=19 name=Graphics Demo app.0.id=tactility.graphicsdemo app.0.name=Graphics Demo diff --git a/Apps/MystifyDemo/manifest.properties b/Apps/MystifyDemo/manifest.properties index db50e5e..b294438 100644 --- a/Apps/MystifyDemo/manifest.properties +++ b/Apps/MystifyDemo/manifest.properties @@ -2,8 +2,8 @@ manifest.version=0.3 target.sdk=0.8.0-dev target.platforms=esp32,esp32s3,esp32c6,esp32p4 id=tactility.mystifydemo -version.name=0.19.0 -version.code=19 +version.name=0.20.0 +version.code=20 name=Mystify Demo description=A graphics demo that is inspired by a Windows 95 screensaver. app.0.id=tactility.mystifydemo From 9ce3e9587c7c04fd42125aa6ab813e98ebbee512 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sat, 24 Oct 2026 22:53:48 +0200 Subject: [PATCH 3/3] Fixes --- Apps/Doom/main/Source/Application.cpp | 3 ++- Apps/Doom/main/Source/main.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Apps/Doom/main/Source/Application.cpp b/Apps/Doom/main/Source/Application.cpp index 0254110..2b11222 100644 --- a/Apps/Doom/main/Source/Application.cpp +++ b/Apps/Doom/main/Source/Application.cpp @@ -35,7 +35,8 @@ static bool isTouched(Device* touch, Device* mouse) { if (touch != nullptr) { uint16_t x, y, strength; uint8_t pointCount = 0; - if (touch_read_data(touch, 0) == ERROR_NONE && touch_get_touched_points(touch, &x, &y, &strength, &pointCount, 1)) { + touch_read_data(touch, 0); + if (touch_get_touched_points(touch, &x, &y, &strength, &pointCount, 1)) { return true; } } diff --git a/Apps/Doom/main/Source/main.cpp b/Apps/Doom/main/Source/main.cpp index f8a5c22..aba4945 100644 --- a/Apps/Doom/main/Source/main.cpp +++ b/Apps/Doom/main/Source/main.cpp @@ -73,6 +73,7 @@ int main(int argc, char* argv[]) { if (touch_device == nullptr && mouse_device == nullptr) { ESP_LOGE(TAG, "No touch device found"); showErrorAndWait(app_instance_id, "No touch device was found."); + device_put(display_device); return 0; } @@ -82,6 +83,13 @@ int main(int argc, char* argv[]) { // Run the main logic ESP_LOGI(TAG, "Running application"); runApplication(display_device, touch_device, mouse_device); + device_put(display_device); + if (touch_device != nullptr) { + device_put(touch_device); + } + if (mouse_device != nullptr) { + device_put(mouse_device); + } // Restart LVGL to resume rendering of regular apps if (!module_is_started(&lvgl_module)) {