From feafd2bc0c94a6e85077543c20a5a626e1e7eea6 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Wed, 14 May 2025 23:33:51 +1200 Subject: [PATCH] Protect T-Echo's touch button against phantom presses in OLED UI (#6735) * Guard T-Echo touch button during LoRa TX * Guard for T-Echo only --------- Co-authored-by: Ben Meadors --- src/ButtonThread.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index 352885dbe..8db52c074 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -300,14 +300,23 @@ int32_t ButtonThread::runOnce() #ifdef BUTTON_PIN_TOUCH case BUTTON_EVENT_TOUCH_LONG_PRESSED: { LOG_BUTTON("Touch press!"); - if (screen) { - // Wake if asleep - if (powerFSM.getState() == &stateDARK) - powerFSM.trigger(EVENT_PRESS); + // Ignore if: no screen + if (!screen) + break; - // Update display (legacy behaviour) - screen->forceDisplay(); - } +#ifdef TTGO_T_ECHO + // Ignore if: TX in progress + // Uncommon T-Echo hardware bug, LoRa TX triggers touch button + if (!RadioLibInterface::instance || RadioLibInterface::instance->isSending()) + break; +#endif + + // Wake if asleep + if (powerFSM.getState() == &stateDARK) + powerFSM.trigger(EVENT_PRESS); + + // Update display (legacy behaviour) + screen->forceDisplay(); break; } #endif // BUTTON_PIN_TOUCH