arrow-left

All pages
gitbookPowered by GitBook
1 of 6

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

defaultStick(channel)

Get stick that is assigned to a channel. See Default Channel Order in General Settings.

@status current Introduced in 2.0.0

hashtag
Parameters

  • channel (number) channel number (0 means CH1)

hashtag
Return value

  • number Stick assigned to this channel (from 0 to 3)

getVersion()

Return OpenTX version

@status current Introduced in 2.0.0, expanded in 2.1.7, radio type strings changed in 2.2.0, os name added in EdgeTX 2.4.0

hashtag
Example

This example also runs in OpenTX versions where the function returned only one value:

Output of the above script in simulator:

defaultChannel(stick)

Get channel assigned to stick. See Default Channel Order in General Settings

@status current Introduced in 2.0.0

hashtag
Parameters

  • stick

(number) stick number (from 0 to 3)

hashtag
Return value

  • number channel assigned to this stick (from 0 to 3)

  • nil stick not found

System

hashtag
Parameters

none

hashtag
Return value

  • string OpenTX version (ie "2.1.5")

  • multiple values (available since 2.1.7):

    • (string) OpenTX version (ie "2.1.5")

    • (string) radio type: x12s, x10, x9e, x9d+, x9d or x7.

      If running in simulator the "-simu" is added

    • (number) major version (ie 2 if version 2.1.5)

    • (number) minor version (ie 1 if version 2.1.5)

    • (number) revision number (ie 5 if version 2.1.5)

      Since EdgeTX 2.4.0, sixth value added

    • (string) OS name (i.e. EdgeTX or nil if OpenTX)

local function run(event)
  local ver, radio, maj, minor, rev, osname = getVersion()
  print("version: "..ver)
  if radio then print ("radio: "..radio) end
  if maj then print ("maj: "..maj) end
  if minor then print ("minor: "..minor) end
  if rev then print ("rev: "..rev) end
  if osname then print ("osname: "..osname) end
  return 1
end

return {  run=run }
version: 2.4.0
radio: tx16s-simu
maj: 2
minor: 4
rev: 0
osname: EdgeTX

getGeneralSettings()

Returns (some of) the general radio settings

@status current Introduced in 2.0.6, imperial added in TODO, language and voice added in 2.2.0, gtimer added in 2.2.2.

hashtag
Parameters

none

hashtag
Return value

  • table with elements:

    • battWarn (number) radio battery range - warning value

    • battMin

screenshot()

Takes a screenshot, which is saved to the SCREENSHOTS folder on the radio SD card.

hashtag
Syntax

hashtag

(number) radio battery range - minimum value
  • battMax (number) radio battery range - maximum value

  • imperial (number) set to a value different from 0 if the radio is set to the

    IMPERIAL units

  • language (string) radio language (used for menus)

  • voice (string) voice language (used for speech)

  • gtimer (number) radio global timer in seconds (does not include current session)

  • screenshot()

    hashtag
    Returns

    • None

    hashtag
    Notes

    This command is currently not rate limited, so repeated frequent calls will slow down the UI and can even freeze the entire radio, so should be used with care.

    hashtag
    Available on

    hashtag
    API status

    EdgeTX version
    Action

    2.11.0

    Introduced

    hashtag
    Examples

    hashtag
    Related topics

    • Drawing flag

    • Color constants

    -- Take a screenshot
    screenshot()