Skip to content

Support for user selected Frsky sensors

Alessandro Apostoli edited this page Feb 1, 2023 · 5 revisions

Version 1.8.0 and above adds support for up to 6 user selected frsky sensors to be displayed on screen.

Note: These sensors must first be discovered in the OpenTX telemetry page.

Color LCD radios

User selected sensor values are displayed on an horizontal row, or as a right panel. sensors are numbered from left to right 1 to 6, from top to bottom 1 to 3. Horizontal sensor bar is automatically displayed if a sensor configuration file is found in the /WIDGETS/yaapu/cfg folder whereas the right panel must be enabled fromthe config menu.

Example of a sensor configuration file for the kerojet engine sensors.

image

image

Sensors are defined in a lua file in the \SCRIPTS\YAAPU\CFG folder.

BW LCD Radios

User selected sensor values are displayed on an extra screen reachable by pressing [ENTER] from the status message history.

In the following screenshot the widget is showing FLVSS cells data.

X9Dsensors_display

X7sensors_display

Sensors are defined in a lua file in the \MODELS\yaapu\ folder.

Sensors file name and syntax

The script looks for a file with the same name of the configuration file but ending in _sensors.lua. If the config file is modelname.cfg the lua file has to named modelname_sensors.lua. On color lcd radios a second sensor configuration file is used for the right panel (when enabled), name of the file should be modelname_right_sensors.lua where modelname is the name of your model just like the .cfg file.

File syntax is quite easy

----------------------------------------
-- custom sensors configuration file
----------------------------------------
local sensors = {
  -- Sensor 1
[1]=  {
    "Batt",   -- label
    "VFAS",     -- OpenTX sensor name
    2,          -- precision: number of decimals 0,1,2
    "V",         -- label for unit of measure
    1,          -- multiplier if < 1 than divides
    "+",        -- "+" track max values, "-" track min values with
    2,          -- font size 1=small, 2=big
    5,        -- warning level (nil is do not use feature)
    10,        -- critical level (nil is do not use feature)
  },

  -- Sensor 2
[2]=  {
    "Curr", -- label
    "CURR", -- OpenTX sensor name
    1,      -- precision: number of decimals 0,1,2
    "A",   -- label for unit of measure
    1,      -- multiplier if < 1 than divides
    "+",    -- "+" track max values, "-" track min values with
    2,      -- font size 1=small, 2=big
    100,     -- warning level
    200,     -- critical level
  },

  -- Sensor 3
[3]=  {
    "Fuel", -- label
    "Fuel", -- OpenTX sensor name
    0,      -- precision: number of decimals 0,1,2
    "%",    -- label for unit of measure
    1,      -- multiplier if < 1 than divides
    "-",    -- "+" track max values, "-" track min values
    1,      -- font size 1=small, 2=big
    50,     -- warning level
    25,     -- critical level
    true,   -- render as gauge
    60,     -- gauge width
    20,     -- gauge height
    0,      -- gauge min value
    100     -- gauge max value
  },
------------------------------------------------------
-- the script can optionally look up values here
-- for each sensor and display the corresponding text instead
-- as an example to associate a lookup table to sensor 3 declare it like
--
--local lookups = {
-- [3] = {
--     [-10] = "ERR",
--     [0] = "OK",
--     [10] = "CRIT",
--   }
-- }
-- this would display the sensor value except when the value corresponds to one
-- of entered above
-- 
local lookups = {
}

Chris Olson briefly explains this new feature in his video

Note For this feature to work it's necessary to enable the luac (lua compiler) on your OpenTX firmware settings, no more necessary on newer OpenTX/EdgeTX versions

luac

Clone this wiki locally