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...
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.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
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
Get current Model information
@status current Introduced in 2.0.6, changed in 2.2.0, filename added in 2.6.0, extendedLimits, jitterFilter, and labels added in 2.8.0
none
table
model information:
name
(string) model name
extendedLimits
(boolean) extended limits enabled
jitterFilter
(number) model level ADC filter
bitmap
(string) bitmap name (not present on X7)
filename
(string) model filename
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 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 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)
Get heli swash parameters
@status current Introduced in 2.8.0
Parameters
none
Return value
table
with heli swash parameters:
type
(number) 0=---, 1=120, 2=120X, 3=140, 4=90
value
(number) swash ring value (normally 0)
'collectiveSource' (number) source index
'aileronSource' (number) source index
'elevatorSource' (number) source index
'collectiveWeight'(value) -100 to 100
'aileronWeight' (value) -100 to 100
'elevatorWeight' (value) -100 to 100
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)
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
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 Curve parameters
Note this function uses Lua's usual index starting with 1 since version 2.9.0.
@status current Introduced in 2.0.12, uses Lua's normal indexing as of 2.9.0
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 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
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.
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
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 heli swash parameters
@status current Introduced in 2.8.0
Parameters
value
(table) swash ring parameters, see model.getSwashRing() for table format
Return value
none
Notice
If a parameter is missing, then that parameter remains unchanged.
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 Custom Function parameters
@status current Introduced in 2.0.0, TODO rename function
function
(unsigned number) custom function number (use 0 for CF1).
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.
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.