Commit 0391174 1 parent f44a8b6 commit 0391174 Copy full SHA for 0391174
File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 25
25
#include " lua_api.h"
26
26
#include " ../timers.h"
27
27
#include " model_init.h"
28
+ #include " gvars.h"
28
29
29
30
#if defined(SDCARD_YAML)
30
31
#include < storage/sdcard_yaml.h>
@@ -1513,7 +1514,7 @@ static int luaModelGetGlobalVariable(lua_State *L)
1513
1514
unsigned int idx = luaL_checkunsigned (L, 1 );
1514
1515
unsigned int phase = luaL_checkunsigned (L, 2 );
1515
1516
if (phase < MAX_FLIGHT_MODES && idx < MAX_GVARS)
1516
- lua_pushinteger (L, g_model. flightModeData [phase]. gvars [ idx] );
1517
+ lua_pushinteger (L, getGVarValue ( idx, phase) );
1517
1518
else
1518
1519
lua_pushnil (L);
1519
1520
return 1 ;
@@ -1541,7 +1542,7 @@ static int luaModelSetGlobalVariable(lua_State *L)
1541
1542
unsigned int phase = luaL_checkunsigned (L, 2 );
1542
1543
int value = luaL_checkinteger (L, 3 );
1543
1544
if (phase < MAX_FLIGHT_MODES && idx < MAX_GVARS && value >= -GVAR_MAX && value <= GVAR_MAX) {
1544
- g_model. flightModeData [phase]. gvars [ idx] = value;
1545
+ SET_GVAR ( idx, value, phase) ;
1545
1546
storageDirty (EE_MODEL);
1546
1547
}
1547
1548
return 0 ;
You can’t perform that action at this time.
0 commit comments