mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 01:35:21 +03:00
background function added to Lua scripts (used only in telemetry
scripts)
This commit is contained in:
parent
ec81b078fe
commit
b77d470684
2 changed files with 11 additions and 4 deletions
|
@ -1173,6 +1173,10 @@ int luaLoad(const char *filename, ScriptInternalData & sid, ScriptInputsOutputs
|
||||||
sid.run = luaL_ref(L, LUA_REGISTRYINDEX);
|
sid.run = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(key, "background")) {
|
||||||
|
sid.background = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
else if (sio && !strcmp(key, "input")) {
|
else if (sio && !strcmp(key, "input")) {
|
||||||
luaGetInputs(*sio);
|
luaGetInputs(*sio);
|
||||||
}
|
}
|
||||||
|
@ -1487,13 +1491,15 @@ void luaTask(uint8_t evt)
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
|
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (g_menuStack[0]!=menuTelemetryFrsky || sid.reference!=SCRIPT_TELEMETRY_FIRST+s_frsky_view) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#if defined(SIMU) || defined(DEBUG)
|
#if defined(SIMU) || defined(DEBUG)
|
||||||
filename = "[telem]";
|
filename = "[telem]";
|
||||||
#endif
|
#endif
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
|
if (g_menuStack[0]==menuTelemetryFrsky && sid.reference==SCRIPT_TELEMETRY_FIRST+s_frsky_view) {
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
|
||||||
|
}
|
||||||
|
else if (sid.background) {
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.background);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (lua_pcall(L, sio ? sio->inputsCount : 0, sio ? sio->outputsCount : 0, 0) == 0) {
|
if (lua_pcall(L, sio ? sio->inputsCount : 0, sio ? sio->outputsCount : 0, 0) == 0) {
|
||||||
if (sio) {
|
if (sio) {
|
||||||
|
|
|
@ -1464,6 +1464,7 @@ enum AUDIO_SOUNDS {
|
||||||
uint8_t reference;
|
uint8_t reference;
|
||||||
uint8_t state;
|
uint8_t state;
|
||||||
int run;
|
int run;
|
||||||
|
int background;
|
||||||
uint8_t instructions;
|
uint8_t instructions;
|
||||||
uint8_t memory;
|
uint8_t memory;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue