diff --git a/radio/src/lua/api_general.cpp b/radio/src/lua/api_general.cpp index 72f9e5927..b76a248ea 100644 --- a/radio/src/lua/api_general.cpp +++ b/radio/src/lua/api_general.cpp @@ -511,11 +511,11 @@ This is just a hardware pass/fail measure and does not represent the quality of */ static int luaGetRAS(lua_State * L) { - if (IS_SWR_VALUE_VALID()) { + if (IS_SWR_VALUE_VALID()) { lua_pushinteger(L, telemetryData.swr.value); } else { - lua_pushnil(L); + lua_pushnil(L); } return 1; } @@ -1014,6 +1014,12 @@ const luaR_value_entry opentxConstants[] = { { "EVT_MINUS_FIRST", EVT_KEY_FIRST(KEY_MINUS) }, { "EVT_PLUS_REPT", EVT_KEY_REPT(KEY_PLUS) }, { "EVT_MINUS_REPT", EVT_KEY_REPT(KEY_MINUS) }, +#if defined(ROTARY_ENCODER_NAVIGATION) + { "EVT_ROT_BREAK", EVT_KEY_BREAK(KEY_ENTER) }, + { "EVT_ROT_LONG", EVT_KEY_LONG(KEY_ENTER) }, + { "EVT_ROT_LEFT", EVT_ROTARY_LEFT }, + { "EVT_ROT_RIGHT", EVT_ROTARY_RIGHT }, +#endif { "FILL_WHITE", FILL_WHITE }, { "GREY_DEFAULT", GREY_DEFAULT }, { "FORCE", FORCE }, diff --git a/radio/src/lua/interface.cpp b/radio/src/lua/interface.cpp index fd019dfa8..253bffe76 100644 --- a/radio/src/lua/interface.cpp +++ b/radio/src/lua/interface.cpp @@ -517,7 +517,7 @@ void luaDoOneRunStandalone(event_t evt) if (standaloneScript.state == SCRIPT_OK && standaloneScript.run) { SET_LUA_INSTRUCTIONS_COUNT(MANUAL_SCRIPTS_MAX_INSTRUCTIONS); lua_rawgeti(L, LUA_REGISTRYINDEX, standaloneScript.run); - lua_pushinteger(L, evt); + lua_pushunsigned(L, evt); if (lua_pcall(L, 1, 1, 0) == 0) { if (!lua_isnumber(L, -1)) { if (instructionsPercent > 100) { @@ -636,7 +636,7 @@ bool luaDoOneRunPermanentScript(uint8_t evt, int i, uint32_t scriptType) #endif if ((scriptType & RUN_TELEM_FG_SCRIPT) && (menuHandlers[0]==menuViewTelemetryFrsky && sid.reference==SCRIPT_TELEMETRY_FIRST+s_frsky_view)) { lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run); - lua_pushinteger(L, evt); + lua_pushunsigned(L, evt); inputsCount = 1; } else if ((scriptType & RUN_TELEM_BG_SCRIPT) && (sid.background)) { @@ -707,7 +707,7 @@ void luaDoGc() } } -bool luaTask(uint8_t evt, uint8_t scriptType, bool allowLcdUsage) +bool luaTask(event_t evt, uint8_t scriptType, bool allowLcdUsage) { if (luaState == INTERPRETER_PANIC) return false; luaLcdAllowed = allowLcdUsage; diff --git a/radio/src/lua/lua_api.h b/radio/src/lua/lua_api.h index de9ac43d9..bd9037082 100644 --- a/radio/src/lua/lua_api.h +++ b/radio/src/lua/lua_api.h @@ -100,7 +100,7 @@ extern ScriptInternalData standaloneScript; extern ScriptInternalData scriptInternalData[MAX_SCRIPTS]; extern ScriptInputsOutputs scriptInputsOutputs[MAX_SCRIPTS]; void luaClose(); -bool luaTask(uint8_t evt, uint8_t scriptType, bool allowLcdUsage); +bool luaTask(event_t evt, uint8_t scriptType, bool allowLcdUsage); void luaExec(const char * filename); void luaError(uint8_t error, bool acknowledge=true); int luaGetMemUsed();