Lua mixes setup fixes

This commit is contained in:
bsongis
2014-05-28 22:44:41 +02:00
parent 483e36e646
commit 8c43ec47af
3 changed files with 51 additions and 41 deletions
+23 -19
View File
@@ -123,18 +123,10 @@ end
-- Init function
local function init()
for stick = 0, 3, 1 do
local index = channelOrder(stick);
if index == 0 then
rudCH1 = stick
elseif index == 1 then
eleCH1 = stick
elseif index == 2 then
engineCH1 = stick
else
aileronsCH1 = stick
end
end
rudCH1 = defaultChannel(0)
eleCH1 = defaultChannel(1)
engineCH1 = defaultChannel(2)
aileronsCH1 = defaultChannel(3)
end
-- Engine Menu
@@ -176,7 +168,7 @@ end
local function applyEngineSettings()
if engineMode == 0 then
mix = {source=channelOrder(2)}
local mix = { source=1+defaultChannel(2) }
model.insertMix(engineCH1, 0, mix)
end
end
@@ -228,6 +220,17 @@ local function aileronsMenu(event)
end
end
local function applyAileronsSettings()
if aileronsMode ~= 1 then
local mix = { source=1+defaultChannel(3) }
model.insertMix(aileronsCH1, 0, mix)
if aileronsMode == 2 then
mix = { source=1+defaultChannel(3), weight=-100 }
model.insertMix(aileronsCH2, 0, mix)
end
end
end
-- Flaps Menu
local flapsModeItems = {"No", "Yes...", "Yes, 2 channels..."}
local function drawFlapsMenu()
@@ -429,12 +432,6 @@ local function servoMenu(event)
end
-- Confirmation Menu
local function applySettings()
model.defaultInputs()
model.deleteMixes()
applyEngineSettings()
end
local function nextLine(x, y)
y = y + 8
if y > 50 then
@@ -513,6 +510,13 @@ local function drawConfirmationMenu()
fieldsMax = 0
end
local function applySettings()
model.defaultInputs()
model.deleteMixes()
applyEngineSettings()
applyAileronsSettings()
end
local function confirmationMenu(event)
if dirty then
dirty = false