mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 12:25:12 +03:00
Fixes #2921: Lua getFlightMode() function added
This commit is contained in:
parent
618dd279fc
commit
1dcc660f31
1 changed files with 22 additions and 0 deletions
|
@ -428,6 +428,27 @@ static int luaGetValue(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*luadoc
|
||||||
|
@function getFlightMode()
|
||||||
|
|
||||||
|
Return the current flight mode
|
||||||
|
|
||||||
|
@retval multiple returns 2 values:
|
||||||
|
* (number) current flight mode number (0 - 7)
|
||||||
|
* (string) current flight mode name
|
||||||
|
|
||||||
|
@status current Introduced in 2.1.7
|
||||||
|
*/
|
||||||
|
static int luaGetFlightMode(lua_State *L)
|
||||||
|
{
|
||||||
|
lua_pushnumber(L, mixerCurrentFlightMode);
|
||||||
|
char name[sizeof(g_model.flightModeData[0].name)+1];
|
||||||
|
zchar2str(name, g_model.flightModeData[mixerCurrentFlightMode].name, sizeof(g_model.flightModeData[0].name));
|
||||||
|
lua_pushstring(L, name);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
/*luadoc
|
/*luadoc
|
||||||
@function playFile(name)
|
@function playFile(name)
|
||||||
|
|
||||||
|
@ -759,6 +780,7 @@ const luaL_Reg opentxLib[] = {
|
||||||
{ "getGeneralSettings", luaGetGeneralSettings },
|
{ "getGeneralSettings", luaGetGeneralSettings },
|
||||||
{ "getValue", luaGetValue },
|
{ "getValue", luaGetValue },
|
||||||
{ "getFieldInfo", luaGetFieldInfo },
|
{ "getFieldInfo", luaGetFieldInfo },
|
||||||
|
{ "getFlightMode", luaGetFlightMode },
|
||||||
{ "playFile", luaPlayFile },
|
{ "playFile", luaPlayFile },
|
||||||
{ "playNumber", luaPlayNumber },
|
{ "playNumber", luaPlayNumber },
|
||||||
{ "playDuration", luaPlayDuration },
|
{ "playDuration", luaPlayDuration },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue