Fixed Lua error messages in standalone and telemetry scripts - again. There is still a problem that the call to POPUP_WARNING in displayLuaError does not return and the gui goes dark on colorlcd. Could it be long jump?
This commit is contained in:
@@ -157,16 +157,21 @@ void StandaloneLuaWindow::runLua(event_t evt)
|
|||||||
|
|
||||||
TRACE("evt = 0x%x", evt);
|
TRACE("evt = 0x%x", evt);
|
||||||
|
|
||||||
bool hasRun = luaTask(evt, RUN_STNDAL_SCRIPT, true);
|
bool hasRun = luaTask(evt, true);
|
||||||
|
|
||||||
|
if (luaState == INTERPRETER_RELOAD_PERMANENT_SCRIPTS) {
|
||||||
|
// Script does not run anymore...
|
||||||
|
TRACE("LUA standalone script exited: deleting window!");
|
||||||
|
deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
if (hasRun) {
|
if (hasRun) {
|
||||||
#if defined(DEBUG_WINDOWS)
|
#if defined(DEBUG_WINDOWS)
|
||||||
TRACE("# StandaloneLuaWindow::invalidate()");
|
TRACE("# StandaloneLuaWindow::invalidate()");
|
||||||
#endif
|
#endif
|
||||||
invalidate();
|
invalidate();
|
||||||
} else {
|
} else {
|
||||||
// Script does not run anymore...
|
// The script was preempted, and the LCD should not be updated yet
|
||||||
TRACE("LUA standalone script exited: deleting window!");
|
|
||||||
deleteLater();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kill global LUA LCD buffer
|
// Kill global LUA LCD buffer
|
||||||
|
|||||||
@@ -912,15 +912,12 @@ static void luaLoadScripts(bool init, const char * filename = nullptr)
|
|||||||
|
|
||||||
if (initFunction != LUA_NOREF)
|
if (initFunction != LUA_NOREF)
|
||||||
TRACE_ERROR("luaLoadScripts(%s): init function: %s\n", getScriptName(idx), lua_tostring(lsScripts, -1));
|
TRACE_ERROR("luaLoadScripts(%s): init function: %s\n", getScriptName(idx), lua_tostring(lsScripts, -1));
|
||||||
luaL_unref(lsScripts, LUA_REGISTRYINDEX, initFunction);
|
else
|
||||||
lua_settop(lsScripts, 0);
|
|
||||||
initFunction = LUA_NOREF;
|
|
||||||
} else
|
|
||||||
TRACE_ERROR("luaLoadScripts(%s): %s\n", getScriptName(idx), lua_tostring(lsScripts, -1));
|
TRACE_ERROR("luaLoadScripts(%s): %s\n", getScriptName(idx), lua_tostring(lsScripts, -1));
|
||||||
|
|
||||||
if (ref == SCRIPT_STANDALONE) {
|
if (ref == SCRIPT_STANDALONE) {
|
||||||
luaError(lsScripts, sid.state);
|
|
||||||
luaState = INTERPRETER_RELOAD_PERMANENT_SCRIPTS;
|
luaState = INTERPRETER_RELOAD_PERMANENT_SCRIPTS;
|
||||||
|
luaError(lsScripts, sid.state, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user