All pages
Powered by GitBook
1 of 41

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...

lcd.RGB(r, g, b | rgb)

Returns a drawing flag with RGB color code

@status current Introduced in 2.2.0

Parameters

  • 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)

Return value

  • flag with RGB565 color

Notice

Only available on radios with color display. Use either lcd.RGB(r,g,b) or lcd.RGB(rgb).

Lcd Functions

Lcd Functions Overview

Description

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.

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.

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 , , and that can be used with lcd drawing functions.

flags and patterns
colors
screen size

lcd.drawBitmap(bitmap, x, y [, scale])

Displays a bitmap at (x,y)

@status current Introduced in 2.2.0

Parameters

  • 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.

Return value

none

Notice

Only available on Horus

lcd.drawLine(x1, y1, x2, y2, pattern, flags)

Draw a straight line on LCD

@status current Introduced in 2.0.0, flags introduced in 2.3.6

Parameters

  • x1,y1 (positive numbers) starting coordinate

lcd.drawTimer(x, y, value [, flags [, inversColor]])

Display a value formatted as time at (x,y)

@status current Introduced in 2.0.0

Parameters

  • x,y (positive numbers) starting coordinate

lcd.drawFilledCircle(x, y, r [, flags])

Draw a filled circle at (x, y) of specified radius

@status current Introduced in 2.4.0

Parameters

  • x,y (positive numbers) center position

lcd.drawBitmapPattern(bitmap, x, y [, flags])

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

lcd.clear([color])

Clear the LCD screen

@status current Introduced in 2.0.0, color parameter introduced in 2.2.0 RC12

Parameters

  • color

lcd.drawHudRectangle(pitch, roll, xmin, xmax, ymin, ymax [, flags])

Draw a rectangle in perspective

@status current Introduced in 2.4.0

Parameters

  • pitch,roll (positive numbers) pitch and roll to define the orientation of the rectangle

