From 88e8369dc6c710aa82a3e817a22878d8c6825655 Mon Sep 17 00:00:00 2001 From: Offer Shmuely Date: Fri, 16 Feb 2024 02:17:46 +0200 Subject: [PATCH] feat(wizard): wing wizard updates, arm switch fix (#133) --- sdcard/c480x272/TEMPLATES/1.Wizard/3.Wing.lua | 56 +++--- sdcard/c480x272/TEMPLATES/1.Wizard/3.Wing.yml | 159 ++---------------- 2 files changed, 46 insertions(+), 169 deletions(-) diff --git a/sdcard/c480x272/TEMPLATES/1.Wizard/3.Wing.lua b/sdcard/c480x272/TEMPLATES/1.Wizard/3.Wing.lua index 4862172a..871eedf3 100644 --- a/sdcard/c480x272/TEMPLATES/1.Wizard/3.Wing.lua +++ b/sdcard/c480x272/TEMPLATES/1.Wizard/3.Wing.lua @@ -17,10 +17,11 @@ -- Author: Offer Shmuely -- Date: 2023 --- version: 1.0 +-- version: 1.1 local VALUE = 0 local COMBO = 1 +local HEADER = 2 local is_edit = false local page = 1 @@ -41,10 +42,10 @@ local STICK_NUMBER_ELE = 1 local STICK_NUMBER_THR = 2 local STICK_NUMBER_RUD = 0 -local defaultChannel_AIL = defaultChannel(STICK_NUMBER_AIL)+1 -local defaultChannel_ELE = defaultChannel(STICK_NUMBER_ELE)+1 -local defaultChannel_THR = defaultChannel(STICK_NUMBER_THR)+1 -local defaultChannel_RUD = defaultChannel(STICK_NUMBER_RUD)+1 +local defaultChannel_AIL = defaultChannel(STICK_NUMBER_AIL) + 1 +local defaultChannel_ELE = defaultChannel(STICK_NUMBER_ELE) + 1 +local defaultChannel_THR = defaultChannel(STICK_NUMBER_THR) + 1 +local defaultChannel_RUD = defaultChannel(STICK_NUMBER_RUD) + 1 local defaultChannel_0_AIL = defaultChannel(STICK_NUMBER_AIL) local defaultChannel_0_ELE = defaultChannel(STICK_NUMBER_ELE) @@ -118,13 +119,13 @@ local function lcdSizeTextFixed(txt, font_size) elseif font_size == FONT_6 then v_offset = 0 end - return ts_w, ts_h, v_offset + return ts_w, ts_h +2*v_offset, v_offset end local function drawBadgedText(txt, field, font_size, is_selected, is_edit) local ts_w, ts_h, v_offset = lcdSizeTextFixed(txt, font_size) - ts_h = 10 + ts_h + v_offset * 2 - local r = ts_h / 2 + local bdg_h = 5 + ts_h + 5 + local r = bdg_h / 2 if (field.w > 0) then ts_w = field.w @@ -139,7 +140,7 @@ local function drawBadgedText(txt, field, font_size, is_selected, is_edit) end lcd.drawFilledCircle(field.x, field.y + r, r, bg_color) lcd.drawFilledCircle(field.x + ts_w, field.y + r, r, bg_color) - lcd.drawFilledRectangle(field.x, field.y, ts_w, ts_h, bg_color) + lcd.drawFilledRectangle(field.x, field.y, ts_w, bdg_h, bg_color) local attr = 0 if (is_selected and is_edit) then attr = attr + BLINK @@ -347,13 +348,6 @@ local function drawNextLine(text, chNum, text2) lineIndex = lineIndex + 20 end -local ConfigSummaryFields = { - ack= {id='ack', x=110, y=250, w=0, type=COMBO, is_visible=1, value=0, avail_values={ "No, I need to change something", "Yes, all is well, create the plane !" } }, -} -ConfigSummaryFields.page = { - ConfigSummaryFields.ack -} - local ImgSummary local function runConfigSummary(event) @@ -388,12 +382,21 @@ local function runConfigSummary(event) drawNextLine("Dual Rate", nil, ElevronFields.is_dual_rate.avail_values[1 + ElevronFields.is_dual_rate.value]) - local result = runFieldsPage(ConfigSummaryFields.page, event) - if (ConfigSummaryFields.ack.value == 1 and is_edit == false) then + lcd.drawFilledRectangle(60-10, 250-2, 240, 25, YELLOW) + lcd.drawText(60, 250, "Hold [Enter] to apply changes...", COLOR_THEME_PRIMARY1) + + if event == EVT_VIRTUAL_EXIT then + -- exit script + return 2 + end + + -- approve settings + if (event == EVT_VIRTUAL_ENTER_LONG) then selectPage(1) end - return result + + return 0 end local function addMix(channel, input, name, weight, index) @@ -442,25 +445,24 @@ local function createModel(event) local expoVal = ElevronFields.expo.value local is_dual_rate = (ElevronFields.is_dual_rate.value == 1) if (is_dual_rate) then - updateInputLine(defaultChannel_0_AIL, 0, expoVal, 100,"SC" .. CHAR_UP) - updateInputLine(defaultChannel_0_AIL, 1, expoVal, 75, "SC-") - updateInputLine(defaultChannel_0_AIL, 2, expoVal, 50, "SC" .. CHAR_DOWN) + updateInputLine(defaultChannel_0_AIL, 0, expoVal, 100, "SC" .. CHAR_UP) + updateInputLine(defaultChannel_0_AIL, 1, expoVal, 75 , "SC-") + updateInputLine(defaultChannel_0_AIL, 2, expoVal, 50 , "SC" .. CHAR_DOWN) - updateInputLine(defaultChannel_0_ELE, 0, expoVal, 100,"SC" .. CHAR_UP) - updateInputLine(defaultChannel_0_ELE, 1, expoVal, 75, "SC-") - updateInputLine(defaultChannel_0_ELE, 2, expoVal, 50, "SC" .. CHAR_DOWN) + updateInputLine(defaultChannel_0_ELE, 0, expoVal, 100, "SC" .. CHAR_UP) + updateInputLine(defaultChannel_0_ELE, 1, expoVal, 75 , "SC-") + updateInputLine(defaultChannel_0_ELE, 2, expoVal, 50 , "SC" .. CHAR_DOWN) else updateInputLine(defaultChannel_0_AIL, 0, expoVal, 100, nil) updateInputLine(defaultChannel_0_ELE, 0, expoVal, 100, nil) end - -- motor if (MotorFields.is_motor.value == 1) then addMix(MotorFields.motor_ch.value, MIXSRC_FIRST_INPUT + defaultChannel_0_THR, "Motor") end - -- Ailerons + -- ailerons addMix(ElevronFields.ail_ch_r.value, MIXSRC_FIRST_INPUT + defaultChannel(STICK_NUMBER_ELE), "ele-R", 50) addMix(ElevronFields.ail_ch_r.value, MIXSRC_FIRST_INPUT + defaultChannel(STICK_NUMBER_AIL), "ail-R", -50) addMix(ElevronFields.ail_ch_l.value, MIXSRC_FIRST_INPUT + defaultChannel(STICK_NUMBER_ELE), "ele-L", 50) diff --git a/sdcard/c480x272/TEMPLATES/1.Wizard/3.Wing.yml b/sdcard/c480x272/TEMPLATES/1.Wizard/3.Wing.yml index 2a959b08..2215250b 100644 --- a/sdcard/c480x272/TEMPLATES/1.Wizard/3.Wing.yml +++ b/sdcard/c480x272/TEMPLATES/1.Wizard/3.Wing.yml @@ -1,6 +1,6 @@ semver: 2.9.0 header: - name: "Wing" + name: "New Wing" bitmap: "wing.jpg" labels: "" timers: @@ -33,69 +33,14 @@ showInstanceIds: 0 customThrottleWarningPosition: 0 beepANACenter: 0 logicalSw: - 0: - func: FUNC_VNEG - def: "tele(0),365" - andsw: "NONE" - delay: 0 - duration: 0 -customFn: - 0: - swtch: "SF2" - func: OVERRIDE_CHANNEL - def: "2,-100,1" - 1: - swtch: "L1" - func: PLAY_VALUE - def: "tele(0),7" thrTraceSrc: Thr -switchWarningState: AuBuCuDuEuFuGuHu +switchWarningState: C-FdHu rssiSource: none -rfAlarms: - warning: 45 - critical: 42 thrTrimSw: 0 potsWarnMode: WARN_OFF jitterFilter: GLOBAL potsWarnEnabled: 0 -telemetrySensors: - 0: - id1: - id: 0 - id2: - formula: FORMULA_CELL - label: "cell" - subId: 0 - type: TYPE_CALCULATED - unit: 1 - prec: 2 - autoOffset: 0 - filter: 0 - logs: 0 - persistent: 0 - onlyPositive: 0 - cfg: - cell: - source: 6 - index: 0 - 5: - id1: - id: 768 - id2: - instance: 1 - label: "Cels" - subId: 0 - type: TYPE_CUSTOM - unit: 38 - prec: 2 - autoOffset: 0 - filter: 0 - logs: 1 - persistent: 0 - onlyPositive: 0 - cfg: - param: 0 -screenData: +screenData: 0: LayoutId: "Layout2P1" layoutData: @@ -131,13 +76,13 @@ screenData: 1: type: Signed value: - signedValue: 1 + signedValue: 2 2: type: Bool value: boolValue: 0 2: - widgetName: "BattCheck" + widgetName: "BattAnalog" widgetData: options: 0: @@ -153,91 +98,10 @@ screenData: value: boolValue: 0 3: - type: Bool - value: - boolValue: 1 - 4: type: Bool value: boolValue: 0 - options: - 0: - type: Bool - value: - boolValue: 1 - 1: - type: Bool - value: - boolValue: 0 - 2: - type: Bool - value: - boolValue: 0 - 3: - type: Bool - value: - boolValue: 1 - 4: - type: Bool - value: - boolValue: 0 - 1: - LayoutId: "Layout2P1" - layoutData: - zones: - 0: - widgetName: "ModelBmp" - widgetData: - options: - 0: - type: Color - value: - color: 0x000000 - 2: - type: Bool - value: - boolValue: 0 - 3: - type: Color - value: - color: 0x000000 4: - type: Bool - value: - boolValue: 1 - 1: - widgetName: "Timer2" - widgetData: - options: - 0: - type: Color - value: - color: 0xF8FC00 - 1: - type: Signed - value: - signedValue: 2 - 2: - type: Bool - value: - boolValue: 0 - 2: - widgetName: "BattAnalog" - widgetData: - options: - 0: - type: Source - value: - source: NONE - 1: - type: Color - value: - color: 0xF8FC00 - 2: - type: Bool - value: - boolValue: 0 - 3: type: Bool value: boolValue: 0 @@ -262,7 +126,7 @@ screenData: type: Bool value: boolValue: 0 - 2: + 1: LayoutId: "Layout1x1" layoutData: zones: @@ -347,3 +211,14 @@ topbarData: boolValue: 1 view: 0 +radioThemesDisabled: GLOBAL +radioGFDisabled: GLOBAL +radioTrainerDisabled: GLOBAL +modelHeliDisabled: OFF +modelFMDisabled: OFF +modelCurvesDisabled: GLOBAL +modelGVDisabled: OFF +modelLSDisabled: GLOBAL +modelSFDisabled: GLOBAL +modelCustomScriptsDisabled: OFF +modelTelemetryDisabled: GLOBAL