Awesome
opentx-lua-widgets
Telemetry screen grid-system for OpenTX
slim, auto-scaling, nestable, open
Create your personal telemetry screens with ease:
*graph-widget integrates from opentx-lua-running-graphs
Download
Please go to the releases page to download the latest files.
Test environment
- OpenTX v2.3.2 on FrSky Taranis Q X7
- OpenTX Companion v2.3.2 (all FrSky Taranis platforms, Jumper T12)
File structure
-
TELEMETRY/
telemetry screen examples -
WIDGETS/
widgets for X7/X9 displays, see script head for details on eachX9/
widgets for X9 displays onlywidgets.lua
main script
API
Screen layout
The layout
table:
Name | Type | Description |
---|---|---|
column | table | - |
cell | table | - |
cell.id | string (optional, default empty zone) | path/widget name without extension, id="" draws a rectangle |
cell.opts | table (optional) | pass configuration options to widget |
cell.opts.parent | bool (optional, default false ) | set true to load a nested grid |
local layout = {
{ -- column A
{id=""} -- cell A1
},
{ -- column B
{id=""} -- cell B1
},
{ -- column C
{id=""}, -- cell C1
{id=""} -- cell C2
}
}
SCRIPTS/TELEMETRY/lynix.lua
-- X9 layout based on https://github.com/lynix/opentx-telemetry
local layout = {
{ -- column A
{id="X9/tx-batt"} -- cell A1
},
{ -- column B
{id="X9/mode"}, -- cell B1
{id="X9/gps"}, -- cell B2
{id="X9/timer"} -- cell B3
},
{ -- column C
{id="X9/distance"}, -- cell C1
{id="X9/altitude"}, -- cell C2
{id="X9/speed"} -- cell C3
},
{ -- column D
{id="X9/rssi"} -- cell D1
},
}
Options
Widgets have different options depending on how they're designed. Look at the head description of the widget scripts for further details (like value.lua). Use tmpl.lua to create new widgets from scratch.
Some common parameters are:
Name | Type | Description |
---|---|---|
opts.src | function or sensor-ID string/number | Data source |
opts.lbl | string (optional) | Label text at top |
opts.m | table (optional, defaults depend) | Cell margin in px [t=top, r=right, b=bottom, l=left] |
Currently options are not implemented in X9 widgets.
Nesting
SCRIPTS/TELEMETRY/wdgts2.lua
[...]
{ id="../TELEMETRY/wdgts2_sub", opts={parent=1} },
[...]
To create a nested grid, set opts.parent
to a true
value in the parent layout ...
SCRIPTS/TELEMETRY/wdgts2_sub.lua
[...]
local w = assert(loadScript("/SCRIPTS/WIDGETS/widgets.lua"))(layout, 1)
[...]
... and the second parameter of the main script call to a true
value inside the encapsulated layout.
Try to use margin instead of nesting where possible to preserve memory.
Installing
Unzip the files from the release package and drag the contents to your radio. If you do this correctly, the SCRIPTS
directory will merge with your existing directories, placing the scripts in their appropriate paths.
The src
directory is not required for use and is only available for maintenance of the code. However, the use of the src
directory may work because the current OpenTX compiles its LUAC files at runtime.
How to copy to the Transmitter:
A) Bootloader Method
- Power off your transmitter and power it back on in boot loader mode.
- Connect a USB cable and open the SD card drive on your computer.
- Unzip the file and copy the scripts to the root of the SD card.
- Unplug the USB cable and power cycle your transmitter.
B) Manual method (varies, based on the model of your transmitter)
- Power off your transmitter.
- Remove the SD card and plug it into a computer
- Unzip the file and copy the scripts to the root of the SD card.
- Reinsert your SD card into the transmitter
- Power up your transmitter.
Go to the telemetry screen setup page and select telemetry pages.
Setup
Setting up the script as a telemetry page will enable access at the press of a button (on X7/X9 platforms).
- Hit the [MENU] button and select the model for which you would like to enable the script.
- While on the
MODEL SELECTION
screen, long-press the [PAGE] button to navigate to theDISPLAY
page. - Move the cursor to a free screen and hit [ENT].
- Select the
Script
option and press [ENT]. - Move the cursor to the script selection field
---
and hit [ENT]. - Select one of the listed telemetry scripts and hit [ENT].
- Long-press [EXIT] to return to your model screen.
To invoke the script, simply long-press the [PAGE] button from the model screen.
Memory warning
If you just copied the files, launched the script and a not enough memory
warning appears at some point, probably restarting the radio is the only thing to do here. If OpenTX is still complaining, try reboot the system several times.
Building from source
- Be sure to have
LUA 5.2
andNode.js
installed - Run
npm install
from the root folder to install node modules - Run
npm start
,make
or./bin/build.sh min
from the root folder with appropriate privileges (omit themin
switch to build without minifying) - Compiled/minified files will be created at the
obj
folder. Copy the files to your transmitter.
Resources
This Project is inspired from olimetry.lua by Ollicious (bowdown@gmx.net)