mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 12:25:12 +03:00
Add gtimer support to LUA (#5669)
* Add gtimer support to LUA * Copy/paste issue
This commit is contained in:
parent
073e1a8462
commit
d3951235bd
1 changed files with 18 additions and 1 deletions
|
@ -903,9 +903,10 @@ Returns (some of) the general radio settings
|
||||||
IMPERIAL units
|
IMPERIAL units
|
||||||
* `language` (string) radio language (used for menus)
|
* `language` (string) radio language (used for menus)
|
||||||
* `voice` (string) voice language (used for speech)
|
* `voice` (string) voice language (used for speech)
|
||||||
|
* `gtimer` (number) radio global timer in seconds (does not include current session)
|
||||||
|
|
||||||
@status current Introduced in 2.0.6, `imperial` added in TODO,
|
@status current Introduced in 2.0.6, `imperial` added in TODO,
|
||||||
`language` and `voice` added in 2.2.0.
|
`language` and `voice` added in 2.2.0, gtimer added in 2.2.2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
static int luaGetGeneralSettings(lua_State * L)
|
static int luaGetGeneralSettings(lua_State * L)
|
||||||
|
@ -917,6 +918,7 @@ static int luaGetGeneralSettings(lua_State * L)
|
||||||
lua_pushtableinteger(L, "imperial", g_eeGeneral.imperial);
|
lua_pushtableinteger(L, "imperial", g_eeGeneral.imperial);
|
||||||
lua_pushtablestring(L, "language", TRANSLATIONS);
|
lua_pushtablestring(L, "language", TRANSLATIONS);
|
||||||
lua_pushtablestring(L, "voice", currentLanguagePack->id);
|
lua_pushtablestring(L, "voice", currentLanguagePack->id);
|
||||||
|
lua_pushtableinteger(L, "gtimer", g_eeGeneral.globalTimer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1258,6 +1260,20 @@ static int luaGetUsage(lua_State * L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*luadoc
|
||||||
|
@function resetGlobalTimer()
|
||||||
|
|
||||||
|
Resets the radio global timer to 0.
|
||||||
|
|
||||||
|
@status current Introduced in 2.2.2
|
||||||
|
*/
|
||||||
|
static int luaResetGlobalTimer(lua_State * L)
|
||||||
|
{
|
||||||
|
g_eeGeneral.globalTimer = 0;
|
||||||
|
storageDirty(EE_GENERAL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const luaL_Reg opentxLib[] = {
|
const luaL_Reg opentxLib[] = {
|
||||||
{ "getTime", luaGetTime },
|
{ "getTime", luaGetTime },
|
||||||
{ "getDateTime", luaGetDateTime },
|
{ "getDateTime", luaGetDateTime },
|
||||||
|
@ -1285,6 +1301,7 @@ const luaL_Reg opentxLib[] = {
|
||||||
{ "killEvents", luaKillEvents },
|
{ "killEvents", luaKillEvents },
|
||||||
{ "loadScript", luaLoadScript },
|
{ "loadScript", luaLoadScript },
|
||||||
{ "getUsage", luaGetUsage },
|
{ "getUsage", luaGetUsage },
|
||||||
|
{ "resetGlobalTimer", luaResetGlobalTimer },
|
||||||
#if LCD_DEPTH > 1 && !defined(COLORLCD)
|
#if LCD_DEPTH > 1 && !defined(COLORLCD)
|
||||||
{ "GREY", luaGrey },
|
{ "GREY", luaGrey },
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue