From 8c43ec47af0f80ab466b8e9435af21ba9f48b8c0 Mon Sep 17 00:00:00 2001 From: bsongis Date: Wed, 28 May 2014 22:44:41 +0200 Subject: [PATCH] Lua mixes setup fixes --- radio/src/lua.cpp | 36 +++++++++++++++++++++++------------- radio/wizard/delta.lua | 14 +++++--------- radio/wizard/plane.lua | 42 +++++++++++++++++++++++------------------- 3 files changed, 51 insertions(+), 41 deletions(-) diff --git a/radio/src/lua.cpp b/radio/src/lua.cpp index d82a29c70..911176aef 100644 --- a/radio/src/lua.cpp +++ b/radio/src/lua.cpp @@ -550,12 +550,11 @@ static int getFirstMix(int chn) { for (int i=0; isrcRaw || mix->destCh>chn) break; - if (mix->destCh == chn) { + if (!mix->srcRaw || mix->destCh>=chn) { return i; } } - return -1; + return 0; } static int getMixesCountFromFirst(int chn, int first) @@ -574,9 +573,6 @@ static int getMixesCountFromFirst(int chn, int first) static int getMixesCount(int chn) { int first = getFirstMix(chn); - if (first < 0) { - return 0; - } return getMixesCountFromFirst(chn, first); } @@ -594,7 +590,7 @@ static int luaModelGetMix(lua_State *L) int idx = luaL_checkunsigned(L, 2); int first = getFirstMix(chn); int count = getMixesCountFromFirst(chn, first); - if (first>=0 && idxname); @@ -619,8 +615,7 @@ static int luaModelInsertMix(lua_State *L) int count = getMixesCountFromFirst(chn, first); if (chn 0) - idx += first; + idx += first; s_currCh = chn+1; insertExpoMix(0, idx); MixData *mix = mixAddress(idx); @@ -661,7 +656,7 @@ static int luaModelDeleteMix(lua_State *L) int first = getFirstMix(chn); int count = getMixesCountFromFirst(chn, first); - if (first>=0 && idx 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