diff --git a/sdcard/c480x272/WIDGETS/SoarETX/1/brkcrv.lua b/sdcard/c480x272/WIDGETS/SoarETX/1/brkcrv.lua index 138a9a9e..4ddbbe04 100644 --- a/sdcard/c480x272/WIDGETS/SoarETX/1/brkcrv.lua +++ b/sdcard/c480x272/WIDGETS/SoarETX/1/brkcrv.lua @@ -59,23 +59,16 @@ local function stepOff() end end --- Work around the stupid fact that getCurve and setCurve tables are incompatible... +-- Make sure that we have the right number of points on the curve local function GetCurve(crvIndex) - local oldTbl = model.getCurve(crvIndex) + local tbl = model.getCurve(crvIndex) - if #oldTbl.y ~= N - 1 then + if #tbl.y ~= N then stepOff() error("Wrong number of points on curve CV" .. crvIndex + 1) end - local newTbl = { } - newTbl.y = { } - for p = 1, N do - newTbl.y[p] = oldTbl.y[p - 1] - end - newTbl.smooth = 1 - newTbl.name = oldTbl.name - return newTbl + return tbl end -- GetCurve() local function init() diff --git a/sdcard/c480x272/WIDGETS/SoarETX/1/wing2.lua b/sdcard/c480x272/WIDGETS/SoarETX/1/wing2.lua index d0ffa834..0780e7ff 100644 --- a/sdcard/c480x272/WIDGETS/SoarETX/1/wing2.lua +++ b/sdcard/c480x272/WIDGETS/SoarETX/1/wing2.lua @@ -64,23 +64,16 @@ local lftYs = { } local rgtYs = { } local activeP -- The point currently being edited --- Work around the stupid fact that getCurve and setCurve tables are incompatible... +-- Make sure that we have the right number of points on the curve local function GetCurve(crvIndex) - local oldTbl = model.getCurve(crvIndex) + local tbl = model.getCurve(crvIndex) - if #oldTbl.y ~= N - 1 then + if #tbl.y ~= N then setStickySwitch(LS_STEP, false) error("Wrong number of points on curve CV" .. crvIndex + 1) end - local newTbl = { } - newTbl.y = { } - for p = 1, N do - newTbl.y[p] = oldTbl.y[p - 1] - end - newTbl.smooth = 1 - newTbl.name = oldTbl.name - return newTbl + return tbl end -- GetCurve() -- Find the output where the specified curve index is being used diff --git a/sdcard/c480x272/WIDGETS/SoarETX/1/wing4.lua b/sdcard/c480x272/WIDGETS/SoarETX/1/wing4.lua index ae5afb58..540a52ad 100644 --- a/sdcard/c480x272/WIDGETS/SoarETX/1/wing4.lua +++ b/sdcard/c480x272/WIDGETS/SoarETX/1/wing4.lua @@ -77,23 +77,16 @@ local function stepOff() end end --- Work around the stupid fact that getCurve and setCurve tables are incompatible... +-- Make sure that we have the right number of points on the curve local function GetCurve(crvIndex) - local oldTbl = model.getCurve(crvIndex) + local tbl = model.getCurve(crvIndex) - if #oldTbl.y ~= N - 1 then + if #tbl.y ~= N then stepOff() error("Wrong number of points on curve CV" .. crvIndex + 1) end - local newTbl = { } - newTbl.y = { } - for p = 1, N do - newTbl.y[p] = oldTbl.y[p - 1] - end - newTbl.smooth = 1 - newTbl.name = oldTbl.name - return newTbl + return tbl end -- GetCurve() -- Find the output where the specified curve index is being used diff --git a/sdcard/c480x272/WIDGETS/SoarETX/main.lua b/sdcard/c480x272/WIDGETS/SoarETX/main.lua index f1006570..af920d7e 100644 --- a/sdcard/c480x272/WIDGETS/SoarETX/main.lua +++ b/sdcard/c480x272/WIDGETS/SoarETX/main.lua @@ -89,13 +89,6 @@ local function init() if not parameterCurve then error("Curve #32 is missing! It is used to store persistent model parameters for Lua.") end - - -- Work around the stupid fact that getCurve and setCurve tables are incompatible... - local y = parameterCurve.y - parameterCurve.y = { } - for i = 1, parameterCurve.points do - parameterCurve.y[i] = y[i - 1] - end function soarGlobals.getParameter(idx) return parameterCurve.y[idx] diff --git a/sdcard/c480x320/WIDGETS/SoarETX/1/wing2.lua b/sdcard/c480x320/WIDGETS/SoarETX/1/wing2.lua index cae39641..9efb734a 100644 --- a/sdcard/c480x320/WIDGETS/SoarETX/1/wing2.lua +++ b/sdcard/c480x320/WIDGETS/SoarETX/1/wing2.lua @@ -62,23 +62,16 @@ local lftYs = { } local rgtYs = { } local activeP -- The point currently being edited --- Work around the stupid fact that getCurve and setCurve tables are incompatible... +-- Make sure that we have the right number of points on the curve local function GetCurve(crvIndex) - local oldTbl = model.getCurve(crvIndex) - - if #oldTbl.y ~= N - 1 then + local tbl = model.getCurve(crvIndex) + + if #tbl.y ~= N then setStickySwitch(LS_STEP, false) error("Wrong number of points on curve CV" .. crvIndex + 1) end - - local newTbl = { } - newTbl.y = { } - for p = 1, N do - newTbl.y[p] = oldTbl.y[p - 1] - end - newTbl.smooth = 1 - newTbl.name = oldTbl.name - return newTbl + + return tbl end -- GetCurve() -- Find the output where the specified curve index is being used diff --git a/sdcard/c480x320/WIDGETS/SoarETX/main.lua b/sdcard/c480x320/WIDGETS/SoarETX/main.lua index 462b75c2..0db15de1 100644 --- a/sdcard/c480x320/WIDGETS/SoarETX/main.lua +++ b/sdcard/c480x320/WIDGETS/SoarETX/main.lua @@ -50,13 +50,6 @@ local function init() error("Curve #32 is missing! It is used to store persistent model parameters for Lua.") end - -- Work around the stupid fact that getCurve and setCurve tables are incompatible... - local y = parameterCurve.y - parameterCurve.y = { } - for i = 1, parameterCurve.points do - parameterCurve.y[i] = y[i - 1] - end - function soarGlobals.getParameter(idx) return parameterCurve.y[idx] end