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

[Companion] Horus simulator fixes

This commit is contained in:
Bertrand Songis 2016-12-02 19:56:31 +01:00
parent 9b3cd8eeff
commit c23ac292b7
4 changed files with 14 additions and 14 deletions

View file

@ -33,18 +33,18 @@ telemetryStreaming = 20;
#ifdef SETVALUES_IMPORT
#undef SETVALUES_IMPORT
for (int i=0; i<CPN_MAX_STICKS; i++)
for (int i=0; i<NUM_STICKS; i++)
g_anas[i] = inputs.sticks[i];
for (int i=0; i<NUM_POTS+NUM_SLIDERS; i++)
g_anas[CPN_MAX_STICKS+i] = inputs.pots[i];
g_anas[NUM_STICKS+i] = inputs.pots[i];
for (int i=0; i<CPN_MAX_SWITCHES; i++)
simuSetSwitch(i, inputs.switches[i]);
for (int i=0; i<CPN_MAX_KEYS; i++)
simuSetKey(i, inputs.keys[i]);
for (int i=0; i<(CPN_MAX_STICKS+NUM_AUX_TRIMS)*2; i++)
for (int i=0; i<(NUM_STICKS+NUM_AUX_TRIMS)*2; i++)
simuSetTrim(i, inputs.trims[i]);
#ifdef PCBGRUVIN9X
#if defined(PCBGRUVIN9X)
// rotary encoders
pind = 0;
if (inputs.rotenc) pind |= 0x20;
@ -80,7 +80,7 @@ for (int fm=0; fm<MAX_FLIGHT_MODES; fm++) {
}
#endif
#endif
#endif //GETVALUES_IMPORT
#endif
#ifdef LCDCHANGED_IMPORT
#undef LCDCHANGED_IMPORT

View file

@ -152,19 +152,19 @@ void luaDisable()
luaState = INTERPRETER_PANIC;
}
void luaClose(lua_State * L)
void luaClose(lua_State ** L)
{
if (L) {
if (*L) {
PROTECT_LUA() {
TRACE("luaClose %p", L);
lua_close(L); // this should not panic, but we make sure anyway
TRACE("luaClose %p", *L);
lua_close(*L); // this should not panic, but we make sure anyway
}
else {
// we can only disable Lua for the rest of the session
luaDisable();
}
UNPROTECT_LUA();
L = NULL;
*L = NULL;
}
}
@ -771,7 +771,7 @@ void luaInit()
{
TRACE("luaInit");
luaClose(lsScripts);
luaClose(&lsScripts);
if (luaState != INTERPRETER_PANIC) {
#if defined(USE_BIN_ALLOCATOR)

View file

@ -103,7 +103,7 @@ extern uint8_t luaScriptsCount;
extern ScriptInternalData standaloneScript;
extern ScriptInternalData scriptInternalData[MAX_SCRIPTS];
extern ScriptInputsOutputs scriptInputsOutputs[MAX_SCRIPTS];
void luaClose(lua_State * L);
void luaClose(lua_State ** L);
bool luaTask(event_t evt, uint8_t scriptType, bool allowLcdUsage);
void luaExec(const char * filename);
void luaError(lua_State * L, uint8_t error, bool acknowledge=true);

View file

@ -1883,9 +1883,9 @@ void opentxClose(uint8_t shutdown)
// TODO needed? telemetryEnd();
#endif
#if defined(LUA)
luaClose(lsScripts);
luaClose(&lsScripts);
#if defined(PCBHORUS)
luaClose(lsWidgets);
luaClose(&lsWidgets);
#endif
#endif
#if defined(HAPTIC)