diff --git a/radio/src/datastructs_private.h b/radio/src/datastructs_private.h index 27260ab9e..e7075613a 100644 --- a/radio/src/datastructs_private.h +++ b/radio/src/datastructs_private.h @@ -85,7 +85,7 @@ inline uint16_t makeSourceNumVal(int16_t val, bool isSource = false) PACK(struct CurveRef { uint16_t type:5; - int16_t value:11 CUST(r_sourceNumVal,w_sourceNumVal); + uint16_t value:11 CUST(r_sourceNumVal,w_sourceNumVal); }); PACK(struct MixData { diff --git a/radio/src/gui/common/stdlcd/model_curves.cpp b/radio/src/gui/common/stdlcd/model_curves.cpp index e11a0a8b3..cefb9c5b5 100644 --- a/radio/src/gui/common/stdlcd/model_curves.cpp +++ b/radio/src/gui/common/stdlcd/model_curves.cpp @@ -147,7 +147,7 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlag drawCurveName(x, y, v.value, flags); if (active && menuHorizontalPosition == 1) { if (event == EVT_KEY_LONG(KEY_ENTER) && v.value != 0) { - s_currIdxSubMenu = abs(curve.value) - 1; + s_currIdxSubMenu = abs(v.value) - 1; pushMenu(menuModelCurveOne); } else { diff --git a/radio/src/lua/api_model.cpp b/radio/src/lua/api_model.cpp index ffa6e01d6..94ddc11a7 100644 --- a/radio/src/lua/api_model.cpp +++ b/radio/src/lua/api_model.cpp @@ -680,18 +680,10 @@ static int luaModelInsertInput(lua_State *L) expo->mode = luaL_checkinteger(L, -1); } else if (!strcmp(key, "weight")) { - int val = luaL_checkinteger(L, -1); - SourceNumVal v; - v.isSource = (abs(val) >= 1024); - v.value = val; - expo->weight = v.rawValue; + expo->weight = luaL_checkunsigned(L, -1); } else if (!strcmp(key, "offset")) { - int val = luaL_checkinteger(L, -1); - SourceNumVal v; - v.isSource = (abs(val) >= 1024); - v.value = val; - expo->offset = v.rawValue; + expo->offset = luaL_checkunsigned(L, -1); } else if (!strcmp(key, "switch")) { expo->swtch = luaL_checkinteger(L, -1); @@ -700,11 +692,7 @@ static int luaModelInsertInput(lua_State *L) expo->curve.type = luaL_checkinteger(L, -1); } else if (!strcmp(key, "curveValue")) { - int val = luaL_checkinteger(L, -1); - SourceNumVal v; - v.isSource = (abs(val) >= 1024); - v.value = val; - expo->curve.value = v.rawValue; + expo->curve.value = luaL_checkunsigned(L, -1); } else if (!strcmp(key, "trimSource")) { expo->trimSource = - luaL_checkinteger(L, -1);