Skip to content

Commit

Permalink
fix(lua): ignore potential unwanted key events (#4833)
Browse files Browse the repository at this point in the history
  • Loading branch information
philmoz authored and pfeerick committed Apr 2, 2024
1 parent 9a728cc commit d1840cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions radio/src/lua/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
11 changes: 10 additions & 1 deletion radio/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d1840cb

Please sign in to comment.