betaflight-tx-lua-scripts icon indicating copy to clipboard operation
betaflight-tx-lua-scripts copied to clipboard

Try to add new Page

Open druckgott opened this issue 2 years ago • 0 comments

I used newest version and try to add my own page for OSD. What I did: I generate a new Page:

local template = assert(loadScript(radio.template))()
local margin = template.margin
local indent = template.indent
local lineSpacing = template.lineSpacing
local tableSpacing = template.tableSpacing
local sp = template.listSpacing.field
local yMinLim = radio.yMinLimit
local x = margin
local y = yMinLim - lineSpacing
local inc = { x = function(val) x = x + val return x end, y = function(val) y = y + val return y end }
local labels = {}
local fields = {}

if apiVersion >= 1.041 then
	fields[#fields + 1] = { t = "vcd_video_system",     x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 2, vals = { 2 }, table = { [0] = "AUTO", "PAL", "NTSC" } }
	fields[#fields + 1] = { t = "osd_units",        	x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 2, vals = { 3 }, table = { [0] = "IMPERIAL", "METRIC", "BRITISH" } }
	fields[#fields + 1] = { t = "rssi_alarm",        	x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 100, vals = { 4 } }
end

return {
    read        = 84, -- MSP_OSD_CONFIG
    write       = 85, -- MSP_SET_OSD_CONFIG
    title       = "OSD Test",
    reboot      = false,
    eepromWrite = true,
    minBytes    = 3,
    labels      = labels,
    fields      = fields,
}

Add this to the page Menü. If I call the page I get all 3 fields with the right Information. But If I save this page It didn´t update the value on the Flightcontroller.

So I can read the things, but cant Update it. Can anybody give me an advice what I´m doing wrong or how I have to change it to get It updated also.

BR druckgott

druckgott avatar Sep 17 '22 11:09 druckgott