fix(lua): GV precision not taken into account (#3540)

changes:
- calculate LUA return value for GVARS taking precision into account
This commit is contained in:
Michael
2023-05-05 19:45:06 +10:00
committed by GitHub
parent ecba2f6016
commit 9378e8e252
+8
View File
@@ -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);
}