This commit is contained in:
@@ -430,21 +430,28 @@ static int luaGetValue(lua_State *L)
|
|||||||
|
|
||||||
|
|
||||||
/*luadoc
|
/*luadoc
|
||||||
@function getFlightMode()
|
@function getFlightMode(mode)
|
||||||
|
|
||||||
Return the current flight mode
|
Return flight mode data.
|
||||||
|
|
||||||
|
@param mode (number) flight mode number to return (0 - 8). If mode parameter
|
||||||
|
is not specified (or contains invalid value), then the current flight mode data is returned.
|
||||||
|
|
||||||
@retval multiple returns 2 values:
|
@retval multiple returns 2 values:
|
||||||
* (number) current flight mode number (0 - 7)
|
* (number) (current) flight mode number (0 - 8)
|
||||||
* (string) current flight mode name
|
* (string) (current) flight mode name
|
||||||
|
|
||||||
@status current Introduced in 2.1.7
|
@status current Introduced in 2.1.7
|
||||||
*/
|
*/
|
||||||
static int luaGetFlightMode(lua_State *L)
|
static int luaGetFlightMode(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, mixerCurrentFlightMode);
|
int mode = luaL_optinteger(L, 1, -1);
|
||||||
|
if (mode < 0 || mode >= MAX_FLIGHT_MODES) {
|
||||||
|
mode = mixerCurrentFlightMode;
|
||||||
|
}
|
||||||
|
lua_pushnumber(L, mode);
|
||||||
char name[sizeof(g_model.flightModeData[0].name)+1];
|
char name[sizeof(g_model.flightModeData[0].name)+1];
|
||||||
zchar2str(name, g_model.flightModeData[mixerCurrentFlightMode].name, sizeof(g_model.flightModeData[0].name));
|
zchar2str(name, g_model.flightModeData[mode].name, sizeof(g_model.flightModeData[0].name));
|
||||||
lua_pushstring(L, name);
|
lua_pushstring(L, name);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user