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...
Lcd functions allow scripts to interact with the transmitter display. This access is limited to the run
function of One-Time and Telemetry scripts, and the refresh
function of Widget scripts on radios with color display.
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.
For Widget scripts, lcd.clear()
is not needed, as each invocation starts with a blank screen showing the theme background. But it can be used to overwrite the theme background with another color by calling lcd.clear(color)
.
Please see above for a description of the constants for flags and patterns, colors, and screen size that can be used with lcd drawing functions.
Draw an arc
@status current Introduced in 2.4.0
x,y
(positive numbers) coordinates of the center
r1,r2
(positive numbers) radii of the inside and outside of the annulus
start,end
(positive numbers) start and end of the annulus
none
Displays a bitmap at (x,y)
@status current Introduced in 2.2.0
bitmap
(pointer) point to a bitmap previously opened with Bitmap.open()
x,y
(positive numbers) starting coordinates
scale
(positive numbers) scale in %, 50 divides size by two, 100 is unchanged, 200 doubles size. Omitting scale draws image in 1:1 scale and is faster than specifying 100 for scale.
none
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
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
Display a telemetry value at (x,y)
@status current Introduced in 2.0.6, changed in 2.1.0 (only telemetry sources are valid)
x,y
(positive numbers) starting coordinate
source
can be a source identifier (number) or a source name (string). See getValue()
flags
(optional) please see and constants
none
Draw a solid rectangle from top left corner (x,y) of specified width and height
@status current Introduced in 2.0.0
x,y
(positive numbers) top left corner position
w
(number) width in pixels
h
(number) height in pixels
opacity
(number) opacity defaults to 0 (only on Horus)
none
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
none
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
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
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
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)
Returns a drawing flag with RGB color code
@status current Introduced in 2.2.0
r
(integer) a number between 0 and 255 that expresses the amount of red in the color
g
(integer) a number between 0 and 255 that expresses the amount of green in the color
b
(integer) a number between 0 and 255 that expresses the amount of blue in the color
rgb
(integer) a number between 0 and 0xFFFFFF that expresses the RGB value (0xFF0000=RED, 0x00FF00=GREEN, 0x0000FF=BLUE)
flag
with RGB565 color
Only available on radios with color display. Use either lcd.RGB(r,g,b) or lcd.RGB(rgb).
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
(optional) please see flags constants, only SMLSIZE, BLINK and INVERS.
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
t
(number) thickness in pixels, defaults to 1 (only on Horus)
opacity
(number) opacity defaults to 0 (only on Horus)
none
Display a value formatted as time at (x,y)
@status current Introduced in 2.0.0
x,y
(positive numbers) starting coordinate
value
(number) time in seconds
inversColor
(optional with INVERS flag) overrides the inverse text color for INVERS
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
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 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
inversColor
(optional with the INVERS flag) overrides the inverse text color for INVERS
none
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
Draw text inside rectangle (x,y,w,h) with line breaks
@status current Introduced in 2.5.0
x,y
(positive numbers) starting coordinate
w,h
(positive numbers) width and height of bounding rectangle
text
(string) text to display
flags
(optional) please see for drawing flags and colors, and for available characters in each font set. RIGHT, CENTER and VCENTER are not implemented.
none
Color radios only.
Change an indexed color (theme colors and CUSTOM_COLOR).
@status current Introduced in 2.2.0
Changing theme colors affects not only other Lua widgets, but the entire radio interface.
Only available on radios with color display
colorIndex
(flags) must be an indexed color, please see constants.
color
(flags) please see constants.
none
Only available on radios with color display