Telemetry Scripts
Telemetry Scripts
General description
Telemetry scripts are used for building customized screens. 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.
File Location
Scripts are located on the SD card in the folder /SCRIPTS/TELEMETRY/<name>.lua. File name length (without extension) must be 6 characters or less (this limit was 8 characters in OpenTX 2.1).
Lifetime of telemetry script
Telemetry scripts are started when the model is loaded.
script init function is called
script background function is periodically called when custom telemetry screen is not visible. Notice:
In OpenTX 2.0 this function is not called when the custom telemetry screen is visible.
Starting from OpenTX 2.1 this function is always called no matter if the custom screen is visible or not.
script run function is periodically called when custom telemetry screen is visible
script is stopped and disabled if it misbehaves (too long runtime, error in code, low memory)
all telemetry scripts are stopped while one-time script is running (see Lua One-time scripts)
Script interface definition
Every script must include a return statement at the end, that defines its interface to the rest of OpenTX code. This statement defines:
script init function (optional)
script background function
script run function
Example (interface only):
Notes:
init_func()
function is called once when script is loaded and begins execution.bg_func()
is called periodically, the screen visibility does not matter.
Last updated