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:
parent
ce6e9fa4a9
commit
cde4fea817
2 changed files with 14 additions and 8 deletions
|
@ -1082,13 +1082,11 @@ sym: $(TARGET).sym
|
||||||
|
|
||||||
# Build stamp-file
|
# Build stamp-file
|
||||||
stamp_header:
|
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 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 TIME_STR \"`date +%H:%M:%S | tr -d '\r\n'`\"" >> stamp-opentx.h
|
||||||
@echo "#define VERS_STR \"$(VERSION)\"" >> 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:
|
9x-stamp:
|
||||||
@echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > stamp-opentx-9x.txt
|
@echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > stamp-opentx-9x.txt
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
#include "stamp-opentx.h"
|
||||||
|
|
||||||
#if !defined(SIMU)
|
#if !defined(SIMU)
|
||||||
extern "C" {
|
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)
|
static int luaGetTime(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushunsigned(L, get_tmr10ms());
|
lua_pushunsigned(L, get_tmr10ms());
|
||||||
|
@ -507,7 +514,7 @@ static int luaModelDeleteMix(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int luaModelGetCustomSwitch(lua_State *L)
|
static int luaModelGetLogicalSwitch(lua_State *L)
|
||||||
{
|
{
|
||||||
int idx = luaL_checkunsigned(L, 1);
|
int idx = luaL_checkunsigned(L, 1);
|
||||||
if (idx < NUM_CSW) {
|
if (idx < NUM_CSW) {
|
||||||
|
@ -527,7 +534,7 @@ static int luaModelGetCustomSwitch(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int luaModelSetCustomSwitch(lua_State *L)
|
static int luaModelSetLogicalSwitch(lua_State *L)
|
||||||
{
|
{
|
||||||
int idx = luaL_checkunsigned(L, 1);
|
int idx = luaL_checkunsigned(L, 1);
|
||||||
if (idx < NUM_CSW) {
|
if (idx < NUM_CSW) {
|
||||||
|
@ -784,8 +791,8 @@ static const luaL_Reg modelLib[] = {
|
||||||
{ "getMix", luaModelGetMix },
|
{ "getMix", luaModelGetMix },
|
||||||
{ "insertMix", luaModelInsertMix },
|
{ "insertMix", luaModelInsertMix },
|
||||||
{ "deleteMix", luaModelDeleteMix },
|
{ "deleteMix", luaModelDeleteMix },
|
||||||
{ "getCustomSwitch", luaModelGetCustomSwitch },
|
{ "getLogicalSwitch", luaModelGetLogicalSwitch },
|
||||||
{ "setCustomSwitch", luaModelSetCustomSwitch },
|
{ "setLogicalSwitch", luaModelSetLogicalSwitch },
|
||||||
{ "getCustomFunction", luaModelGetCustomFunction },
|
{ "getCustomFunction", luaModelGetCustomFunction },
|
||||||
{ "setCustomFunction", luaModelSetCustomFunction },
|
{ "setCustomFunction", luaModelSetCustomFunction },
|
||||||
{ "getOutput", luaModelGetOutput },
|
{ "getOutput", luaModelGetOutput },
|
||||||
|
@ -823,6 +830,7 @@ void luaInit()
|
||||||
|
|
||||||
// Push openTX functions
|
// Push openTX functions
|
||||||
lua_register(L, "getTime", luaGetTime);
|
lua_register(L, "getTime", luaGetTime);
|
||||||
|
lua_register(L, "getVersion", luaGetVersion);
|
||||||
lua_register(L, "getValue", luaGetValue);
|
lua_register(L, "getValue", luaGetValue);
|
||||||
lua_register(L, "playFile", luaPlayFile);
|
lua_register(L, "playFile", luaPlayFile);
|
||||||
lua_register(L, "popupInput", luaPopupInput);
|
lua_register(L, "popupInput", luaPopupInput);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue