Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Get Custom Function parameters
@status current Introduced in 2.0.0, TODO rename function
function
(unsigned number) custom function number (use 0 for CF1)
nil
requested custom function does not exist
table
custom function data:
switch
(number) switch index
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)
param
(number) parameter (only returned only returned if action is not play track, sound or script)
active
(number) 0 = disabled, 1 = enabled
Return input data for given input and line number
@status current Introduced in 2.3.10
index
(unsigned number) flight mode number (use 0 for FM0)
nil
requested input or line does not exist
table
input data:
name
(string) input line name
switch
(number) input switch index
fadeIn
(number) fade in value (in 0.1s)
fadeOut
(number) fade out value (in 0.1s)
trimsValues
(table) table of trim values:
key
is trim number (zero based)
value
is trim value
trimsModes
(table) table of trim mode:
key
is trim number (zero based)
value
is trim mode
Return input data for given input and line number
@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
input
(unsigned number) input number (use 0 for Input1)
line
(unsigned number) input line (use 0 for first line)
nil
requested input or line does not exist
table
input data:
name
(string) input line name
inputName
(string) input input name
source
(number) input source index
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
carryTrim
(boolean) input trims applied
'flightModes' (number) bit-mask of active flight modes
Get Curve parameters
Note that functions returns the tables starting with index 0 contrary to LUA's usual index starting with 1
@status current Introduced in 2.0.12
curve
(unsigned number) curve number (use 0 for Curve1)
nil
requested curve does not exist
table
curve data:
name
(string) name
type
(number) type
smooth
(boolean) smooth
points
(number) number of points
y
(table) table of Y values:
key
is point number (zero based)
value
is y value
x
(table) only included for custom curve type:
key
is point number (zero based)
value
is x value
Get configuration for specified Mix
@status current Introduced in 2.0.0, parameters below multiplex
added in 2.0.13
channel
(unsigned number) channel number (use 0 for CH1)
line
(unsigned number) mix number (use 0 for first line(mix))
nil
requested channel or line does not exist
table
mix data:
name
(string) mix line name
source
(number) source index
weight
(number) weight (1024 == 100%) value or GVAR1..9 = 4096..4011, -GVAR1..9 = 4095..4087
offset
(number) offset value or GVAR1..9 = 4096..4011, -GVAR1..9 = 4095..4087
switch
(number) switch index
multiplex
(number) multiplex (0 = ADD, 1 = MULTIPLY, 2 = REPLACE)
curveType
(number) curve type (function, expo, custom curve)
curveValue
(number) curve index
flightModes
(number) bit-mask of active flight modes
carryTrim
(boolean) carry trim
mixWarn
(number) warning (0 = off, 1 = 1 beep, .. 3 = 3 beeps)
delayUp
(number) delay up (time in 1/10 s)
delayDown
(number) delay down
speedUp
(number) speed up
speedDown
(number) speed down
Get Logical Switch parameters
@status current Introduced in 2.0.0
switch
(unsigned number) logical switch number (use 0 for LS1)
nil
requested logical switch does not exist
table
logical switch data:
func
(number) function index, see Logical Switch Function Constants.
v1
(number) V1 value (index)
v2
(number) V2 value (index or value)
v3
(number) V3 value (index or value)
and
(number) AND switch index
delay
(number) delay (time in 1/10 s)
duration
(number) duration (time in 1/10 s)
Insert a mixer line into Channel
@status current Introduced in 2.0.0, parameters below multiplex
added in 2.0.13
channel
(unsigned number) channel number (use 0 for CH1)
line
(unsigned number) mix number (use 0 for first line(mix))
value
(table) see model.getMix() for table format
none
Get model timer parameters
@status current Introduced in 2.0.0, name added in 2.3.6
timer
(number) timer index (0 for Timer 1)
nil
requested timer does not exist
table
timer parameters:
mode
(number) timer trigger source: off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
start
(number) start value [seconds], 0 for up timer, 0> down timer
value
(number) current value [seconds]
countdownBeep
(number) countdown beep (0 = silent, 1 = beeps, 2 = voice)
minuteBeep
(boolean) minute beep
persistent
(number) persistent timer
name
(string) timer name
Get Telemetry Sensor parameters
@status current Introduced in 2.3.0
sensor
(unsigned number) sensor number (use 0 for sensor 1)
nil
requested sensor does not exist
table
with sensor data:
type
(number) 0 = custom, 1 = calculated
name
(string) Name
unit
(number) See list of units in the appendix of the OpenTX Lua Reference Guide
prec
(number) Number of decimals
id
(number) Only custom sensors
instance
(number) Only custom sensors
formula
(number) Only calculated sensors. 0 = Add etc. see list of formula choices in Companion popup
Set Curve parameters
The first and last x value must -100 and 100 and x values must be monotonically increasing
@status current Introduced in 2.2.0
Example setting a 4-point custom curve:
setting a 6-point standard smoothed curve
curve
(unsigned number) curve number (use 0 for Curve1)
params
see model.getCurve return format for table format. setCurve uses standard lua array indexing and arrays start at index 1
`` 0 - Everything okay
Get servo parameters
@status current Introduced in 2.0.0
index
(unsigned number) output number (use 0 for CH1)
nil
requested output does not exist
table
output parameters:
name
(string) name
min
(number) Minimum % * 10
max
(number) Maximum % * 10
offset
(number) Subtrim * 10
ppmCenter
(number) offset from PPM Center. 0 = 1500
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
Get RF module parameters
Type
values:
0 NONE
1 PPM
2 XJT_PXX1
3 ISRM_PXX2
4 DSM2
5 CROSSFIRE
6 MULTIMODULE
7 R9M_PXX1
8 R9M_PXX2
9 R9M_LITE_PXX1
10 R9M_LITE_PXX2
11 R9M_LITE_PRO_PXX1
12 R9M_LITE_PRO_PXX2
13 SBUS
14 XJT_LITE_PXX2
subType
values for XJT_PXX1:
-1 OFF
0 D16
1 D8
2 LR12
@status current Introduced in 2.2.0
index
(number) module index (0 for internal, 1 for external)
nil
requested module does not exist
table
module parameters:
subType
(number) protocol index
modelId
(number) receiver number
firstChannel
(number) start channel (0 is CH1)
channelsCount
(number) number of channels sent to module
Type
(number) module type
if the module type is Multi additional information are available
protocol
(number) protocol number (Multi only)
subProtocol
(number) sub-protocol number (Multi only)
channelsOrder
(number) first 4 channels expected order (Multi only)
Sets current global variable value. See also model.getGlobalVariable()
index
zero based global variable index, use 0 for GV1, 8 for GV9
flight_mode
Flight mode number (0 = FM0, 8 = FM8)
value
new value for global variable. Permitted range is from -1024 to 1024.
none
Global variable can only store integer values, any floating point value is converted into integer value by truncating everything behind a floating point.
Set Logical Switch parameters
@status current Introduced in 2.0.0
switch
(unsigned number) logical switch number (use 0 for LS1)
value
(table) see model.getLogicalSwitch() for table format
none
If a parameter is missing from the value, then that parameter remains unchanged.
To set the and
member (which is Lua keyword) use the following syntax: model.setLogicalSwitch(30, {func=4,v1=1,v2=-99, ["and"]=24})
Set RF module parameters
@status current Introduced in 2.2.0, modified in 2.3.12 (proto/subproto)
index
(number) module index (0 for internal, 1 for external)
value
module parameters, see model.getModule()
none
If a parameter is missing from the value, then that parameter remains unchanged.
Insert an Input at specified line
@status current Introduced in 2.0.0, curveType/curveValue/carryTrim added in 2.3, inputName added 2.3.10
input
(unsigned number) input number (use 0 for Input1)
line
(unsigned number) input line (use 0 for first line)
value
(table) input data, see model.getInput()
none
Set Custom Function parameters
@status current Introduced in 2.0.0, TODO rename function
function
(unsigned number) custom function number, see Special Function Constants.
value
(table) custom function parameters, see model.getCustomFunction() for table format
none
If a parameter is missing from the value, then that parameter remains unchanged.