From 6fad9d707417d38ca60e11627b1aa4a2435ee4b4 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Sat, 2 Aug 2025 22:58:11 +0200 Subject: [PATCH 1/6] Update `stable` tag automatically To make it easier to release. I will point users to `main` instead. --- .github/workflows/versioning.yml | 15 ++++++++------- README.md | 6 +++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/versioning.yml b/.github/workflows/versioning.yml index ea3c246..34e8d95 100644 --- a/.github/workflows/versioning.yml +++ b/.github/workflows/versioning.yml @@ -19,12 +19,12 @@ on: # yamllint disable-line rule:truthy update_stable: description: "Update stable tag?" required: true - default: false + default: true type: boolean update_latest: description: "Update latest tag?" required: true - default: false + default: true type: boolean jobs: @@ -55,9 +55,10 @@ jobs: - name: Update stable tag if: | - success() && - github.event_name == 'workflow_dispatch' && - inputs.update_stable + success() && ( + github.event_name == 'workflow_dispatch' && inputs.update_stable || + github.event_name == 'push' + ) run: | # Verify version bump was successful if [ ! -f "./versioning/VERSION" ]; then @@ -74,7 +75,7 @@ jobs: # Update tag NEW_VERSION=$(cat ./versioning/VERSION) echo "Updating stable tag to $NEW_VERSION" - git tag -fa stable -m "Update stable tag" + git tag -fa stable -m "Update stable tag to $NEW_VERSION" git push origin stable --force - name: Update latest tag @@ -99,6 +100,6 @@ jobs: # Update tag NEW_VERSION=$(cat ./versioning/VERSION) echo "Updating latest tag to $NEW_VERSION" - git tag -fa latest -m "Update latest tag" + git tag -fa latest -m "Update latest tag to $NEW_VERSION" git push origin latest --force ... diff --git a/README.md b/README.md index 9a81137..a9566aa 100644 --- a/README.md +++ b/README.md @@ -161,11 +161,11 @@ Follow these steps to get your TX Ultimate device up and running with ESPHome. packages: remote_package: url: https://github.com/edwardtfn/TX-Ultimate-Easy - ref: stable # Or you can specify a version, like `ref: v2024.12.6` or `ref: latest` to the latest non-stable + ref: main # Or you can specify a version, like `ref: v2024.12.6` or `ref: latest` refresh: 5min files: - - ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml # Core (essential) packages - - ESPHome/TX-Ultimate-Easy-ESPHome_standard.yaml # Non-essential, but recommended packages + - ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml # Core (essential) packages + - ESPHome/TX-Ultimate-Easy-ESPHome_standard.yaml # Non-essential, but recommended packages ``` You can also use a specific version tag for better control over updates: ```yaml From c36af8a220e21826a00ab0490c9c97c29c918e5d Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Sat, 2 Aug 2025 23:26:49 +0200 Subject: [PATCH 2/6] Return last position on swipe As per #110 --- .../tx_ultimate_easy/tx_ultimate_easy.cpp | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/components/tx_ultimate_easy/tx_ultimate_easy.cpp b/components/tx_ultimate_easy/tx_ultimate_easy.cpp index d233abf..1efc794 100644 --- a/components/tx_ultimate_easy/tx_ultimate_easy.cpp +++ b/components/tx_ultimate_easy/tx_ultimate_easy.cpp @@ -141,9 +141,33 @@ namespace esphome { switch (uart_received_bytes[4]) { case TOUCH_STATE_RELEASE: case TOUCH_STATE_MULTI_TOUCH: + return uart_received_bytes[5]; + case TOUCH_STATE_SWIPE_LEFT: case TOUCH_STATE_SWIPE_RIGHT: - return uart_received_bytes[5]; + switch (uart_received_bytes[5]) { + case 12: { + for (i = 10; i > 0; i--) { + if (i > 8 + ? uart_received_bytes[6] & (1 << (i - 9)) + : uart_received_bytes[7] & (1 << (i - 1))) { + return i; + } + } + break; + } + case 13: { + for (i = 1; i <= 10; i++) { + if (i > 8 + ? uart_received_bytes[6] & (1 << (i - 9)) + : uart_received_bytes[7] & (1 << (i - 1))) { + return i; + } + } + break; + } + return uart_received_bytes[5]; + } default: return uart_received_bytes[6]; From ba8f19060f98614e00e745a2ec0a592fb88ca806 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Sat, 2 Aug 2025 23:40:01 +0200 Subject: [PATCH 3/6] Declare variable used in the loop --- components/tx_ultimate_easy/tx_ultimate_easy.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/tx_ultimate_easy/tx_ultimate_easy.cpp b/components/tx_ultimate_easy/tx_ultimate_easy.cpp index 1efc794..4162176 100644 --- a/components/tx_ultimate_easy/tx_ultimate_easy.cpp +++ b/components/tx_ultimate_easy/tx_ultimate_easy.cpp @@ -147,7 +147,7 @@ namespace esphome { case TOUCH_STATE_SWIPE_RIGHT: switch (uart_received_bytes[5]) { case 12: { - for (i = 10; i > 0; i--) { + for (uint8_t i = 10; i > 0; i--) { if (i > 8 ? uart_received_bytes[6] & (1 << (i - 9)) : uart_received_bytes[7] & (1 << (i - 1))) { @@ -157,7 +157,7 @@ namespace esphome { break; } case 13: { - for (i = 1; i <= 10; i++) { + for (uint8_t i = 1; i <= 10; i++) { if (i > 8 ? uart_received_bytes[6] & (1 << (i - 9)) : uart_received_bytes[7] & (1 << (i - 1))) { From 23d28a32a3bd7108d7e2f6cd13e58dcb0f2fbb9f Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Sat, 2 Aug 2025 23:50:42 +0200 Subject: [PATCH 4/6] Improved readability --- .../tx_ultimate_easy/tx_ultimate_easy.cpp | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/components/tx_ultimate_easy/tx_ultimate_easy.cpp b/components/tx_ultimate_easy/tx_ultimate_easy.cpp index 4162176..82f560b 100644 --- a/components/tx_ultimate_easy/tx_ultimate_easy.cpp +++ b/components/tx_ultimate_easy/tx_ultimate_easy.cpp @@ -69,9 +69,9 @@ namespace esphome { if (this->gang_count_ == 1) return 1; - //Calculate button number Change to round up insted of truncate (integer division) + // Calculate button number Change to round up instead of truncate (integer division) const uint8_t width = (TOUCH_MAX_POSITION + gang_count_) / this->gang_count_; // Width of each button region - if (width < 1) // Invalid width - and prevents division by zero removed "width > gang_count_" issue with 2 gang + if (width < 1) // Invalid width - and prevents division by zero return 0; const uint8_t button = std::min( static_cast((position / width) + 1), // Convert position to button index @@ -145,8 +145,14 @@ namespace esphome { case TOUCH_STATE_SWIPE_LEFT: case TOUCH_STATE_SWIPE_RIGHT: + // uart_received_bytes[5] indicates swipe direction: + // 12 = find last touch position (scan right to left) + // 13 = find first touch position (scan left to right) + // Bytes 6-7 contain a 10-bit bitmap of touch positions: + // Byte 7: bits 0-7 represent positions 1-8 + // Byte 6: bits 0-1 represent positions 9-10 switch (uart_received_bytes[5]) { - case 12: { + case 12: for (uint8_t i = 10; i > 0; i--) { if (i > 8 ? uart_received_bytes[6] & (1 << (i - 9)) @@ -155,8 +161,7 @@ namespace esphome { } } break; - } - case 13: { + case 13: for (uint8_t i = 1; i <= 10; i++) { if (i > 8 ? uart_received_bytes[6] & (1 << (i - 9)) @@ -165,9 +170,8 @@ namespace esphome { } } break; - } - return uart_received_bytes[5]; } + return uart_received_bytes[5]; default: return uart_received_bytes[6]; @@ -176,8 +180,10 @@ namespace esphome { int TxUltimateEasy::get_touch_state(const std::array &uart_received_bytes) { int state = uart_received_bytes[4]; - if (state == TOUCH_STATE_PRESS && uart_received_bytes[5] != 0) state = TOUCH_STATE_RELEASE; - if (state == TOUCH_STATE_RELEASE && uart_received_bytes[5] == TOUCH_STATE_MULTI_TOUCH) state = TOUCH_STATE_MULTI_TOUCH; + if (state == TOUCH_STATE_PRESS && uart_received_bytes[5] != 0) + state = TOUCH_STATE_RELEASE; + if (state == TOUCH_STATE_RELEASE && uart_received_bytes[5] == TOUCH_STATE_MULTI_TOUCH) + state = TOUCH_STATE_MULTI_TOUCH; if (state == TOUCH_STATE_SWIPE) { state = (uart_received_bytes[5] == TOUCH_STATE_SWIPE_RIGHT) ? TOUCH_STATE_SWIPE_RIGHT : (uart_received_bytes[5] == TOUCH_STATE_SWIPE_LEFT) ? TOUCH_STATE_SWIPE_LEFT : state; From dcc68f7077fbf79bd36740d3537791a986bc3bfb Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Sat, 2 Aug 2025 23:53:13 +0200 Subject: [PATCH 5/6] Revert defaults --- .github/workflows/versioning.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/versioning.yml b/.github/workflows/versioning.yml index 34e8d95..dc50d74 100644 --- a/.github/workflows/versioning.yml +++ b/.github/workflows/versioning.yml @@ -19,12 +19,12 @@ on: # yamllint disable-line rule:truthy update_stable: description: "Update stable tag?" required: true - default: true + default: false type: boolean update_latest: description: "Update latest tag?" required: true - default: true + default: false type: boolean jobs: From b6dc91546947ed551ade254dc9585dcdf74475aa Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Sat, 2 Aug 2025 23:55:52 +0200 Subject: [PATCH 6/6] use `main` also for advanced --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a9566aa..8368b31 100644 --- a/README.md +++ b/README.md @@ -225,14 +225,14 @@ Here's an example of the advanced configuration: packages: remote_package: url: https://github.com/edwardtfn/TX-Ultimate-Easy - ref: stable # Or you can specify a version, like `ref: v2024.12.6` or `ref: latest` to the latest non-stable + ref: main # Or you can specify a version, like `ref: v2024.12.6` or `ref: latest` refresh: 5min files: # Core (essential) packages - - ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml # Basic shared settings - - ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml # Button logic - - ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml # LED configuration - - ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml # Touch panel support + - ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml # Basic shared settings + - ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml # Button logic + - ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml # LED configuration + - ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml # Touch panel support # Optional but recommended packages - ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml # Relay control