Move lua evt param from signed uint8_t to unsigned event_t

This commit is contained in:
3djc
2016-09-12 07:20:06 +02:00
parent 0f217b3507
commit d84fd993c9
3 changed files with 12 additions and 6 deletions
+6
View File
@@ -1014,6 +1014,12 @@ const luaR_value_entry opentxConstants[] = {
{ "EVT_MINUS_FIRST", EVT_KEY_FIRST(KEY_MINUS) }, { "EVT_MINUS_FIRST", EVT_KEY_FIRST(KEY_MINUS) },
{ "EVT_PLUS_REPT", EVT_KEY_REPT(KEY_PLUS) }, { "EVT_PLUS_REPT", EVT_KEY_REPT(KEY_PLUS) },
{ "EVT_MINUS_REPT", EVT_KEY_REPT(KEY_MINUS) }, { "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 }, { "FILL_WHITE", FILL_WHITE },
{ "GREY_DEFAULT", GREY_DEFAULT }, { "GREY_DEFAULT", GREY_DEFAULT },
{ "FORCE", FORCE }, { "FORCE", FORCE },
+3 -3
View File
@@ -517,7 +517,7 @@ void luaDoOneRunStandalone(event_t evt)
if (standaloneScript.state == SCRIPT_OK && standaloneScript.run) { if (standaloneScript.state == SCRIPT_OK && standaloneScript.run) {
SET_LUA_INSTRUCTIONS_COUNT(MANUAL_SCRIPTS_MAX_INSTRUCTIONS); SET_LUA_INSTRUCTIONS_COUNT(MANUAL_SCRIPTS_MAX_INSTRUCTIONS);
lua_rawgeti(L, LUA_REGISTRYINDEX, standaloneScript.run); 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_pcall(L, 1, 1, 0) == 0) {
if (!lua_isnumber(L, -1)) { if (!lua_isnumber(L, -1)) {
if (instructionsPercent > 100) { if (instructionsPercent > 100) {
@@ -636,7 +636,7 @@ bool luaDoOneRunPermanentScript(uint8_t evt, int i, uint32_t scriptType)
#endif #endif
if ((scriptType & RUN_TELEM_FG_SCRIPT) && (menuHandlers[0]==menuViewTelemetryFrsky && sid.reference==SCRIPT_TELEMETRY_FIRST+s_frsky_view)) { 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_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
lua_pushinteger(L, evt); lua_pushunsigned(L, evt);
inputsCount = 1; inputsCount = 1;
} }
else if ((scriptType & RUN_TELEM_BG_SCRIPT) && (sid.background)) { 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; if (luaState == INTERPRETER_PANIC) return false;
luaLcdAllowed = allowLcdUsage; luaLcdAllowed = allowLcdUsage;
+1 -1
View File
@@ -100,7 +100,7 @@ extern ScriptInternalData standaloneScript;
extern ScriptInternalData scriptInternalData[MAX_SCRIPTS]; extern ScriptInternalData scriptInternalData[MAX_SCRIPTS];
extern ScriptInputsOutputs scriptInputsOutputs[MAX_SCRIPTS]; extern ScriptInputsOutputs scriptInputsOutputs[MAX_SCRIPTS];
void luaClose(); 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 luaExec(const char * filename);
void luaError(uint8_t error, bool acknowledge=true); void luaError(uint8_t error, bool acknowledge=true);
int luaGetMemUsed(); int luaGetMemUsed();