1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-22 07:45:14 +03:00

getVersion added to Lua functions

This commit is contained in:
Bertrand Songis 2014-02-10 16:05:32 +01:00
parent ce6e9fa4a9
commit cde4fea817
2 changed files with 14 additions and 8 deletions

View file

@ -1082,13 +1082,11 @@ sym: $(TARGET).sym
# Build stamp-file
stamp_header:
@echo
@echo "Generate Version-stamp:"
@echo "//Automatically generated file (Makefile) - do not edit" > stamp-opentx.h
@echo "// Automatically generated file (Makefile) - do not edit" > stamp-opentx.h
@echo "#define DATE_STR \"`date +%Y-%m-%d | tr -d '\r\n'`\"" >> stamp-opentx.h
@echo "#define TIME_STR \"`date +%H:%M:%S | tr -d '\r\n'`\"" >> stamp-opentx.h
@echo "#define VERS_STR \"$(VERSION)\"" >> stamp-opentx.h
@cat stamp-opentx.h
@echo "#define VERS_NUM $(VERSION)" >> stamp-opentx.h
9x-stamp:
@echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > stamp-opentx-9x.txt

View file

@ -35,6 +35,7 @@
*/
#include "opentx.h"
#include "stamp-opentx.h"
#if !defined(SIMU)
extern "C" {
@ -76,6 +77,12 @@ void hook(lua_State* L, lua_Debug *ar)
}
}
static int luaGetVersion(lua_State *L)
{
lua_pushnumber(L, VERS_NUM);
return 1;
}
static int luaGetTime(lua_State *L)
{
lua_pushunsigned(L, get_tmr10ms());
@ -507,7 +514,7 @@ static int luaModelDeleteMix(lua_State *L)
return 0;
}
static int luaModelGetCustomSwitch(lua_State *L)
static int luaModelGetLogicalSwitch(lua_State *L)
{
int idx = luaL_checkunsigned(L, 1);
if (idx < NUM_CSW) {
@ -527,7 +534,7 @@ static int luaModelGetCustomSwitch(lua_State *L)
return 1;
}
static int luaModelSetCustomSwitch(lua_State *L)
static int luaModelSetLogicalSwitch(lua_State *L)
{
int idx = luaL_checkunsigned(L, 1);
if (idx < NUM_CSW) {
@ -784,8 +791,8 @@ static const luaL_Reg modelLib[] = {
{ "getMix", luaModelGetMix },
{ "insertMix", luaModelInsertMix },
{ "deleteMix", luaModelDeleteMix },
{ "getCustomSwitch", luaModelGetCustomSwitch },
{ "setCustomSwitch", luaModelSetCustomSwitch },
{ "getLogicalSwitch", luaModelGetLogicalSwitch },
{ "setLogicalSwitch", luaModelSetLogicalSwitch },
{ "getCustomFunction", luaModelGetCustomFunction },
{ "setCustomFunction", luaModelSetCustomFunction },
{ "getOutput", luaModelGetOutput },
@ -823,6 +830,7 @@ void luaInit()
// Push openTX functions
lua_register(L, "getTime", luaGetTime);
lua_register(L, "getVersion", luaGetVersion);
lua_register(L, "getValue", luaGetValue);
lua_register(L, "playFile", luaPlayFile);
lua_register(L, "popupInput", luaPopupInput);