Fix standalone Lua script screen flicker and improve error messages (#982)
* Relax assumptions about when Lua is called in foreground and background * Start Lua cycle timer both in foreground and background Do not assume that background/foreground alternates * Lua is called at every Standalone GUI cycle instead of 5 Hz Since Lua preempts every 50 ms or so, the GUI should remain responsive. * In standalone script, only call Lua once per GUI cycle, to avoid messing up buffer handling. * Revamped error reporting for Standalone and Telemetry Lua scripts * Font size for Lua error is reduced from XL to L on color if LCD_W < LCD_H * In drawTextLines, also possible linebreaks for opening brackets. * Smaller font for error message on tall color screen * Make titlebar height match font size on narrow LCD
This commit is contained in:
@@ -170,18 +170,7 @@ bool displayTelemetryScreen()
|
||||
{
|
||||
#if defined(LUA)
|
||||
if (TELEMETRY_SCREEN_TYPE(s_frsky_view) == TELEMETRY_SCREEN_TYPE_SCRIPT) {
|
||||
uint8_t state = isTelemetryScriptAvailable(s_frsky_view);
|
||||
switch (state) {
|
||||
case SCRIPT_OK:
|
||||
return true; // contents will be drawed by Lua Task
|
||||
case SCRIPT_NOFILE:
|
||||
return false; // requested lua telemetry screen not available
|
||||
case SCRIPT_SYNTAX_ERROR:
|
||||
case SCRIPT_PANIC:
|
||||
luaError(lsScripts, state, false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return isTelemetryScriptAvailable(); // contents will be drawn by Lua Task
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -195,7 +184,5 @@ bool displayTelemetryScreen()
|
||||
return displayCustomTelemetryScreen(s_frsky_view);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user