Fixing standalone scripts with preemption on colorlcd

This commit is contained in:
jfrickmann
2021-07-22 15:02:44 -04:00
parent dcac3cb9da
commit 76d2ef54e3
+9 -11
View File
@@ -155,17 +155,8 @@ void StandaloneLuaWindow::runLua(event_t evt)
// Set global LUA LCD buffer // Set global LUA LCD buffer
luaLcdBuffer = &lcdBuffer; luaLcdBuffer = &lcdBuffer;
TRACE("evt = 0x%x", evt); if (luaState != INTERPRETER_RELOAD_PERMANENT_SCRIPTS) {
if (luaTask(evt, 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 defined(DEBUG_WINDOWS) #if defined(DEBUG_WINDOWS)
TRACE("# StandaloneLuaWindow::invalidate()"); TRACE("# StandaloneLuaWindow::invalidate()");
#endif #endif
@@ -173,6 +164,13 @@ void StandaloneLuaWindow::runLua(event_t evt)
} else { } else {
// The script was preempted, and the LCD should not be updated yet // The script was preempted, and the LCD should not be updated yet
} }
}
if (luaState == INTERPRETER_RELOAD_PERMANENT_SCRIPTS) {
// Script does not run anymore...
TRACE("LUA standalone script exited: deleting window!");
deleteLater();
}
// Kill global LUA LCD buffer // Kill global LUA LCD buffer
luaLcdBuffer = nullptr; luaLcdBuffer = nullptr;