From 9378e8e25245204f4b073cace752352a15d3784b Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 5 May 2023 11:45:06 +0200 Subject: [PATCH] fix(lua): GV precision not taken into account (#3540) changes: - calculate LUA return value for GVARS taking precision into account --- radio/src/lua/api_general.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/radio/src/lua/api_general.cpp b/radio/src/lua/api_general.cpp index 8099f887e..d34a7e582 100644 --- a/radio/src/lua/api_general.cpp +++ b/radio/src/lua/api_general.cpp @@ -388,6 +388,14 @@ void luaGetValueAndPush(lua_State* L, int src) else if (src == MIXSRC_TX_VOLTAGE) { lua_pushnumber(L, float(value) * 0.1f); } + #if defined(GVARS) + else if(src >= MIXSRC_FIRST_GVAR && src <= MIXSRC_LAST_GVAR) { + if(g_model.gvars[src - MIXSRC_FIRST_GVAR].prec) + lua_pushnumber(L, float(value) * 0.1f); // prec "0.0" + else + lua_pushinteger(L, value); // prec "0.-" + } + #endif else { lua_pushinteger(L, value); }