Fixing standalone scripts with preemption on colorlcd
This commit is contained in:
@@ -155,25 +155,23 @@ 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)) {
|
||||||
|
#if defined(DEBUG_WINDOWS)
|
||||||
|
TRACE("# StandaloneLuaWindow::invalidate()");
|
||||||
|
#endif
|
||||||
|
invalidate();
|
||||||
|
} else {
|
||||||
|
// The script was preempted, and the LCD should not be updated yet
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool hasRun = luaTask(evt, true);
|
|
||||||
|
|
||||||
if (luaState == INTERPRETER_RELOAD_PERMANENT_SCRIPTS) {
|
if (luaState == INTERPRETER_RELOAD_PERMANENT_SCRIPTS) {
|
||||||
// Script does not run anymore...
|
// Script does not run anymore...
|
||||||
TRACE("LUA standalone script exited: deleting window!");
|
TRACE("LUA standalone script exited: deleting window!");
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasRun) {
|
|
||||||
#if defined(DEBUG_WINDOWS)
|
|
||||||
TRACE("# StandaloneLuaWindow::invalidate()");
|
|
||||||
#endif
|
|
||||||
invalidate();
|
|
||||||
} else {
|
|
||||||
// The script was preempted, and the LCD should not be updated yet
|
|
||||||
}
|
|
||||||
|
|
||||||
// Kill global LUA LCD buffer
|
// Kill global LUA LCD buffer
|
||||||
luaLcdBuffer = nullptr;
|
luaLcdBuffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user