mirror of
https://github.com/opentx/opentx.git
synced 2025-07-14 11:59:50 +03:00
Projectkk2glider/lua bitmap free (#4075)
* Better memory stats (CLI) * Bitmap buffer overflow check added * Lua bitmap improvements * Proper handling of symbolic links in simulator * S6R Lua script fixes: * added progress screen while loading bitmaps * memory for bitmaps is now freed when leaving the script * S6R Lua script: improved bitmap loading * * Lua Themes and Widgets moved to separate file and separate Lua state * Stand-alone, mixer and function scripts now behave the same as on Taranis (restarted after the stand-alone script was run) * both Lua states are independent: Themes and Widgets is initialized only at the start, the other one is initialized before and after the stand-alone script is run * Better leak test and report in BitmapBuffer * Re #3318: Lua compiler enabled in simu and Companion simulator. Usage: * any time <xxx>.lua file is about to be loaded and if file <xxx>.lua.src exists: * load contents of <xxx>.lua.src * compile Lua code * save compiled code into <xxx>.lua (effectively overwrites existing file) * immediately following the compilation the real file loading is done from <xxx>.lua (which by now contains compiled Lua bytecode)
This commit is contained in:
parent
ae383cd6a4
commit
92553b6589
18 changed files with 745 additions and 554 deletions
|
@ -28,12 +28,16 @@ extern "C" {
|
|||
#include <lauxlib.h>
|
||||
#include <lualib.h>
|
||||
#include <lrotable.h>
|
||||
#include <lgc.h>
|
||||
}
|
||||
|
||||
extern lua_State *L;
|
||||
extern lua_State * lsScripts;
|
||||
extern lua_State * lsWidgets;
|
||||
extern bool luaLcdAllowed;
|
||||
|
||||
void luaInit();
|
||||
void luaInitThemesAndWidgets();
|
||||
|
||||
|
||||
#define lua_registernumber(L, n, i) (lua_pushnumber(L, (i)), lua_setglobal(L, (n)))
|
||||
#define lua_registerint(L, n, i) (lua_pushinteger(L, (i)), lua_setglobal(L, (n)))
|
||||
|
@ -99,12 +103,12 @@ extern uint8_t luaScriptsCount;
|
|||
extern ScriptInternalData standaloneScript;
|
||||
extern ScriptInternalData scriptInternalData[MAX_SCRIPTS];
|
||||
extern ScriptInputsOutputs scriptInputsOutputs[MAX_SCRIPTS];
|
||||
void luaClose();
|
||||
void luaClose(lua_State * L);
|
||||
bool luaTask(event_t evt, uint8_t scriptType, bool allowLcdUsage);
|
||||
void luaExec(const char * filename);
|
||||
void luaError(uint8_t error, bool acknowledge=true);
|
||||
int luaGetMemUsed();
|
||||
void luaGetValueAndPush(int src);
|
||||
void luaError(lua_State * L, uint8_t error, bool acknowledge=true);
|
||||
int luaGetMemUsed(lua_State * L);
|
||||
void luaGetValueAndPush(lua_State * L, int src);
|
||||
#define luaGetCpuUsed(idx) scriptInternalData[idx].instructions
|
||||
uint8_t isTelemetryScriptAvailable(uint8_t index);
|
||||
#define LUA_LOAD_MODEL_SCRIPTS() luaState |= INTERPRETER_RELOAD_PERMANENT_SCRIPTS
|
||||
|
@ -137,7 +141,10 @@ struct LuaField {
|
|||
};
|
||||
bool luaFindFieldByName(const char * name, LuaField & field, unsigned int flags=0);
|
||||
void luaLoadThemes();
|
||||
void luaRegisterLibraries(lua_State * L);
|
||||
void registerBitmapClass(lua_State * L);
|
||||
void luaSetInstructionsLimit(lua_State* L, int count);
|
||||
void luaCompileAndSave(lua_State * L, const char *bytecodeName);
|
||||
#else // defined(LUA)
|
||||
#define luaInit()
|
||||
#define LUA_LOAD_MODEL_SCRIPTS()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue