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...
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...
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...
This section describes various constants that are provided for Lua by EdgeTX.
This section describes the Lua libraries, functions and constants that are provided by EdgeTX.
Invert a rectangle zone from top left corner (x,y) of specified width and height
@status current Introduced in 2.8.0
Parameters
x,y
(positive numbers) top left corner position
w
(number) width in pixels
h
(number) height in pixels
flags
(optional) please see Lcd functions overview
Return value
none
On radios with color display, a color may be added to the flags described above.
There are two types of color constants: one that is an index into a table holding a palette of theme colors, and one that is just a color.
These are the theme colors plus CUSTOM_COLOR, and they can be changed with the function lcd.setColor(color_index, color). Please note: if an indexed color is changed, then it changes everywhere that it is used. For the theme colors, this is not only in other widgets, but everywhere throughout the radio's user interface!
COLOR_THEME_PRIMARY1
COLOR_THEME_PRIMARY2
COLOR_THEME_PRIMARY3
COLOR_THEME_SECONDARY1
COLOR_THEME_SECONDARY2
COLOR_THEME_SECONDARY3
COLOR_THEME_FOCUS
COLOR_THEME_EDIT
COLOR_THEME_ACTIVE
COLOR_THEME_WARNING
COLOR_THEME_DISABLED
CUSTOM_COLOR
These color constants cannot be changed:
BLACK
WHITE
LIGHTWHITE
YELLOW
BLUE
DARKBLUE
GREY
DARKGREY
LIGHTGREY
RED
DARKRED
GREEN
DARKGREEN
LIGHTBROWN
DARKBROWN
BRIGHTGREEN
ORANGE
These should no longer be used, but they are included for backwards compatibility. The old OpenTX API had a large number of indexed theme colors, and these have been mapped to the new theme colors as follows:
ALARM_COLOR -> COLOR_THEME_WARNING
BARGRAPH_BGCOLOR -> COLOR_THEME_SECONDARY3
BARGRAPH1_COLOR -> COLOR_THEME_SECONDARY1
BARGRAPH2_COLOR -> COLOR_THEME_SECONDARY2
CURVE_AXIS_COLOR -> COLOR_THEME_SECONDARY2
CURVE_COLOR -> COLOR_THEME_SECONDARY1
CURVE_CURSOR_COLOR -> COLOR_THEME_WARNING
HEADER_BGCOLOR -> COLOR_THEME_FOCUS
HEADER_COLOR -> COLOR_THEME_SECONDARY1
HEADER_CURRENT_BGCOLOR -> COLOR_THEME_FOCUS
HEADER_ICON_BGCOLOR -> COLOR_THEME_SECONDARY1
LINE_COLOR -> COLOR_THEME_PRIMARY3
MAINVIEW_GRAPHICS_COLOR -> COLOR_THEME_SECONDARY1
MAINVIEW_PANES_COLOR -> COLOR_THEME_PRIMARY2
MENU_TITLE_BGCOLOR -> COLOR_THEME_SECONDARY1
MENU_TITLE_COLOR -> COLOR_THEME_PRIMARY2
MENU_TITLE_DISABLE_COLOR -> COLOR_THEME_PRIMARY3
OVERLAY_COLOR -> COLOR_THEME_PRIMARY1
SCROLLBOX_COLOR -> COLOR_THEME_SECONDARY3
TEXT_BGCOLOR -> COLOR_THEME_SECONDARY3
TEXT_COLOR -> COLOR_THEME_SECONDARY1
TEXT_DISABLE_COLOR -> COLOR_THEME_DISABLED
TEXT_INVERTED_BGCOLOR -> COLOR_THEME_FOCUS
TEXT_INVERTED_COLOR -> COLOR_THEME_PRIMARY2
TITLE_BGCOLOR -> COLOR_THEME_SECONDARY1
TRIM_BGCOLOR -> COLOR_THEME_FOCUS
TRIM_SHADOW_COLOR -> COLOR_THEME_PRIMARY1
WARNING_COLOR -> COLOR_THEME_WARNING
These constants are used with logical switch functions.
For detailed function explanation see Logiacal Switches functions in EdgeTX manual.
Constant name | Logical switch function |
---|---|
Name | Description | EdgeTX ver | Notes |
---|---|---|---|
Name | Description | EdgeTX ver | Notes |
---|---|---|---|
Name | Description | EdgeTX ver | Notes |
---|---|---|---|
Name | Description |
---|
Index | Unit | Defined as |
---|
Type | Description |
---|
LS_FUNC_NONE
-
LS_FUNC_VEQUAL
a = x
LS_FUNC_VALMOSTEQUAL
a ~ x
LS_FUNC_VPOS
a > x
LS_FUNC_VNEG
a < x
LS_FUNC_RANGE
LS_FUNC_APOS
a > |x|
LS_FUNC_ANEG
a < |x|
LS_FUNC_AND
AND
LS_FUNC_OR
OR
LS_FUNC_XOR
XOR
LS_FUNC_EDGE
Edge
LS_FUNC_EQUAL
a = b
LS_FUNC_GREATER
a > b
LS_FUNC_LESS
a < b
LS_FUNC_DIFFEGREATER
∆ ≥ x
LS_FUNC_ADIFFEGREATER
|∆| ≥ x
LS_FUNC_TIMER
Timer
LS_FUNC_STICKY
Sticky
0
normal font, default precision for numeric
2.3
XXLSIZE
jumbo font
2.3
DBLSIZE
double size font
2.3
MIDSIZE
mid sized font
2.3
SMLSIZE
small font
2.3
BOLD
bold font
2.3
Only color displays. This is a font size on its own - cannot be combined with other font size flags.
SHADOWED
shadow font
2.3
Only color displays
INVERS
inverted display
2.3
BLINK
blinking text
2.3
LEFT
left justify
2.3
Default for most functions not related to bitmaps
RIGHT
right justify
2.3
CENTER
center justify
2.3
Only color displays
VCENTER
center vertically
2.5.0
Only color displays
PREC1
single decimal place
2.3
display with one decimal place (number 386 is displayed as 38.6)
PREC2
two decimal places
2.3
display with one decimal place (number 386 is displayed as 3.86)
GREY_DEFAULT
grey fill
2.3
TIMEHOUR
display hours
2.3
Only for lcd/drawTimer
FORCE
pixels will be black
2.3
ERASE
pixels will be white
2.3
SOLID
lines will appear soild
2.3
DOTTED
lines will appear dotted
2.3
LCD_W | width in pixels |
LCD_H | height in pixels |
0 | Raw unit (no unit) | UNIT_RAW |
1 | Volts | UNIT_VOLTS |
2 | Amps | UNIT_AMPS |
3 | Milliamps | UNIT_MILLIAMPS |
4 | Knots | UNIT_KTS |
5 | Meters per Second | UNIT_METERS_PER_SECOND |
6 | Feet per Second | UNIT_FEET_PER_SECOND |
7 | Kilometers per Hour | UNIT_KMH |
8 | Miles per Hour | UNIT_MPH |
9 | Meters | UNIT_METERS |
10 | Feet | UNIT_FEET |
11 | Degrees Celsius | UNIT_CELSIUS |
12 | Degrees Fahrenheit | UNIT_FAHRENHEIT |
13 | Percent | UNIT_PERCENT |
14 | Milliamp Hour | UNIT_MAH |
15 | Watts | UNIT_WATTS |
16 | Milliwatts | UNIT_MILLIWATTS |
17 | dB | UNIT_DB |
18 | RPM | UNIT_RPMS |
19 | G | UNIT_G |
20 | Degrees | UNIT_DEGREE |
21 | Radians | UNIT_RADIANS |
22 | Milliliters | UNIT_MILLILITERS |
23 | Fluid Ounces | UNIT_FLOZ |
24 | Ml per minute | UNIT_MILLILITERS_PER_MINUTE |
35 | Hours | UNIT_HOURS |
36 | Minutes | UNIT_MINUTES |
37 | Seconds | UNIT_SECONDS |
38 | Virtual unit | UNIT_CELLS |
39 | Virtual unit | UNIT_DATETIME |
40 | Virtual unit | UNIT_GPS |
41 | Virtual unit | UNIT_BITFIELD |
42 | Virtual unit | UNIT_TEXT |
COLOR | Displays a color picker, returns a color flag value |
BOOL | Displays a toggle/checkbox, value toggles between 0 and 1 |
STRING | Text input option, limited to 8 characters |
TIMER | Choice option, lets you pick from available timers |
SOURCE | Choice option, lets you pick from available sources (i.e. sticks, switches, LS) |
VALUE | Numerical input option, can specify default, min and max value |
TEXT_SIZE | Choice option, lets you pick from the available text sizes (i.e. small, large) |
ALIGNMENT | Choice option, lets you pick from available alignment options (i.e. left, center, right) |
Draw a combo box
@status current Introduced in 2.0.0
x,y
(positive numbers) top left corner position
w
(number) width of combo box in pixels
list
(table) combo box elements, each element is a string
idx
(integer) index of entry to highlight
flags
(unsigned number) drawing flags, the flags can not be combined:
BLINK
combo box is expanded
INVERS
combo box collapsed, text inversed
0 or not present
combo box collapsed, text normal
none
Only available on Taranis
The radio's special characters can be used with the following text constants.
CHAR_RIGHT
CHAR_LEFT
CHAR_UP
CHAR_DOWN
CHAR_DELTA
CHAR_STICK
CHAR_POT
CHAR_SLIDER
CHAR_SWITCH
CHAR_TRIM
CHAR_INPUT
CHAR_FUNCTION
CHAR_CYC
CHAR_TRAINER
CHAR_CHANNEL
CHAR_TELEMETRY
CHAR_LUA
These constants determine the type of a Special Function
FUNC_OVERRIDE_CHANNEL
FUNC_TRAINER
FUNC_INSTANT_TRIM
FUNC_RESET
FUNC_SET_TIMER
FUNC_ADJUST_GVAR
FUNC_VOLUME
FUNC_SET_FAILSAFE
FUNC_RANGECHECK
FUNC_BIND
FUNC_PLAY_SOUND
FUNC_PLAY_TRACK
FUNC_PLAY_VALUE
FUNC_PLAY_SCRIPT
FUNC_RESERVE5
FUNC_BACKGND_MUSIC
FUNC_BACKGND_MUSIC_PAUSE
FUNC_VARIO
FUNC_HAPTIC
FUNC_LOGS
FUNC_BACKLIGHT
FUNC_SCREENSHOT
FUNC_RACING_MODE
FUNC_DISABLE_TOUCH
Draw a simple gauge that is filled based upon fill value
@status current Introduced in 2.0.0, changed in 2.2.0
x,y
(positive numbers) top left corner position
w
(number) width in pixels
h
(number) height in pixels
fill
(number) amount of fill to apply
maxfill
(number) total value of fill
flags
(unsigned number) drawing flags
none
Draw a rectangle from top left corner (x,y) of specified width and height
@status current Introduced in 2.0.0, changed in 2.2.0
x,y
(positive numbers) top left corner position
w
(number) width in pixels
h
(number) height in pixels
flags
(unsigned number) drawing flags
t
(number) thickness in pixels, defaults to 1 (only on Horus)
none
Draw a single pixel at (x,y) position
@status current Introduced in 2.0.0
x
(positive number) x position
y
(positive number) y position
flags
(optional) lcdflags
none
Taranis has an LCD display width of 212 pixels and height of 64 pixels. Position (0,0) is at top left. Y axis is negative, top line is 0, bottom line is 63. Drawing on an existing black pixel produces white pixel (TODO check this!)
Draw a straight line on LCD
@status current Introduced in 2.0.0, flags introduced in 2.3.6
x1,y1
(positive numbers) starting coordinate
x2,y2
(positive numbers) end coordinate
pattern
SOLID or DOTTED
flags
lcdflags
none
If the start or the end of the line is outside the LCD dimensions, then the whole line will not be drawn (starting from OpenTX 2.1.5)
Display a value formatted as time at (x,y)
@status current Introduced in 2.0.0, SHADOWED
introduced in 2.2.1
x,y
(positive numbers) starting coordinate
value
(number) time in seconds
flags
(unsigned number) drawing flags:
0 or not specified
normal representation (minutes and seconds)
TIMEHOUR
display hours
other general LCD flag also apply
SHADOWED
Horus only, apply a shadow effect
none
Draw a text representation of switch at (x,y)
@status current Introduced in 2.0.0
x,y
(positive numbers) starting coordinate
switch
(number) number of switch to display, negative number displays negated switch
flags
(unsigned number) drawing flags, only SMLSIZE, BLINK and INVERS.
none
In addition to the key events described in the previous section, radios with a color touch screen also provide touch events to the widget scripts.
The following touch events are passed in the event
argument to the widget script refresh
function (when in full screen mode), just like the key events. The following touch events are provided:
In addition to the above touch events a touchState
table is passed to refresh
with the following addional data fields:
touchState
is nil
if event
is not a touch event. This can be used to test if we have a touch event or a key event.
Since Lua evaluates a nil
value to false
and everything else to true
:
if touchState then
we have a touch event.
x, y
are present for all touch events.
startX, startY, slideX, slideY
are only present with EVT_TOUCH_SLIDE
.
swipeUp
/ swipeDown
/ swipeLeft
/ swipeRight
may be present only withEVT_TOUCH_SLIDE
.
tapCount
is zero for anything but EVT_TOUCH_TAP
.
Displays prevoiusly loaded bitmap at (x,y) and optionally scales it.
none
Omitting scale draws image in 1:1 scale and is faster than specifying 100 for scale parameter.
Display a number at (x,y)
@status current Introduced in 2.0.0, SHADOWED
introduced in 2.2.1
x,y
(positive numbers) starting coordinate
value
(number) value to display
0 or not specified
display with no decimal (like abs())
PREC1
display with one decimal place (number 386 is displayed as 38.6)
PREC2
display with tow decimal places (number 386 is displayed as 3.86)
none
Draw a text beginning at (x,y)
@status current Introduced in 2.0.0, SHADOWED
introduced in 2.2.1
x,y
(positive numbers) starting coordinate
text
(string) text to display
0 or not specified
normal font
XXLSIZE
jumbo sized font
DBLSIZE
double size font
MIDSIZE
mid sized font
SMLSIZE
small font
INVERS
inverted display
BLINK
blinking text
SHADOWED
Horus only, apply a shadow effect
none
Description
Lcd functions allow scripts to interact with the transmitter display. This access is limited to the 'run' functions of One-Time and Telemetry scripts. Widget scripts on the Horus (X10 and X12S) can make use of the lcd functions as well.
Notes:
The run function is periodically called when the screen is visible. In OpenTX 2.0 each invocation starts with a blank screen (unless lcd.lock() is used). Under OpenTX 2.1 screen state is always persisted across calls to the run function. Many scripts originally written for OpenTX 2.0 require a call to lcd.clear() at the beginning of their run function in order to display properly under 2.1 and 2.2.
Many of the lcd functions accept parameters named flags and patterns. The names and their meanings are described below.
Touch Event Name | Description |
---|---|
touchState fields | Description |
---|---|
Name | Req | Type | Description |
---|---|---|---|
EdgeTX version | Action |
---|---|
Name | Req | Type | Description |
---|---|---|---|
EdgeTX version | Action |
---|---|
flags
(unsigned number) drawing :
other general LCD also apply\
flags
(optional) please see and constants
flags
(unsigned number) drawing flags. All values can be combined together using the + character. ie BLINK + DBLSIZE. See the for available characters in each font set.
flags
(optional) please see and constants
flags
(optional) please see and constants
value
timer parameters, see
Name | Req | Type | Description |
---|
Name | Req | Type | Description |
---|
color_flag
. See
EdgeTX version | Action |
---|
flags
(optional) please see and constants
Name | Req | Type | Description |
---|
This function works only in stand-alone and telemetry & widget scripts. See .
EdgeTX version | Action |
---|
flags
(optional) please see for drawing flags and colors, and for available characters in each font set. RIGHT, CENTER and VCENTER are not implemented.
Name | Type | Req | Description |
---|
Avail | Status | Comment |
---|
EdgeTX version | Change |
---|
Name | Description | Version | Notes |
---|
Name | Description |
---|
Name | Description |
---|
Radio | LCD_W | LCD_H | Colours |
---|
EVT_TOUCH_FIRST
When the finger touches down on the screen
EVT_TOUCH_TAP
If the finger leaves the screen after a quick tap
EVT_TOUCH_BREAK
If the finger leaves the screen without tap or slide
EVT_TOUCH_SLIDE
Repeats while the finger is sliding on the screen
x, y
Current touch point
startX, startY
Point where slide started
slideX, SlideY
Movement since previous SLIDE event (or start of slide)
swipeUp / swipeDown / swipeLeft / swipeRight
The field is present and equal to true
if a swipe event occurred in that direction
tapCount
Counts the number of consecutive taps
x
top coordinate
y
left coordinate
source
can be a source identifier (number) or a source name (string). See getValue()
flags
See Drawing Flags
2.3.0
Introduced
bitmap
bitmapPointer
stored in variable pointer to a bitmap previously opened with Bitmap.open
x
integer
top coordinate
y
integer
left coordinate
scale
integer (0-100)
scale in percent ie. 50 divides size by two, 100 displays bitmap in original size, 200 doubles size.
2.3.0
Introduced
r | integer | number between 0 (0x00) and 255 (0xFF) that expresses te amount of red in the color |
g | interer | number between (0x00) and 255 (0xFF) that expresses te amount of green in the color |
b | integer | number between (0x00) and 255 (0xFF)that expresses te amount of blue in the color |
rgb | integer | number between 0 (0x00) and 16777215 (0xFFFFFF) that expresses the RGB value (0xFF0000=RED, 0x00FF00=GREEN, 0x0000FF=BLUE) |
2.3.0 | Introduced |
2.3.0 | Introduced |
curveID | number | Curve ID number. Normal Lua index. Use 1 for curve 1, 8 for Input 8 etc. |
| string | Curve name |
| number | Curve type ID number 0 - ??? 1 - ??? 2 - ??? |
| boolean |
|
| number | number of curve's points |
| table | table of points y coordinates values
|
| table | table of points x coordinates values
|
BW radios |
Color radios |
2.4.0 | Introduced |
2.9.0 | changed curveID index from zero based to normal LUA (starts from 1) |
0 | normal font, default precision for numeric |
DBLSIZE | double size font |
MIDSIZE | mid sized font |
SMLSIZE | small font |
INVERS | inverted display |
BLINK | blinking text |
XXLSIZE | jumbo font | 2.0.6 |
LEFT | left justify | 2.0.6 | Default for most functions not related to bitmaps |
RIGHT | right justify |
PREC1 | single decimal place |
PREC2 | two decimal places |
GREY_DEFAULT | grey fill |
TIMEHOUR | dislay hours | Only for drawTimer |
FORCE | pixels will be black |
ERASE | pixels will be white |
DOTTED | lines will appear dotted |
LCD_W | width in pixels |
LCD_H | height in pixels |
X7 | 128 | 64 | 1 bit |
X9D | 212 | 64 | 4 bit |
X9D+ | 212 | 64 | 4 bit |
X9E | 212 | 64 | 4 bit |
X10 | 480 | 272 | RGB565 |
X12S | 480 | 272 | RGB565 |
Draw a line only inside a rectangle
@status current Introduced in 2.4.0
x1,y1,x2,y1
(positive numbers) coordinates of the start and end of the unclipped line
xmin,xmax,ymin,ymax
(positive numbers) the limits of the rectangle inside which the line is drawn
pattern
(FORCE, ERASE, DOTTED) please see Lcd functions overview
none
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 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.
Raises a pop-up on screen that allows uses input
@status current Introduced in 2.0.0
title
(string) text to display
event
(number) the event variable that is passed in from the Run function (key pressed)
input
(number) value that can be adjusted by the +/- keys
min
(number) min value that input can reach (by pressing the - key)
max
(number) max value that input can reach
number
result of the input adjustment
"OK"
user pushed ENT key
"CANCEL"
user pushed EXIT key
Use only from stand-alone and telemetry scripts.
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
Set the current Model information
@status current Introduced in 2.0.6, changed in TODO
value
model information data, see model.getInfo()
none
If a parameter is missing from the value, then that parameter remains unchanged.
Set servo parameters
@status current Introduced in 2.0.0
index
(unsigned number) channel number (use 0 for CH1)
value
(table) servo parameters, see model.getOutput() for table format
none
If a parameter is missing from the value, then that parameter remains unchanged.
Displays a bitmap pattern at (x,y)
@status current Introduced in 2.8.0
Parameters
bitmap
(pointer) point to a bitmap previously opened with Bitmap.open()
x,y
(positive numbers) starting coordinates
flags
(optional) please see Lcd functions overview
Return value
none
Notice
Only available on Horus
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
Loads a bitmap in memory, for later use with lcd.drawBitmap(). Bitmaps should be loaded only once, returned object should be stored and used for drawing. If loading fails for whatever reason the resulting bitmap object will have width and height set to zero.
Bitmap loading can fail if:
File is not found or contains invalid image
System is low on memory
Combined memory usage of all Lua script bitmaps exceeds certain value
@status current Introduced in 2.2.0
name
(string) full path to the bitmap on SD card (i.e. “/IMAGES/test.bmp”)
bitmap
(object) a bitmap object that can be used with other bitmap functions
Only available on Horus
Displays a bitmap pattern pie at (x,y)
@status current Introduced in 2.8.0
Parameters
bitmap
(pointer) point to a bitmap previously opened with Bitmap.open()
x,y
(positive numbers) starting coordinates
startAngle
Start angle
endAngle
End angle
flags
(optional) please see Lcd functions overview
Return value
none
Notice
Only available on Horus
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)
Raises a pop-up on screen that shows a warning
@status current Introduced in 2.2.0
title
(string) text to display
event
(number) the event variable that is passed in from the Run function (key pressed)
"CANCEL"
user pushed EXIT key
Use only from stand-alone and telemetry scripts.
Raises a pop-up on screen that asks for confirmation
@status current Introduced in 2.2.0, changed from (title, event) to (title, message, event) in 2.3.8
title
(string) title to display
message
(string) text to display
event
(number) the event variable that is passed in from the Run function (key pressed)
"CANCEL"
user pushed EXIT key
Use only from stand-alone and telemetry scripts.
Set a color for specific area
@status current Introduced in 2.2.0
area
(unsigned number) specific screen area in the list bellow
CUSTOM_COLOR
DEFAULT_COLOR
DEFAULT_BGCOLOR
FOCUS_COLOR
FOCUS_BGCOLOR
LINE_COLOR
CHECKBOX_COLOR
MENU_BGCOLOR
MENU_COLOR
MENU_TITLE_DISABLE_COLOR
HEADER_COLOR
ALARM_COLOR
HIGHLIGHT_COLOR
TEXT_DISABLE_COLOR
HEADER_COLOR
DISABLE_COLOR
CURVE_CURSOR_COLOR
TITLE_BGCOLOR
TRIM_BGCOLOR
TRIM_SHADOW_COLOR
MAINVIEW_PANES_COLOR
MAINVIEW_GRAPHICS_COLOR
MENU_BGCOLOR
HEADER_ICON_BGCOLOR
HEADER_CURRENT_BGCOLOR
MAINVIEW_PANES_COLOR
MAINVIEW_GRAPHICS_COLOR
OVERLAY_COLOR
BARGRAPH1_COLOR
BARGRAPH2_COLOR
BARGRAPH_BGCOLOR
CUSTOM_COLOR
color
(number) color in 5/6/5 rgb format. The following prefined colors are available
WHITE
GREY
LIGHTGREY
DARKGREY
BLACK
YELLOW
BLUE
RED
DARKRED
none
Only available on Colorlcd radios
color | integer (colorFlag) |
see
Name | Type | Req | Description |
---|---|---|---|
Avail | Status | Comment | |
---|---|---|---|
EdgeTX version | Change |
---|---|
flags
(optional) please see and constants
Avail | Status | Comment |
---|
EdgeTX version | Change |
---|
Avail | Status | Comment |
---|
EdgeTX version | Change |
---|
Avail | Status | Comment |
---|
EdgeTX version | Change |
---|
inputID
number
input ID number. Zero based. Use 0 for Input 1, 7 for Input 8 etc.
lineID
number
line ID number. Zero based. Use 0 for line 1, 1 for line 2 etc.
BW radios
Color radios
2.4.0
Introduced
BW radios | active |
Color radios | active |
2.4.0 | Introduced |
BW radios | active |
Color radios | active |
2.4.0 | Introduced |
BW radios | active |
Color radios | active |
2.4.0 | Introduced |
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
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)
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 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
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
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
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 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.
Set Flight mode parameters
@status current Introduced in 2.3.10
index
(unsigned number) flight mode number (use 0 for FM0)
params
see model.getFlightMode() return format for table format.
none
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
Return a 8bit bitmap mask that can be used with lcd.drawBitmapPattern()
@status current Introduced in 2.8.0
Parameters
bitmap
(pointer) point to a bitmap previously opened with Bitmap.open()
Return value
a
bitmap mask
Notice
Only available on Horus
Return a resized bitmap object
@status current Introduced in 2.8.0
Parameters
bitmap
(pointer) point to a bitmap previously opened with Bitmap.open()
width
(number) the new bitmap width
height
(number) the new bitmap height
Return value
none
Notice
Only available on Horus
Set Logical Switch parameters
@status current Introduced in 2.0.0
switch
(unsigned number) logical switch number (use 0 for LS1)
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})
Name | Type | Req | Description |
---|---|---|---|
Avail | Status | Comment | |
---|---|---|---|
EdgeTX version | Change |
---|---|
Avail | Status | Comment | |
---|---|---|---|
EdgeTX version | Change |
---|---|
Avail | Status | Comment | |
---|---|---|---|
EdgeTX version | Change |
---|---|
value
(table) see for table format
function
(unsigned number) custom function number, see .
value
(table) custom function parameters, see for table format
chID
number
channel ID number. Zero based. Use 0 for Mix channel 1, 7 for Mix channel 8 etc.
lineID
number
line ID number. Zero based. Use 0 for line 1, 1 for line 2 etc.
BW radios
Color radios
2.4.0
Introduced
BW radios
Color radios
2.4.0
Introduced
name
string
Model's name set.
filename
string
Name of
bitmap
string
Name of model's picture file located on SD Card in /IMAGES/ folder
extendedLimits
boolean
true
if extended limits are enabled otherwise false
jitterFilter
number
BW radios
Color radios
2.4.0
Introduced
2.6.0
added filename
to return value table.
2.8.0
added extendedLimits
, jitterFilter
, labels
to return value table.