mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +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:
parent
b77d470684
commit
b83f95ed1a
2 changed files with 12 additions and 8 deletions
|
@ -1462,6 +1462,7 @@ void luaTask(uint8_t evt)
|
||||||
if (sid.state == SCRIPT_OK) {
|
if (sid.state == SCRIPT_OK) {
|
||||||
uint8_t prev_mem = lua_gc(L, LUA_GCCOUNT, 0);
|
uint8_t prev_mem = lua_gc(L, LUA_GCCOUNT, 0);
|
||||||
SET_LUA_INSTRUCTIONS_COUNT(PERMANENT_SCRIPTS_MAX_INSTRUCTIONS);
|
SET_LUA_INSTRUCTIONS_COUNT(PERMANENT_SCRIPTS_MAX_INSTRUCTIONS);
|
||||||
|
int inputsCount = 0;
|
||||||
#if defined(SIMU) || defined(DEBUG)
|
#if defined(SIMU) || defined(DEBUG)
|
||||||
const char *filename;
|
const char *filename;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1469,6 +1470,7 @@ void luaTask(uint8_t evt)
|
||||||
if (sid.reference >= SCRIPT_MIX_FIRST && sid.reference <= SCRIPT_MIX_LAST) {
|
if (sid.reference >= SCRIPT_MIX_FIRST && sid.reference <= SCRIPT_MIX_LAST) {
|
||||||
ScriptData & sd = g_model.scriptsData[sid.reference-SCRIPT_MIX_FIRST];
|
ScriptData & sd = g_model.scriptsData[sid.reference-SCRIPT_MIX_FIRST];
|
||||||
sio = &scriptInputsOutputs[sid.reference-SCRIPT_MIX_FIRST];
|
sio = &scriptInputsOutputs[sid.reference-SCRIPT_MIX_FIRST];
|
||||||
|
inputsCount = sio->inputsCount;
|
||||||
#if defined(SIMU) || defined(DEBUG)
|
#if defined(SIMU) || defined(DEBUG)
|
||||||
filename = sd.file;
|
filename = sd.file;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1496,12 +1498,14 @@ void luaTask(uint8_t evt)
|
||||||
#endif
|
#endif
|
||||||
if (g_menuStack[0]==menuTelemetryFrsky && sid.reference==SCRIPT_TELEMETRY_FIRST+s_frsky_view) {
|
if (g_menuStack[0]==menuTelemetryFrsky && sid.reference==SCRIPT_TELEMETRY_FIRST+s_frsky_view) {
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
|
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
|
||||||
|
lua_pushinteger(L, evt);
|
||||||
|
inputsCount = 1;
|
||||||
}
|
}
|
||||||
else if (sid.background) {
|
else if (sid.background) {
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, 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) {
|
if (sio) {
|
||||||
for (int j=sio->outputsCount-1; j>=0; j--) {
|
for (int j=sio->outputsCount-1; j>=0; j--) {
|
||||||
if (!lua_isnumber(L, -1)) {
|
if (!lua_isnumber(L, -1)) {
|
||||||
|
|
|
@ -2760,6 +2760,13 @@ void perMain()
|
||||||
if (!LCD_LOCKED()) {
|
if (!LCD_LOCKED()) {
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
|
g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(LUA)
|
||||||
|
luaTask(evt);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!LCD_LOCKED()) {
|
||||||
if (warn) DISPLAY_WARNING(evt);
|
if (warn) DISPLAY_WARNING(evt);
|
||||||
#if defined(NAVIGATION_MENUS)
|
#if defined(NAVIGATION_MENUS)
|
||||||
if (menu) {
|
if (menu) {
|
||||||
|
@ -2769,16 +2776,9 @@ void perMain()
|
||||||
putEvent(EVT_MENU_UP);
|
putEvent(EVT_MENU_UP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if defined(LUA)
|
|
||||||
evt = 0;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LUA)
|
|
||||||
luaTask(evt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
drawStatusLine();
|
drawStatusLine();
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue