1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 00:05:17 +03:00

Events are transmitted to the Lua telemetry screens. Menus are displayed

over those screens (needed at least for Reset Telemetry/Flight)
This commit is contained in:
bsongis 2014-06-18 22:41:03 +02:00
parent b77d470684
commit b83f95ed1a
2 changed files with 12 additions and 8 deletions

View file

@ -1462,6 +1462,7 @@ void luaTask(uint8_t evt)
if (sid.state == SCRIPT_OK) {
uint8_t prev_mem = lua_gc(L, LUA_GCCOUNT, 0);
SET_LUA_INSTRUCTIONS_COUNT(PERMANENT_SCRIPTS_MAX_INSTRUCTIONS);
int inputsCount = 0;
#if defined(SIMU) || defined(DEBUG)
const char *filename;
#endif
@ -1469,6 +1470,7 @@ void luaTask(uint8_t evt)
if (sid.reference >= SCRIPT_MIX_FIRST && sid.reference <= SCRIPT_MIX_LAST) {
ScriptData & sd = g_model.scriptsData[sid.reference-SCRIPT_MIX_FIRST];
sio = &scriptInputsOutputs[sid.reference-SCRIPT_MIX_FIRST];
inputsCount = sio->inputsCount;
#if defined(SIMU) || defined(DEBUG)
filename = sd.file;
#endif
@ -1496,12 +1498,14 @@ void luaTask(uint8_t evt)
#endif
if (g_menuStack[0]==menuTelemetryFrsky && sid.reference==SCRIPT_TELEMETRY_FIRST+s_frsky_view) {
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
lua_pushinteger(L, evt);
inputsCount = 1;
}
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, inputsCount, sio ? sio->outputsCount : 0, 0) == 0) {
if (sio) {
for (int j=sio->outputsCount-1; j>=0; j--) {
if (!lua_isnumber(L, -1)) {

View file

@ -2760,6 +2760,13 @@ void perMain()
if (!LCD_LOCKED()) {
lcd_clear();
g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
}
#if defined(LUA)
luaTask(evt);
#endif
if (!LCD_LOCKED()) {
if (warn) DISPLAY_WARNING(evt);
#if defined(NAVIGATION_MENUS)
if (menu) {
@ -2769,16 +2776,9 @@ void perMain()
putEvent(EVT_MENU_UP);
}
}
#endif
#if defined(LUA)
evt = 0;
#endif
}
#if defined(LUA)
luaTask(evt);
#endif
drawStatusLine();
lcdRefresh();