Help with updating a curve point at run time with Lua script

openTx has introduced a range of new features, ideas and bling. It is fast becoming the firmware of choice for many users. openTx will run on ALL current hardware platforms, including the gruvin9x and sky9x boards. Work has already started to support the new FrSky X9D radio!
Post Reply
jctpro
Posts: 3
Joined: Tue Dec 20, 2016 5:01 pm
Country: -

Help with updating a curve point at run time with Lua script

Post by jctpro »

I would like to change a point on a curve using a lua script triggered by a trim switch. I am not sure on the syntax to do this. I started with:

local FM
local FMname
local createRes

local function init_func()
end

local function run_func()

FM, FMname = getFlightMode()
local curveVal = model.getCurve(31)
curveVal.y[1] = curveVal.y[1] + 1
createRes = model.setCurve(31, curveVal)
end
end

return { run=run_func, init=init_func }



The setCurve function fails. It seems to be around the way I update the Y value in the curve. Any help?

Post Reply

Return to “openTx”