From 7d98d359ee75c5ea47a3abe333747fbfd008c1f2 Mon Sep 17 00:00:00 2001 From: Kaj Schittecat Date: Sat, 22 Aug 2026 18:58:45 +0200 Subject: [PATCH] console mode: bring up the input hardware ourselves MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keys did nothing on the T-Deck because nothing was scanning them. The touch and keyboard poll task is started inside UITask::loop(), below the console early return AND behind 'if (!g_lv.ready) return;' — and g_lv.ready is false in console mode, since that is the LVGL flag and LVGL is never initialised. So tdeckKeyboardBegin() was never called and the ring the drain reads was always empty. Console mode now starts it once itself. One call covers both: the background poll task owns the shared I2C bus and scans the touch panel and, on the T-Deck, the keyboard. Which is exactly why it must not be polled from two places. Co-Authored-By: Claude Opus 5 --- src/ui-touch/UITask.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ui-touch/UITask.cpp b/src/ui-touch/UITask.cpp index c05ffe4..45071f6 100644 --- a/src/ui-touch/UITask.cpp +++ b/src/ui-touch/UITask.cpp @@ -51977,8 +51977,26 @@ void UITask::loop() { unsigned long now = millis(); #if CAP_CONSOLE if (s_console_mode) { +#if CAP_TOUCH + // Bring up the input hardware ourselves. The graphical path does this far + // below, behind `if (!g_lv.ready) return;` — and g_lv.ready is false here + // because LVGL is never initialised, so nothing ever started the poll task + // and the keyboard was never even begun. That is why keys did nothing. + // + // One call covers both: the background poll task owns the shared I2C bus + // and scans the touch panel AND (on the T-Deck) the keyboard, which is + // exactly why they must not be polled from two places at once. + static bool s_con_input_up = false; + if (!s_con_input_up) { + if (heltecV4CapTouchBegin()) { + heltecV4CapTouchStartBackgroundPoll(8); + s_con_input_up = true; + } + } +#endif // The physical-keyboard drain lives further down this function, below this - // return, so console mode has to do its own. Same source, same buffer. + // return, so console mode has to do its own. Same ring, filled by the task + // started above. #if defined(HAS_TDECK_KEYBOARD) for (int kbi = 0; kbi < 12; ++kbi) { int key = tdeckKeyboardReadKey();