Skip to content

Latest commit

 

History

History
76 lines (50 loc) · 3.11 KB

File metadata and controls

76 lines (50 loc) · 3.11 KB

model.getInfo

Gets currently selected Model's information

Syntax

model.getInfo()

Parameters

none

Return values

table containing model information with following fields:

FieldTypeDecription
namestringModel's name set.
filenamestringName of <???>
bitmapstringName of model's picture file located on SD Card in /IMAGES/ folder
extendedLimitsbooleantrue if extended limits are enabled otherwise false
jitterFilternumbermodel level ADC filter

{% hint style="warning" %} bitmap field is not available on BW radios {% endhint %}

API Status

AvailStatusComment
BW radiostrueactive
Color radiostrueactive

Change log

EdgeTX versionChange
2.4.0Introduced
2.6.0added filename to return value table.
2.8.0added extendedLimits , jitterFilter, labels to return value table.

Examples

Displaying model's name

local modelInfo -- declare variable available to all functions 

local function my_init() {
    modelInfo = model.getInfo() -- read model's info table
}

local function my_run(event) {
    lcd.clear()
    lcd.drawText(0, 0, modelInfo.name) -- display model's name
    return 0
}

return { run = my_run, init = my_init }

Displaying model's all information

local modelInfo -- declare variable available to all functions 
local lineHeight = 8 -- for color radios change to 16

local function my_init() {
    modelInfo = model.getInfo() -- read model's info table
}

local function my_run(event) {
    lcd.clear()
    local y = 0
    for fieldName, fieldValue in pairs(modelInfo) do
        lcd.drawText( 0, y, fieldName .. ": " .. tostring(fieldValue) ) -- display model's name
        y = y + lineHeight
    end
    return 0
}

return { run = my_run, init = my_init }