fix(lua): Remove faulty carryTrim, replace with trimSource (#2995)

* Fix carryTrim in LUA

* Remove carryTrim
This commit is contained in:
3djc
2023-01-15 11:54:57 +10:00
committed by GitHub
parent ea162d2158
commit 8ee73a5800
10 changed files with 32 additions and 31 deletions
+7 -6
View File
@@ -582,10 +582,11 @@ Return input data for given input and line number
* `switch` (number) input switch index
* `curveType` (number) curve type (function, expo, custom curve)
* `curveValue` (number) curve index
* `carryTrim` (boolean) input trims applied
* `carryTrim` deprecated, please use trimSource instead. WARNING: carryTrim was getting negative values (carryTrim = - trimSource)
* 'trimSource' (number) a positive number representing trim source
* 'flightModes' (number) bit-mask of active flight modes
@status current Introduced in 2.0.0, curveType/curveValue/carryTrim added in 2.3, inputName added 2.3.10, flighmode reworked in 2.3.11
@status current Introduced in 2.0.0, curveType/curveValue/carryTrim added in 2.3, inputName added 2.3.10, flighmode reworked in 2.3.11, broken carryTrim replaced by trimSource in 2.8.1
*/
static int luaModelGetInput(lua_State *L)
{
@@ -604,7 +605,7 @@ static int luaModelGetInput(lua_State *L)
lua_pushtableinteger(L, "switch", expo->swtch);
lua_pushtableinteger(L, "curveType", expo->curve.type);
lua_pushtableinteger(L, "curveValue", expo->curve.value);
lua_pushtableinteger(L, "carryTrim", expo->carryTrim);
lua_pushtableinteger(L, "trimSource", - expo->trimSource);
lua_pushtableinteger(L, "flightModes", expo->flightModes);
}
else {
@@ -624,7 +625,7 @@ Insert an Input at specified line
@param value (table) input data, see model.getInput()
@status current Introduced in 2.0.0, curveType/curveValue/carryTrim added in 2.3, inputName added 2.3.10
@status current Introduced in 2.0.0, curveType/curveValue/carryTrim added in 2.3, inputName added 2.3.10, broken carryTrim replaced by trimSource in EdgeTX 2.8.1
*/
static int luaModelInsertInput(lua_State *L)
{
@@ -673,8 +674,8 @@ static int luaModelInsertInput(lua_State *L)
else if (!strcmp(key, "curveValue")) {
expo->curve.value = luaL_checkinteger(L, -1);
}
else if (!strcmp(key, "carryTrim")) {
expo->carryTrim = lua_toboolean(L, -1);
else if (!strcmp(key, "trimSource")) {
expo->trimSource = - luaL_checkinteger(L, -1);
}
else if (!strcmp(key, "flightModes")) {
expo->flightModes = luaL_checkinteger(L, -1);