Skip to content

Latest commit

 

History

History
80 lines (49 loc) · 3.2 KB

telemetry-scripts.md

File metadata and controls

80 lines (49 loc) · 3.2 KB

Telemetry Scripts

Purpose

Although they are named "Telemetry scripts" in fact they can be used to perform constant task while running in background. Telemetry scripts are mostly used for building customized screens that are avalilable to user directly from main screen using key shortcut. Each model can have up to three active scripts as configured on the model's Telemetry configuration page. The same script can be assigned to multiple models.

{% hint style="warning" %} Telemetry scripts are only available on radios with B&W LCD screens, such as e.g. FrSky Taranis models (including Xlite), Radiomaster TX12, Zorro, Boxer or Jumper T12.
Read more about <radios>. {% endhint %}

Execution & Lifetime

Telemetry script is loaded and executed when model is selected.

Script executes until:

  • it misbehaves (e.g. run-time error or low memory)
  • One-time Script is running. When One-time script finishes execution, Wigdet Script resumes execution.

File Location

Telemetry scripts are located on the SD card in the folder /SCRIPTS/TELEMETRY/.

{% hint style="warning" %} Telemetry script file name length (without extension) must be 6 characters or less {% endhint %}

Interface

Every Telemetry script must include a return statement at the end, defining its interface to EdgeTX.
This statement returns a table with the following fields:

FieldTypeRequiredDesctiption
runfunctiontrueFunction is called periodicaly when when telemetry screen is visible.

Parameters

ParameterDecription
event
number
Used to indicates which radio key has been pressed (see Key Events)

Return values
none

FieldTypeRequiredDesctiption
initfunctionfalseThis function is called once when script is executed

Parameters
none

Return Values
none

FieldTypeRequiredDesctiption
backgroundfunctionfalseThis function is called periodically, both when the telemetry screen is visible and when it is not

Parameters
none

Return Values
none

Examples

local function my_init()
  -- init is called once when model is loaded
end

local function my_background()
  -- background is called periodically
end

local function my_run(event)
  -- run is called periodically only when screen is visible
end

return { run = my_run, background = my_background, init = my_init }