From 02cff3389db281bac779b73b51ecd7a560124f7d Mon Sep 17 00:00:00 2001 From: Kaj Schittecat Date: Wed, 24 Jun 2026 08:08:16 +0200 Subject: [PATCH] touch: tap-to-edit on touch focus + map-render watchdog yield MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Keyboard nav: tapping a text field by touch now enters edit mode immediately (focus came from the pointer indev) instead of requiring Enter. Reaching a field with the letter-nav keys still starts in navigate mode (press Enter). - Map: yield to IDLE after each tile in renderMapTiles() so a slow multi-tile render on loopTask can't starve the task watchdog and panic — fixes a beta_14 TWDT reboot seen during map use (CPU1=loopTask). The download worker already does the same vTaskDelay(1) on its side. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/ui-touch/UITask.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/ui-touch/UITask.cpp b/src/ui-touch/UITask.cpp index f5fd06c..48f7b30 100644 --- a/src/ui-touch/UITask.cpp +++ b/src/ui-touch/UITask.cpp @@ -1815,11 +1815,14 @@ static bool s_nav_ta_editing = false; static void navFocusCb(lv_group_t* g) { lv_obj_t* f = lv_group_get_focused(g); - // Edit mode on focus: the chat composer auto-edits (you opened the chat to type, and the - // cursor shows immediately); every OTHER field starts in navigate mode so the letter-nav - // keys keep working — press select/Enter to edit it. Esc/Enter on an empty composer drops - // it back to navigate mode (handled in navPump / handleHwKey). - s_nav_ta_editing = (f != nullptr && (f == g_lv.ch.composer_ta || f == g_lv.dm.composer_ta)); + // Edit mode on focus: the chat composer auto-edits (you opened the chat to type), and a + // field focused by a TOUCH tap edits immediately too — a touch user pointed right at it and + // shouldn't have to press Enter. Every OTHER field (reached with the letter-nav keys) starts + // in navigate mode so those keys keep working — press select/Enter to edit it. Esc/Enter on + // an empty composer drops it back to navigate mode (handled in navPump / handleHwKey). + lv_indev_t* act = lv_indev_get_act(); // the indev driving this focus change (null if programmatic) + const bool by_touch = act && lv_indev_get_type(act) == LV_INDEV_TYPE_POINTER; + s_nav_ta_editing = (f != nullptr && (by_touch || f == g_lv.ch.composer_ta || f == g_lv.dm.composer_ta)); if (s_nav_styled && s_nav_styled != f) navUnstyle(s_nav_styled); s_nav_styled = nullptr; // old highlight (if any) is now restored; nothing styled yet if (!f || !s_nav_show) return; // focus-visible: paint only while actively keyboard-navigating @@ -17009,6 +17012,12 @@ static void renderMapTiles() { // Wi-Fi worker holds a socket pushed the heap into an OOM reboot. When tiles // are arriving from the network, let LVGL batch one redraw at the end. if (s_tile_fetch_pending == 0) lv_refr_now(NULL); + // Yield to the IDLE task after each tile's read + decode + paint. This loop + // runs on loopTask, which is what the task watchdog watches via IDLE1; a full + // 9-tile load (or a few slow SD reads) can otherwise pin the core long enough + // to starve IDLE1 and panic (the loopTask Task-WDT reboot this fixes — the + // download worker already does the same vTaskDelay(1) on its side). + vTaskDelay(1); } #if defined(ESP32) && defined(MULTI_TRANSPORT_COMPANION)