mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 12:25:12 +03:00
Merge branch '2.2' into 2.3
This commit is contained in:
commit
b15ac0f2e1
3 changed files with 17 additions and 9 deletions
|
@ -102,7 +102,7 @@ void menuModelLogicalSwitchOne(event_t event)
|
|||
int v1_min=0, v1_max=MIXSRC_LAST_TELEM;
|
||||
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY || cstate == LS_FAMILY_EDGE) {
|
||||
drawSwitch(CSWONE_2ND_COLUMN, y, v1_val, attr);
|
||||
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
|
||||
v1_min = SWSRC_FIRST_IN_LOGICAL_SWITCHES; v1_max = SWSRC_LAST_IN_LOGICAL_SWITCHES;
|
||||
INCDEC_SET_FLAG(EE_MODEL | INCDEC_SWITCH);
|
||||
INCDEC_ENABLE_CHECK(isSwitchAvailableInLogicalSwitches);
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ void menuModelLogicalSwitchOne(event_t event)
|
|||
int16_t v2_min = 0, v2_max = MIXSRC_LAST_TELEM;
|
||||
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
||||
drawSwitch(CSWONE_2ND_COLUMN, y, cs->v2, attr);
|
||||
v2_min = SWSRC_OFF+1; v2_max = SWSRC_ON-1;
|
||||
v2_min = SWSRC_FIRST_IN_LOGICAL_SWITCHES; v2_max = SWSRC_LAST_IN_LOGICAL_SWITCHES;
|
||||
INCDEC_SET_FLAG(EE_MODEL | INCDEC_SWITCH);
|
||||
INCDEC_ENABLE_CHECK(isSwitchAvailableInLogicalSwitches);
|
||||
}
|
||||
|
|
|
@ -860,9 +860,9 @@ Set Curve parameters
|
|||
@param curve (unsigned number) curve number (use 0 for Curve1)
|
||||
|
||||
@param params see model.getCurve return format for table format. setCurve uses standard
|
||||
lua array indexing and array start at index 1
|
||||
lua array indexing and arrays start at index 1
|
||||
|
||||
The first and last x value must 0 and 100 and x values must be monotonically increasing
|
||||
The first and last x value must -100 and 100 and x values must be monotonically increasing
|
||||
|
||||
@retval 0 - Everything okay
|
||||
1 - Wrong number of points
|
||||
|
@ -879,15 +879,15 @@ The first and last x value must 0 and 100 and x values must be monotonically inc
|
|||
Example setting a 4-point custom curve:
|
||||
```lua
|
||||
params = {}
|
||||
params["x"] = {0, 34, 77, 100}
|
||||
params["x"] = {-100, -34, 77, 100}
|
||||
params["y"] = {-70, 20, -89, -100}
|
||||
params["smooth"] = 1
|
||||
params["smooth"] = true
|
||||
params["type"] = 1
|
||||
val = model.setCurve(2, params)
|
||||
```
|
||||
setting a 6-point standard smoothed curve
|
||||
```lua
|
||||
val = model.setCurve(3, {smooth=1, y={-100, -50, 0, 50, 100, 80}})
|
||||
val = model.setCurve(3, {smooth=true, y={-100, -50, 0, 50, 100, 80}})
|
||||
```
|
||||
|
||||
*/
|
||||
|
@ -923,6 +923,11 @@ static int luaModelSetCurve(lua_State *L)
|
|||
newCurveData.type = luaL_checkinteger(L, -1);
|
||||
}
|
||||
else if (!strcmp(key, "smooth")) {
|
||||
// Earlier version of this api expected a 0/1 integer instead of a boolean
|
||||
// Still accept a 0/1 here
|
||||
if (lua_isboolean(L,-1))
|
||||
newCurveData.smooth = lua_toboolean(L, -1);
|
||||
else
|
||||
newCurveData.smooth = luaL_checkinteger(L, -1);
|
||||
}
|
||||
else if (!strcmp(key, "x") || !strcmp(key, "y")) {
|
||||
|
@ -972,7 +977,7 @@ static int luaModelSetCurve(lua_State *L)
|
|||
}
|
||||
|
||||
// Check first and last point
|
||||
if (xPoints[0] != 0 || xPoints[newCurveData.points + 4] != 100) {
|
||||
if (xPoints[0] != -100 || xPoints[newCurveData.points + 4] != 100) {
|
||||
lua_pushinteger(L, 5);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -633,6 +633,9 @@ bool luaLoadMixScript(uint8_t index)
|
|||
|
||||
bool luaLoadFunctionScript(uint8_t index, uint8_t ref)
|
||||
{
|
||||
if ((ref >= SCRIPT_GFUNC_FIRST) && g_model.noGlobalFunctions)
|
||||
return false;
|
||||
|
||||
CustomFunctionData & fn = (ref < SCRIPT_GFUNC_FIRST ? g_model.customFn[index] : g_eeGeneral.customFn[index]);
|
||||
|
||||
if (fn.func == FUNC_PLAY_SCRIPT && ZEXIST(fn.play.name)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue