Close cards through one path so the page swipe is never left blocked (0.2.32)

Read live on a Guition: every edge swipe was recognised but refused by the
"card open" check, because the light, climate and vacuum cards cleared
their overlay on close (X, tap beside the card, wake from standby) without
forgetting active_entity. One opened card blocked swiping until the next
layout change; the old whole-screen gesture and the CYD had the same gate.
Both boards now close cards through one script, close_cards, which hides
every overlay and clears that state; wake_display uses it too.

The Guition edge swipe now follows LVGL's own pointer events
(lv_indev_add_event_cb: PRESSED begins, PRESSING flips the page and calls
lv_indev_wait_release from inside LVGL) instead of ESPHome's touchscreen
on_update, so the point arrives already rotated. The direction rule is 45
degrees instead of twice as horizontal, and the log now says why a swipe
was refused or how far an unfinished one got. Firmware 0.2.27 for both
boards; the app only moves its target version.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Max Gramser
2026-09-14 13:09:53 +02:00
parent 95cdfa30cf
commit b9e1dfbd95
11 changed files with 248 additions and 109 deletions
+21 -11
View File
@@ -59,7 +59,7 @@
############################################################
substitutions:
SCREEN_FIRMWARE_VERSION: "0.2.26"
SCREEN_FIRMWARE_VERSION: "0.2.27"
# A tap survives a finger that drifts up to this far (320 px over 58 mm: 1 cm); further is a swipe.
TOUCH_MOVE_LIMIT_PX: "56"
# Shortest contact that counts as a tap; a resistive panel bounces, a capacitive one does not.
@@ -3539,7 +3539,7 @@ lvgl:
scrollable: false
clickable: true
on_click:
- lvgl.widget.hide: brightness_overlay
- script.execute: close_cards
- obj:
id: brightness_overlay_dim
@@ -3880,7 +3880,7 @@ lvgl:
clickable: true
scrollable: false
on_click:
- lvgl.widget.hide: color_detail_overlay
- script.execute: close_cards
widgets:
- label:
align: CENTER
@@ -3913,7 +3913,7 @@ lvgl:
clickable: true
scrollable: false
on_click:
- lvgl.widget.hide: color_detail_overlay
- script.execute: close_cards
widgets:
- label:
align: CENTER
@@ -3979,7 +3979,7 @@ lvgl:
clickable: true
scrollable: false
on_click:
- lvgl.widget.hide: climate_detail_overlay
- script.execute: close_cards
widgets:
- label:
align: CENTER
@@ -4836,7 +4836,7 @@ lvgl:
clickable: true
scrollable: false
on_click:
- lvgl.widget.hide: vacuum_overlay
- script.execute: close_cards
widgets:
- label:
align: CENTER
@@ -4859,7 +4859,7 @@ lvgl:
clickable: true
scrollable: false
on_click:
- lvgl.widget.hide: vacuum_overlay
- script.execute: close_cards
widgets:
- label:
align: CENTER
@@ -5087,6 +5087,19 @@ script:
else lv_obj_add_flag(id(lbl_time), LV_OBJ_FLAG_HIDDEN);
if (!id(ui_refresh).is_running()) id(ui_refresh).execute();
- id: close_cards
then:
- lambda: |-
// Runtime cards and the legacy overlays close through one path; the swipe guard
// reads active_entity, so a hidden card must never leave it behind.
if (runtime_tiles::dismiss) { runtime_tiles::dismiss(); return; }
id(active_entity).clear();
- lvgl.widget.hide: brightness_overlay
- lvgl.widget.hide: color_detail_overlay
- lvgl.widget.hide: climate_detail_overlay
- lvgl.widget.hide: climate_mode_overlay
- lvgl.widget.hide: vacuum_overlay
- id: wake_display
mode: restart
then:
@@ -5100,10 +5113,7 @@ script:
transition_length: 80ms
brightness: !lambda "return screen_settings::current.brightness / 100.0f;"
- lvgl.widget.hide: dim_wake_overlay
- lvgl.widget.hide: color_detail_overlay
- lvgl.widget.hide: climate_detail_overlay
- lvgl.widget.hide: climate_mode_overlay
- lvgl.widget.hide: vacuum_overlay
- script.execute: close_cards
- id: dim_display
mode: restart