mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 17:55:19 +03:00
LUA : Add curves to inputs
This commit is contained in:
parent
577eb6224f
commit
04c95d2fdb
1 changed files with 34 additions and 24 deletions
|
@ -2,7 +2,7 @@
|
|||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
|
@ -48,11 +48,11 @@ static int luaModelGetInfo(lua_State *L)
|
|||
/*luadoc
|
||||
@function model.setInfo(value)
|
||||
|
||||
Set the current Model information
|
||||
Set the current Model information
|
||||
|
||||
@param value model information data, see model.getInfo()
|
||||
|
||||
@notice If a parameter is missing from the value, then
|
||||
@notice If a parameter is missing from the value, then
|
||||
that parameter remains unchanged.
|
||||
|
||||
@status current Introduced in 2.0.6, changed in TODO
|
||||
|
@ -130,7 +130,7 @@ Set RF module parameters
|
|||
|
||||
@param value module parameters, see model.getModule()
|
||||
|
||||
@notice If a parameter is missing from the value, then
|
||||
@notice If a parameter is missing from the value, then
|
||||
that parameter remains unchanged.
|
||||
|
||||
@status current Introduced in TODO
|
||||
|
@ -213,7 +213,7 @@ Set model timer parameters
|
|||
|
||||
@param value timer parameters, see model.getTimer()
|
||||
|
||||
@notice If a parameter is missing from the value, then
|
||||
@notice If a parameter is missing from the value, then
|
||||
that parameter remains unchanged.
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
|
@ -300,7 +300,7 @@ static unsigned int getInputsCount(unsigned int chn)
|
|||
/*luadoc
|
||||
@function model.getInputsCount(input)
|
||||
|
||||
Return number of lines for given input
|
||||
Return number of lines for given input
|
||||
|
||||
@param input (unsigned number) input number (use 0 for Input1)
|
||||
|
||||
|
@ -319,7 +319,7 @@ static int luaModelGetInputsCount(lua_State *L)
|
|||
/*luadoc
|
||||
@function model.getInput(input, line)
|
||||
|
||||
Return input data for given input and line number
|
||||
Return input data for given input and line number
|
||||
|
||||
@param input (unsigned number) input number (use 0 for Input1)
|
||||
|
||||
|
@ -330,11 +330,13 @@ Return input data for given input and line number
|
|||
@retval table input data:
|
||||
* `name` (string) input line name
|
||||
* `source` (number) input source index
|
||||
* `weight` (number) input weight
|
||||
* `offset` (number) input offset
|
||||
* `weight` (number) input weight
|
||||
* `offset` (number) input offset
|
||||
* `switch` (number) input switch index
|
||||
* `curveType` (number) curve type (function, expo, custom curve)
|
||||
* `curveValue` (number) curve index
|
||||
|
||||
@status current Introduced in 2.0.0, `switch` added in TODO
|
||||
@status current Introduced in 2.0.0, curveType/curveValue added in 2.3
|
||||
*/
|
||||
static int luaModelGetInput(lua_State *L)
|
||||
{
|
||||
|
@ -350,6 +352,8 @@ static int luaModelGetInput(lua_State *L)
|
|||
lua_pushtableinteger(L, "weight", expo->weight);
|
||||
lua_pushtableinteger(L, "offset", expo->offset);
|
||||
lua_pushtableinteger(L, "switch", expo->swtch);
|
||||
lua_pushtableinteger(L, "curveType", expo->curve.type);
|
||||
lua_pushtableinteger(L, "curveValue", expo->curve.value);
|
||||
}
|
||||
else {
|
||||
lua_pushnil(L);
|
||||
|
@ -368,7 +372,7 @@ Insert an Input at specified line
|
|||
|
||||
@param value (table) input data, see model.getInput()
|
||||
|
||||
@status current Introduced in 2.0.0, `switch` added in TODO
|
||||
@status current Introduced in 2.0.0, curveType/curveValue added in 2.3
|
||||
*/
|
||||
static int luaModelInsertInput(lua_State *L)
|
||||
{
|
||||
|
@ -403,6 +407,12 @@ static int luaModelInsertInput(lua_State *L)
|
|||
else if (!strcmp(key, "switch")) {
|
||||
expo->swtch = luaL_checkinteger(L, -1);
|
||||
}
|
||||
else if (!strcmp(key, "curveType")) {
|
||||
expo->curve.type = luaL_checkinteger(L, -1);
|
||||
}
|
||||
else if (!strcmp(key, "curveValue")) {
|
||||
expo->curve.value = luaL_checkinteger(L, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,7 +448,7 @@ static int luaModelDeleteInput(lua_State *L)
|
|||
/*luadoc
|
||||
@function model.deleteInputs()
|
||||
|
||||
Delete all Inputs
|
||||
Delete all Inputs
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
*/
|
||||
|
@ -491,7 +501,7 @@ static unsigned int getMixesCount(unsigned int chn)
|
|||
/*luadoc
|
||||
@function model.getMixesCount(channel)
|
||||
|
||||
Get the number of Mixer lines that the specified Channel has
|
||||
Get the number of Mixer lines that the specified Channel has
|
||||
|
||||
@param channel (unsigned number) channel number (use 0 for CH1)
|
||||
|
||||
|
@ -510,7 +520,7 @@ static int luaModelGetMixesCount(lua_State *L)
|
|||
/*luadoc
|
||||
@function model.getMix(channel, line)
|
||||
|
||||
Get configuration for specified Mix
|
||||
Get configuration for specified Mix
|
||||
|
||||
@param channel (unsigned number) channel number (use 0 for CH1)
|
||||
|
||||
|
@ -571,7 +581,7 @@ static int luaModelGetMix(lua_State *L)
|
|||
/*luadoc
|
||||
@function model.insertMix(channel, line, value)
|
||||
|
||||
Insert a mixer line into Channel
|
||||
Insert a mixer line into Channel
|
||||
|
||||
@param channel (unsigned number) channel number (use 0 for CH1)
|
||||
|
||||
|
@ -653,7 +663,7 @@ static int luaModelInsertMix(lua_State *L)
|
|||
/*luadoc
|
||||
@function model.deleteMix(channel, line)
|
||||
|
||||
Delete mixer line from specified Channel
|
||||
Delete mixer line from specified Channel
|
||||
|
||||
@param channel (unsigned number) channel number (use 0 for CH1)
|
||||
|
||||
|
@ -732,7 +742,7 @@ static int luaModelGetLogicalSwitch(lua_State *L)
|
|||
/*luadoc
|
||||
@function model.setLogicalSwitch(switch, value)
|
||||
|
||||
Set Logical Switch parameters
|
||||
Set Logical Switch parameters
|
||||
|
||||
@param switch (unsigned number) logical switch number (use 0 for LS1)
|
||||
|
||||
|
@ -1059,11 +1069,11 @@ Get Custom Function parameters
|
|||
* `func` (number) function index
|
||||
* `name` (string) Name of track to play (only returned only returned if action is play track, sound or script)
|
||||
* `value` (number) value (only returned only returned if action is **not** play track, sound or script)
|
||||
* `mode` (number) mode (only returned only returned if action is **not** play track, sound or script)
|
||||
* `mode` (number) mode (only returned only returned if action is **not** play track, sound or script)
|
||||
* `param` (number) parameter (only returned only returned if action is **not** play track, sound or script)
|
||||
* `active` (number) 0 = disabled, 1 = enabled
|
||||
|
||||
@status current Introduced in 2.0.0, TODO rename function
|
||||
@status current Introduced in 2.0.0, TODO rename function
|
||||
*/
|
||||
static int luaModelGetCustomFunction(lua_State *L)
|
||||
{
|
||||
|
@ -1098,10 +1108,10 @@ Set Custom Function parameters
|
|||
|
||||
@param value (table) custom function parameters, see model.getCustomFunction() for table format
|
||||
|
||||
@notice If a parameter is missing from the value, then
|
||||
@notice If a parameter is missing from the value, then
|
||||
that parameter remains unchanged.
|
||||
|
||||
@status current Introduced in 2.0.0, TODO rename function
|
||||
@status current Introduced in 2.0.0, TODO rename function
|
||||
*/
|
||||
static int luaModelSetCustomFunction(lua_State *L)
|
||||
{
|
||||
|
@ -1160,8 +1170,8 @@ Get servo parameters
|
|||
* `symetrical` (number) linear Subtrim 0 = Off, 1 = On
|
||||
* `revert` (number) irection 0 = ---, 1 = INV
|
||||
* `curve`
|
||||
* (number) Curve number (0 for Curve1)
|
||||
* or `nil` if no curve set
|
||||
* (number) Curve number (0 for Curve1)
|
||||
* or `nil` if no curve set
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
*/
|
||||
|
@ -1196,7 +1206,7 @@ Set servo parameters
|
|||
|
||||
@param value (table) servo parameters, see model.getOutput() for table format
|
||||
|
||||
@notice If a parameter is missing from the value, then
|
||||
@notice If a parameter is missing from the value, then
|
||||
that parameter remains unchanged.
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue