From 0d84acef59c9fb2361e7e442e74db94e71500be9 Mon Sep 17 00:00:00 2001 From: philmoz Date: Tue, 2 Apr 2024 11:52:17 +1100 Subject: [PATCH] fix(lua): ignore potential unwanted key events (#4833) --- radio/src/lua/interface.cpp | 1 + radio/src/main.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/radio/src/lua/interface.cpp b/radio/src/lua/interface.cpp index 853bcd42f..2234ee15d 100644 --- a/radio/src/lua/interface.cpp +++ b/radio/src/lua/interface.cpp @@ -1191,6 +1191,7 @@ static bool resumeLua(bool init, bool allowLcdUsage) if (scriptResult != 0) { TRACE("Script finished with status %d", scriptResult); + killAllEvents(); luaState = INTERPRETER_RELOAD_PERMANENT_SCRIPTS; } else if (luaDisplayStatistics) { diff --git a/radio/src/main.cpp b/radio/src/main.cpp index 2b6eda4ae..2e26ff66e 100644 --- a/radio/src/main.cpp +++ b/radio/src/main.cpp @@ -438,7 +438,16 @@ bool handleGui(event_t event) { menuHandlers[menuLevel] == menuViewTelemetry && TELEMETRY_SCREEN_TYPE(s_frsky_view) == TELEMETRY_SCREEN_TYPE_SCRIPT; bool isStandalone = scriptInternalData[0].reference == SCRIPT_STANDALONE; - if (isTelemView || isStandalone) luaPushEvent(event); + if ((isTelemView || isStandalone) && event) { +#if !defined(KEYS_GPIO_REG_PAGEUP) + // For radios with a single PAGE key, kill the + // EVT_KEY_BREAK event after a long press of the PAGE key. + if (event == EVT_KEY_LONG(KEY_PAGE)) { + killEvents(KEY_PAGE); + } +#endif + luaPushEvent(event); + } refreshNeeded = luaTask(true); if (isTelemView) menuHandlers[menuLevel](event);