Fix ROT encoder nav for wizards (#4105)

This commit is contained in:
3djc
2016-12-08 20:41:50 +01:00
committed by Bertrand Songis
parent 0c255572ec
commit 3f4502d970
4 changed files with 51 additions and 51 deletions
+16 -16
View File
@@ -36,10 +36,10 @@ end
local function fieldIncDec(event, value, max, force) local function fieldIncDec(event, value, max, force)
if edit or force==true then if edit or force==true then
if event == EVT_PLUS_BREAK then if event == EVT_PLUS_BREAK or event == EVT_ROT_LEFT then
value = (value + max) value = (value + max)
dirty = true dirty = true
elseif event == EVT_MINUS_BREAK then elseif event == EVT_MINUS_BREAK or event == EVT_ROT_RIGHT then
value = (value + max + 2) value = (value + max + 2)
dirty = true dirty = true
end end
@@ -50,12 +50,12 @@ end
local function valueIncDec(event, value, min, max) local function valueIncDec(event, value, min, max)
if edit then if edit then
if event == EVT_PLUS_FIRST or event == EVT_PLUS_REPT then if event == EVT_PLUS_FIRST or event == EVT_PLUS_REPT or event == EVT_ROT_RIGHT then
if value < max then if value < max then
value = (value + 1) value = (value + 1)
dirty = true dirty = true
end end
elseif event == EVT_MINUS_FIRST or event == EVT_MINUS_REPT then elseif event == EVT_MINUS_FIRST or event == EVT_MINUS_REPT or event == EVT_ROT_LEFT then
if value > min then if value > min then
value = (value - 1) value = (value - 1)
dirty = true dirty = true
@@ -72,12 +72,12 @@ local function navigate(event, fieldMax, prevPage, nextPage)
elseif edit then elseif edit then
if event == EVT_EXIT_BREAK then if event == EVT_EXIT_BREAK then
edit = false edit = false
dirty = true dirty = true
elseif not dirty then elseif not dirty then
dirty = blinkChanged() dirty = blinkChanged()
end end
else else
if event == EVT_PAGE_BREAK then if event == EVT_PAGE_BREAK then
page = nextPage page = nextPage
field = 0 field = 0
dirty = true dirty = true
@@ -127,7 +127,7 @@ local function drawEngineMenu()
lcd.clear() lcd.clear()
lcd.drawText(1, 0, "Has your model got an engine?", 0) lcd.drawText(1, 0, "Has your model got an engine?", 0)
lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE) lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE)
lcd.drawCombobox(0, 8, LCD_W/2, engineModeItems, engineMode, getFieldFlags(0)) lcd.drawCombobox(0, 8, LCD_W/2, engineModeItems, engineMode, getFieldFlags(0))
lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0) lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0)
if engineMode == 0 then if engineMode == 0 then
-- No engine -- No engine
@@ -164,8 +164,8 @@ local function drawElevonsMenu()
lcd.clear() lcd.clear()
lcd.drawText(1, 0, "Select elevon channnels", 0) lcd.drawText(1, 0, "Select elevon channnels", 0)
lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE) lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE)
lcd.drawCombobox(0, 8, LCD_W/2, elevonsModeItems, elevonsMode, 0) lcd.drawCombobox(0, 8, LCD_W/2, elevonsModeItems, elevonsMode, 0)
lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0) lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0)
lcd.drawPixmap(110, 9, "elevons.bmp") lcd.drawPixmap(110, 9, "elevons.bmp")
lcd.drawText(20, LCD_H-16, "Assign channels", 0); lcd.drawText(20, LCD_H-16, "Assign channels", 0);
lcd.drawText(LCD_W/2-19, LCD_H-8, ">>>", 0); lcd.drawText(LCD_W/2-19, LCD_H-8, ">>>", 0);
@@ -196,7 +196,7 @@ local function drawRudderMenu()
lcd.clear() lcd.clear()
lcd.drawText(1, 0, "Has your model got a rudder?", 0) lcd.drawText(1, 0, "Has your model got a rudder?", 0)
lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE) lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE)
lcd.drawCombobox(0, 8, LCD_W/2, rudderModeItems, rudderMode, getFieldFlags(0)) lcd.drawCombobox(0, 8, LCD_W/2, rudderModeItems, rudderMode, getFieldFlags(0))
lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0) lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0)
if rudderMode == 0 then if rudderMode == 0 then
-- No rudder -- No rudder
@@ -217,7 +217,7 @@ local function rudderMenu(event)
dirty = false dirty = false
drawRudderMenu() drawRudderMenu()
end end
navigate(event, fieldsMax, page-1, page+1) navigate(event, fieldsMax, page-1, page+1)
if field==0 then if field==0 then
@@ -244,7 +244,7 @@ local function drawServoMenu(limits)
else else
lcd.drawText(129, 50, "\127", getFieldFlags(3)); lcd.drawText(129, 50, "\127", getFieldFlags(3));
end end
fieldsMax = 3 fieldsMax = 3
end end
local function servoMenu(event) local function servoMenu(event)
@@ -280,7 +280,7 @@ local function addMix(channel, input, name, weight, index)
if weight ~= nil then if weight ~= nil then
mix.weight = weight mix.weight = weight
end end
if index == nil then if index == nil then
index = 0 index = 0
end end
model.insertMix(channel, index, mix) model.insertMix(channel, index, mix)
@@ -288,7 +288,7 @@ end
local function applySettings() local function applySettings()
model.defaultInputs() model.defaultInputs()
model.deleteMixes() model.deleteMixes()
if engineMode == 1 then if engineMode == 1 then
addMix(thrCH1, MIXSRC_FIRST_INPUT+defaultChannel(2), "Engine") addMix(thrCH1, MIXSRC_FIRST_INPUT+defaultChannel(2), "Engine")
end end
@@ -340,7 +340,7 @@ local function confirmationMenu(event)
end end
navigate(event, fieldsMax, RUDDER_PAGE, page) navigate(event, fieldsMax, RUDDER_PAGE, page)
if event == EVT_EXIT_BREAK then if event == EVT_EXIT_BREAK then
return 2 return 2
elseif event == EVT_ENTER_LONG then elseif event == EVT_ENTER_LONG then
@@ -359,7 +359,7 @@ local function run(event)
error("Cannot be run as a model script!") error("Cannot be run as a model script!")
end end
if servoPage ~= nil then if servoPage ~= nil then
servoMenu(event) servoMenu(event)
elseif page == ENGINE_PAGE then elseif page == ENGINE_PAGE then
engineMenu(event) engineMenu(event)
elseif page == ELEVONS_PAGE then elseif page == ELEVONS_PAGE then
+12 -12
View File
@@ -34,10 +34,10 @@ end
local function fieldIncDec(event, value, max, force) local function fieldIncDec(event, value, max, force)
if edit or force==true then if edit or force==true then
if event == EVT_PLUS_BREAK then if event == EVT_PLUS_BREAK or event == EVT_ROT_LEFT then
value = (value + max) value = (value + max)
dirty = true dirty = true
elseif event == EVT_MINUS_BREAK then elseif event == EVT_MINUS_BREAK or event == EVT_ROT_RIGHT then
value = (value + max + 2) value = (value + max + 2)
dirty = true dirty = true
end end
@@ -48,12 +48,12 @@ end
local function valueIncDec(event, value, min, max) local function valueIncDec(event, value, min, max)
if edit then if edit then
if event == EVT_PLUS_FIRST or event == EVT_PLUS_REPT then if event == EVT_PLUS_FIRST or event == EVT_PLUS_REPT or event == EVT_ROT_RIGHT then
if value < max then if value < max then
value = (value + 1) value = (value + 1)
dirty = true dirty = true
end end
elseif event == EVT_MINUS_FIRST or event == EVT_MINUS_REPT then elseif event == EVT_MINUS_FIRST or event == EVT_MINUS_REPT or event == EVT_ROT_LEFT then
if value > min then if value > min then
value = (value - 1) value = (value - 1)
dirty = true dirty = true
@@ -70,12 +70,12 @@ local function navigate(event, fieldMax, prevPage, nextPage)
elseif edit then elseif edit then
if event == EVT_EXIT_BREAK then if event == EVT_EXIT_BREAK then
edit = false edit = false
dirty = true dirty = true
elseif not dirty then elseif not dirty then
dirty = blinkChanged() dirty = blinkChanged()
end end
else else
if event == EVT_PAGE_BREAK then if event == EVT_PAGE_BREAK then
page = nextPage page = nextPage
field = 0 field = 0
dirty = true dirty = true
@@ -124,7 +124,7 @@ local function drawThrottleMenu()
lcd.clear() lcd.clear()
lcd.drawText(1, 0, "Select multicopter throttle channel", 0) lcd.drawText(1, 0, "Select multicopter throttle channel", 0)
lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE) lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE)
lcd.drawCombobox(0, 8, LCD_W/2, {"..."}, comboBoxMode, getFieldFlags(1)) lcd.drawCombobox(0, 8, LCD_W/2, {"..."}, comboBoxMode, getFieldFlags(1))
lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0) lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0)
lcd.drawPixmap(120, 8, "multi-thr.bmp") lcd.drawPixmap(120, 8, "multi-thr.bmp")
lcd.drawText(20, LCD_H-16, "Assign Throttle", 0); lcd.drawText(20, LCD_H-16, "Assign Throttle", 0);
@@ -148,7 +148,7 @@ local function drawRollMenu()
lcd.clear() lcd.clear()
lcd.drawText(1, 0, "Select multicopter roll channel", 0) lcd.drawText(1, 0, "Select multicopter roll channel", 0)
lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE) lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE)
lcd.drawCombobox(0, 8, LCD_W/2, {"..."}, comboBoxMode, getFieldFlags(1)) lcd.drawCombobox(0, 8, LCD_W/2, {"..."}, comboBoxMode, getFieldFlags(1))
lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0) lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0)
lcd.drawPixmap(120, 8, "multi-roll.bmp") lcd.drawPixmap(120, 8, "multi-roll.bmp")
lcd.drawText(20, LCD_H-16, "Assign Roll", 0); lcd.drawText(20, LCD_H-16, "Assign Roll", 0);
@@ -172,7 +172,7 @@ local function drawPitchMenu()
lcd.clear() lcd.clear()
lcd.drawText(1, 0, "Select multicopter pitch channel", 0) lcd.drawText(1, 0, "Select multicopter pitch channel", 0)
lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE) lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE)
lcd.drawCombobox(0, 8, LCD_W/2, {"..."}, comboBoxMode, getFieldFlags(1)) lcd.drawCombobox(0, 8, LCD_W/2, {"..."}, comboBoxMode, getFieldFlags(1))
lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0) lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0)
lcd.drawPixmap(120, 8, "multi-pitch.bmp") lcd.drawPixmap(120, 8, "multi-pitch.bmp")
lcd.drawText(20, LCD_H-16, "Assign Pitch", 0); lcd.drawText(20, LCD_H-16, "Assign Pitch", 0);
@@ -196,7 +196,7 @@ local function drawYawMenu()
lcd.clear() lcd.clear()
lcd.drawText(1, 0, "Select multicopter yaw channel", 0) lcd.drawText(1, 0, "Select multicopter yaw channel", 0)
lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE) lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE)
lcd.drawCombobox(0, 8, LCD_W/2, {"..."}, comboBoxMode, getFieldFlags(1)) lcd.drawCombobox(0, 8, LCD_W/2, {"..."}, comboBoxMode, getFieldFlags(1))
lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0) lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0)
lcd.drawPixmap(120, 8, "multi-yaw.bmp") lcd.drawPixmap(120, 8, "multi-yaw.bmp")
lcd.drawText(20, LCD_H-16, "Assign Yaw", 0); lcd.drawText(20, LCD_H-16, "Assign Yaw", 0);
@@ -249,7 +249,7 @@ local function addMix(channel, input, name, weight, index)
if weight ~= nil then if weight ~= nil then
mix.weight = weight mix.weight = weight
end end
if index == nil then if index == nil then
index = 0 index = 0
end end
model.insertMix(channel, index, mix) model.insertMix(channel, index, mix)
@@ -257,7 +257,7 @@ end
local function applySettings() local function applySettings()
model.defaultInputs() model.defaultInputs()
model.deleteMixes() model.deleteMixes()
addMix(thrCH1, MIXSRC_FIRST_INPUT+defaultChannel(2), "Throttle") addMix(thrCH1, MIXSRC_FIRST_INPUT+defaultChannel(2), "Throttle")
addMix(rollCH1, MIXSRC_FIRST_INPUT+defaultChannel(3), "Roll") addMix(rollCH1, MIXSRC_FIRST_INPUT+defaultChannel(3), "Roll")
addMix(yawCH1, MIXSRC_FIRST_INPUT+defaultChannel(0), "Yaw") addMix(yawCH1, MIXSRC_FIRST_INPUT+defaultChannel(0), "Yaw")
+18 -18
View File
@@ -46,10 +46,10 @@ end
local function fieldIncDec(event, value, max, force) local function fieldIncDec(event, value, max, force)
if edit or force==true then if edit or force==true then
if event == EVT_PLUS_BREAK then if event == EVT_PLUS_BREAK or event == EVT_ROT_LEFT then
value = (value + max) value = (value + max)
dirty = true dirty = true
elseif event == EVT_MINUS_BREAK then elseif event == EVT_MINUS_BREAK or event == EVT_ROT_RIGHT then
value = (value + max + 2) value = (value + max + 2)
dirty = true dirty = true
end end
@@ -60,12 +60,12 @@ end
local function valueIncDec(event, value, min, max) local function valueIncDec(event, value, min, max)
if edit then if edit then
if event == EVT_PLUS_FIRST or event == EVT_PLUS_REPT then if event == EVT_PLUS_FIRST or event == EVT_PLUS_REPT or event == EVT_ROT_RIGHT then
if value < max then if value < max then
value = (value + 1) value = (value + 1)
dirty = true dirty = true
end end
elseif event == EVT_MINUS_FIRST or event == EVT_MINUS_REPT then elseif event == EVT_MINUS_FIRST or event == EVT_MINUS_REPT or event == EVT_ROT_LEFT then
if value > min then if value > min then
value = (value - 1) value = (value - 1)
dirty = true dirty = true
@@ -82,12 +82,12 @@ local function navigate(event, fieldMax, prevPage, nextPage)
elseif edit then elseif edit then
if event == EVT_EXIT_BREAK then if event == EVT_EXIT_BREAK then
edit = false edit = false
dirty = true dirty = true
elseif not dirty then elseif not dirty then
dirty = blinkChanged() dirty = blinkChanged()
end end
else else
if event == EVT_PAGE_BREAK then if event == EVT_PAGE_BREAK then
page = nextPage page = nextPage
field = 0 field = 0
dirty = true dirty = true
@@ -137,7 +137,7 @@ local function drawEngineMenu()
lcd.clear() lcd.clear()
lcd.drawText(1, 0, "Has your model got an engine?", 0) lcd.drawText(1, 0, "Has your model got an engine?", 0)
lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE) lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE)
lcd.drawCombobox(0, 8, LCD_W/2, engineModeItems, engineMode, getFieldFlags(0)) lcd.drawCombobox(0, 8, LCD_W/2, engineModeItems, engineMode, getFieldFlags(0))
lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0) lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0)
if engineMode == 1 then if engineMode == 1 then
-- 1 channel -- 1 channel
@@ -174,7 +174,7 @@ local function drawAileronsMenu()
lcd.clear() lcd.clear()
lcd.drawText(1, 0, "Has your model got ailerons?", 0) lcd.drawText(1, 0, "Has your model got ailerons?", 0)
lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE) lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE)
lcd.drawCombobox(0, 8, LCD_W/2, aileronsModeItems, aileronsMode, getFieldFlags(0)) lcd.drawCombobox(0, 8, LCD_W/2, aileronsModeItems, aileronsMode, getFieldFlags(0))
lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0) lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0)
if aileronsMode == 2 then if aileronsMode == 2 then
-- 2 channels -- 2 channels
@@ -221,7 +221,7 @@ local function drawFlapsMenu()
lcd.clear() lcd.clear()
lcd.drawText(1, 0, "Has your model got flaps?", 0) lcd.drawText(1, 0, "Has your model got flaps?", 0)
lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE) lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE)
lcd.drawCombobox(0, 8, LCD_W/2, flapsModeItems, flapsMode, getFieldFlags(0)) lcd.drawCombobox(0, 8, LCD_W/2, flapsModeItems, flapsMode, getFieldFlags(0))
lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0) lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0)
if flapsMode == 0 then if flapsMode == 0 then
-- no flaps -- no flaps
@@ -268,7 +268,7 @@ local function drawBrakesMenu()
lcd.clear() lcd.clear()
lcd.drawText(1, 0, "Has your model got air brakes?", 0) lcd.drawText(1, 0, "Has your model got air brakes?", 0)
lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE) lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE)
lcd.drawCombobox(0, 8, LCD_W/2, brakesModeItems, brakesMode, getFieldFlags(0)) lcd.drawCombobox(0, 8, LCD_W/2, brakesModeItems, brakesMode, getFieldFlags(0))
lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0) lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0)
if brakesMode == 0 then if brakesMode == 0 then
-- no brakes -- no brakes
@@ -306,7 +306,7 @@ local function brakesMenu(event)
brakesCH1 = channelIncDec(event, brakesCH1) brakesCH1 = channelIncDec(event, brakesCH1)
elseif field==2 then elseif field==2 then
brakesCH2 = channelIncDec(event, brakesCH2) brakesCH2 = channelIncDec(event, brakesCH2)
end end
end end
-- Tail Menu -- Tail Menu
@@ -315,7 +315,7 @@ local function drawTailMenu()
lcd.clear() lcd.clear()
lcd.drawText(1, 0, "Which is the tail config on your model?", 0) lcd.drawText(1, 0, "Which is the tail config on your model?", 0)
lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE) lcd.drawFilledRectangle(0, 0, LCD_W, 8, GREY_DEFAULT+FILL_WHITE)
lcd.drawCombobox(0, 8, LCD_W/2, tailModeItems, tailMode, getFieldFlags(0)) lcd.drawCombobox(0, 8, LCD_W/2, tailModeItems, tailMode, getFieldFlags(0))
lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0) lcd.drawLine(LCD_W/2-1, 18, LCD_W/2-1, LCD_H-1, DOTTED, 0)
lcd.drawText(LCD_W/2-19, LCD_H-8, ">>>", 0); lcd.drawText(LCD_W/2-19, LCD_H-8, ">>>", 0);
if tailMode == 0 then if tailMode == 0 then
@@ -365,7 +365,7 @@ local function tailMenu(event)
rudCH1 = channelIncDec(event, rudCH1) rudCH1 = channelIncDec(event, rudCH1)
elseif field==2 then elseif field==2 then
eleCH2 = channelIncDec(event, eleCH2) eleCH2 = channelIncDec(event, eleCH2)
end end
end end
-- Servo (limits) Menu -- Servo (limits) Menu
@@ -385,7 +385,7 @@ local function drawServoMenu(limits)
else else
lcd.drawText(129, 50, "\127", getFieldFlags(3)); lcd.drawText(129, 50, "\127", getFieldFlags(3));
end end
fieldsMax = 3 fieldsMax = 3
end end
local function servoMenu(event) local function servoMenu(event)
@@ -462,7 +462,7 @@ local function drawConfirmationMenu()
if tailMode == 2 then if tailMode == 2 then
x, y = drawNextLine(x, y, "Elevator:", eleCH2) x, y = drawNextLine(x, y, "Elevator:", eleCH2)
end end
drawNextLine(x, y, "Rudder:", rudCH1) drawNextLine(x, y, "Rudder:", rudCH1)
end end
lcd.drawText(48, LCD_H-8, "[Enter Long] to confirm", 0); lcd.drawText(48, LCD_H-8, "[Enter Long] to confirm", 0);
lcd.drawFilledRectangle(0, LCD_H-9, LCD_W, 9, 0) lcd.drawFilledRectangle(0, LCD_H-9, LCD_W, 9, 0)
@@ -476,7 +476,7 @@ local function addMix(channel, input, name, weight, index)
if weight ~= nil then if weight ~= nil then
mix.weight = weight mix.weight = weight
end end
if index == nil then if index == nil then
index = 0 index = 0
end end
model.insertMix(channel, index, mix) model.insertMix(channel, index, mix)
@@ -484,7 +484,7 @@ end
local function applySettings() local function applySettings()
model.defaultInputs() model.defaultInputs()
model.deleteMixes() model.deleteMixes()
if engineMode > 0 then if engineMode > 0 then
addMix(thrCH1, MIXSRC_FIRST_INPUT+defaultChannel(2), "Engine") addMix(thrCH1, MIXSRC_FIRST_INPUT+defaultChannel(2), "Engine")
end end
@@ -547,7 +547,7 @@ local function run(event)
error("Cannot be run as a model script!") error("Cannot be run as a model script!")
end end
if servoPage ~= nil then if servoPage ~= nil then
servoMenu(event) servoMenu(event)
elseif page == ENGINE_PAGE then elseif page == ENGINE_PAGE then
engineMenu(event) engineMenu(event)
elseif page == AILERONS_PAGE then elseif page == AILERONS_PAGE then
@@ -10,10 +10,10 @@ local MODELTYPE_QUAD = 3
-- Common functions -- Common functions
local function fieldIncDec(event, value, max) local function fieldIncDec(event, value, max)
if event == EVT_PLUS_BREAK then if event == EVT_PLUS_BREAK or event == EVT_ROT_LEFT then
value = (value + max) value = (value + max)
dirty = true dirty = true
elseif event == EVT_MINUS_BREAK then elseif event == EVT_MINUS_BREAK or event == EVT_ROT_RIGHT then
value = (value + max + 2) value = (value + max + 2)
dirty = true dirty = true
end end
@@ -64,12 +64,12 @@ local function run(event)
if event == nil then if event == nil then
error("Cannot be run as a model script!") error("Cannot be run as a model script!")
end end
if event == EVT_EXIT_BREAK then if event == EVT_EXIT_BREAK then
return 2 return 2
end end
return modelTypeMenu(event) return modelTypeMenu(event)
end end
return { run=run } return { run=run }