x2,y2 (positive numbers) end coordinate

  • pattern SOLID or DOTTED

  • flags (optional) please see flags and color constants

  • Return value

    none

    Notice

    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)

    value (number) time in seconds

  • flags (optional) please see flags and color constants

  • inversColor (optional with INVERS flag) overrides the inverse text color for INVERS

  • Return value

    none

    r (number) radius in pixels

  • flags (optional) please see flags and color constants

  • Return value

    none

  • flags (optional) please see Lcd functions overview

  • Return value

    none

    Notice

    Only available on Horus

    (optional, only on color screens)

    Return value

    none

  • xmin,xmax,ymin,ymax (positive numbers) the limits of the rectangle

  • flags (optional) please see flags and color constants

  • Return value

    none

    lcd.drawPixmap(x, y, name)

    Draw a bitmap at (x,y)

    @status current Introduced in 2.0.0

    Parameters

    • x,y (positive numbers) starting coordinates

    • name (string) full path to the bitmap on SD card (i.e. “/IMAGES/test.bmp”)

    Return value

    none

    Notice

    Maximum image size is [display width / 2] x [display height] pixels.

    lcd.getLastPos()

    Returns the rightmost x position from previous output

    @status current Introduced in 2.0.0

    Parameters

    none

    Return value

    • number (integer) x position

    Notice

    Only available on Taranis

    For added clarity, it is recommended to use lcd.getLastRightPos()

    lcd.drawNumber(x, y, value [, flags [, inversColor]])

    Display a number at (x,y)

    @status current Introduced in 2.0.0

    Parameters

    • x,y (positive numbers) starting coordinate

    • value (number) value to display

    • flags (optional) please see and constants

    • inversColor (optional with INVERS flag) overrides the inverse text color for INVERS

    Return value

    none

    lcd.drawAnnulus(x, y, r1, r2, start, end [, flags])

    Draw an arc

    @status current Introduced in 2.4.0

    Parameters

    • 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

    • flags (optional) please see and constants

    Return value

    none

    lcd.drawPoint(x, y)

    Draw a single pixel at (x,y) position

    @status current Introduced in 2.0.0

    Parameters

    • x (positive number) x position

    • y (positive number) y position

    • flags (optional) please see and constants

    Return value

    none

    Notice

    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!)

    lcd.drawBitmapPatternPie(bitmap, x, y, startAngle, endAngle [, flags])

    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

    lcd.drawSource(x, y, source [, flags])

    Displays the name of the corresponding input as defined by the source at (x,y)

    @status current Introduced in 2.0.0

    Parameters

    • x,y (positive numbers) starting coordinate

    lcd.drawTextLines(x, y, w, h, text [, flags])

    Draw text inside rectangle (x,y,w,h) with line breaks

    @status current Introduced in 2.5.0

    Parameters

    • x,y (positive numbers) starting coordinate

    lcd.drawText(x, y, text [, flags [, inversColor]])

    Draw a text beginning at (x,y)

    @status current Introduced in 2.0.0, SHADOWED introduced in 2.2.1

    Parameters

    • x,y

    lcd.drawLineWithClipping(x1, y1, x2, y2, xmin, xmax, ymin, ymax, pattern [, flags])

    Draw a line only inside a rectangle

    @status current Introduced in 2.4.0

    Parameters

    • x1,y1,x2,y1 (positive numbers) coordinates of the start and end of the unclipped line

    lcd.resetBacklightTimeout()

    Reset the backlight timeout

    @status current Introduced in 2.3.6

    Parameters

    none

    lcd.refresh()

    Refresh the LCD screen

    From 2.4.0 on color LCDs, this is done automatically when the screen needs to be refreshed (on events and depending on refresh period).

    @status current Only used on non-color LCDs.

    Parameters

    none

    lcd.drawTriangle(x1, y1, x2, y2, x3, y3 [, flags])

    Draw a triangle

    @status current Introduced in 2.4.0

    Parameters

    • x1,y1,x2,y2,x3,y3 (positive numbers) coordinates of the three vertices

    lcd.drawFilledTriangle(x1, y1, x2, y2, x3, y3 [, flags])

    Draw a filled triangle

    @status current Introduced in 2.4.0

    Parameters

    • x1,y1,x2,y2,x3,y3 (positive numbers) coordinates of the three vertices

    lcd.invertRect(x, y, w, h [, flags])

    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

    lcd.getLastLeftPos()

    Returns the leftmost x position from previous drawtext or drawNumber output

    @status current Introduced in 2.2.0

    Parameters

    none

    lcd.drawSwitch(x, y, switch, flags)

    Draw a text representation of switch at (x,y)

    @status current Introduced in 2.0.0

    Parameters

    • x,y (positive numbers) starting coordinate

    lcd.getColor(flags)

    Get the color value from flags

    @status current Introduced in 2.3.11

    Parameters

    • flags (flags) please see and

  • startAngle Start angle

  • endAngle End angle

  • flags (optional) please see Lcd functions overview

  • Return value

    none

    Notice

    Only available on Horus

    source (number) source index

  • flags (optional) please see flags and color constants

  • Return value

    none

    w,h (positive numbers) width and height of bounding rectangle

  • text (string) text to display

  • flags (optional) please see Lcd functions overview for drawing flags and colors, and Appendix for available characters in each font set. RIGHT, CENTER and VCENTER are not implemented.

  • Return value

    none

    Notes

    • Color radios only.

    (positive numbers) starting coordinate
  • text (string) text to display

  • flags (optional) please see flags and color constants for drawing flags and colors, and Appendix for available characters in each font set.

  • inversColor (optional with the INVERS flag) overrides the inverse text color for INVERS

  • Return value

    none

  • 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

  • flags (optional) please see flags and color constants

  • Return value

    none

    Return value

    none

    Return value

    none

    flags (optional) please see flags and color constants

    Return value

    none

    flags (optional) please see flags and color constants

    Return value

    none

  • h (number) height in pixels

  • flags (optional) please see Lcd functions overview

  • Return value

    none

    Return value
    • number (integer) x position

    Notice

    Only available on Taranis

    switch (number) number of switch to display, negative number displays negated switch

  • flags (optional) please see flags constants, only SMLSIZE, BLINK and INVERS.

  • Return value

    none

    flags
    color
    flags
    color
    flags
    color
    constants

    Return value

    • color (flag) only the RGB565 color value of the input

    Notice

    Only available on radios with color display

    flags
    color

    lcd.exitFullScreen()

    Exit full screen widget mode.

    @status current Introduced in 2.5.0

    Notice

    Only available on radios with color display

    lcd.drawCombobox(x, y, w, list, idx [, flags])

    Draw a combo box

    @status current Introduced in 2.0.0

    Parameters

    • 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

    Return value

    none

    Notice

    Only available on Taranis

    lcd.drawFilledRectangle(x, y, w, h [, flags])

    Draw a solid rectangle from top left corner (x,y) of specified width and height

    @status current Introduced in 2.0.0

    Parameters

    • x,y (positive numbers) top left corner position

    • w (number) width in pixels

    • h (number) height in pixels

    • flags (optional) please see and constants

    • opacity (number) opacity defaults to 0 (only on Horus)

    Return value

    none

    lcd.drawArc(x, y, r, start, end [, flags])

    Draw an arc

    @status current Introduced in 2.4.0

    Parameters

    • x,y (positive numbers) coordinates of the center

    • r (positive number) radius

    • start,end (positive numbers) start and end of the arc

    • flags (optional) please see and constants

    Return value

    none

    lcd.drawPie(x, y, r, start, end [, flags])

    Draw a pie slice

    @status current Introduced in 2.4.0

    Parameters

    • x,y (positive numbers) coordinates of the center

    • r (positive number) radius

    • start,end (positive numbers) start and end of the pie slice

    • flags (optional) please see and constants

    Return value

    none

    lcd.drawRectangle(x, y, w, h [, flags [, t]])

    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

    Parameters

    • x,y (positive numbers) top left corner position

    • w (number) width in pixels

    • h (number) height in pixels

    • flags (optional) please see and constants

    • t (number) thickness in pixels, defaults to 1 (only on Horus)

    • opacity (number) opacity defaults to 0 (only on Horus)

    Return value

    none

    lcd.drawGauge(x, y, w, h, fill, maxfill [, flags])

    Draw a simple gauge that is filled based upon fill value

    @status current Introduced in 2.0.0, changed in 2.2.0

    Parameters

    • 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 (optional) please see and constants

    Return value

    none

    lcd.setColor(colorIndex, color)

    Change an indexed color (theme colors and CUSTOM_COLOR).

    @status current Introduced in 2.2.0

    Notice

    • Changing theme colors affects not only other Lua widgets, but the entire radio interface.

    • Only available on radios with color display

    Parameters

    • colorIndex (flags) must be an indexed color, please see constants.

    • color (flags) please see constants.

    Return value

    none

    Notice

    Only available on radios with color display

    lcd.sizeText(text [, flags])

    Get the width and height of a text string drawn with flags

    @status current Introduced in 2.5.0

    Parameters

    • text (string)

    • flags (optional) please see and constants

    Return value

    • w,h (integers) width and height of the text

    lcd.drawChannel(x, y, source, flags)

    Display a telemetry value at (x,y)

    @status current Introduced in 2.0.6, changed in 2.1.0 (only telemetry sources are valid)

    Parameters

    • 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

    Return value

    none

    lcd.drawScreenTitle(title, page, pages)

    Draw a title bar

    @status current Introduced in 2.0.0

    Parameters

    • title (string) text for the title

    0 or not present combo box collapsed, text normal

    page (number) page number

  • pages (number) total number of pages. Only used as indicator on the right side of title bar. (i.e. idx=2, cnt=5, display 2/5)

  • Return value

    none

    Notice

    Only available on Taranis

    flags
    color
    flags
    color
    flags
    color
    flags
    color
    flags
    color
    color
    color
    flags
    color
    flags
    color

    lcd.getLastRightPos()

    Returns the rightest x position from previous drawtext or drawNumber output

    @status current Introduced in 2.2.0

    Parameters

    none

    Return value

    • number (integer) x position

    Notice

    Only available on Taranis

    This is strictly equivalent to former lcd.getLastPos()

    lcd.drawCircle(x, y, r [, flags])

    Draw a circle at (x, y) of specified radius

    @status current Introduced in 2.4.0

    Parameters

    • x,y (positive numbers) center position

    r (number) radius in pixels

  • flags (optional) please see flags and color constants

  • Return value

    none