From 55bd42fe72385e28da6dd574952fdacb8feadc9c Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 27 Jul 2021 17:36:09 +0100 Subject: [PATCH] Prepare to add DU switching --- Models/FlightDeck/a320.flightdeck.xml | 144 ++++++++++++++++++ .../Lower-ECAM/Lower-ECAM-base.nas | 1 + Models/Instruments/ND/canvas/ND.nas | 58 +++---- Models/Instruments/Upper-ECAM/Upper-ECAM.xml | 16 ++ .../Instruments/Upper-ECAM/res/Upper-ECAM.ac | 34 ++++- Nasal/ECAM/ECAM-main.nas | 7 +- Nasal/Libraries/property-tree-setup.nas | 4 + 7 files changed, 226 insertions(+), 38 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 0691d528..dfa728d1 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -2159,6 +2159,18 @@ nasal + + + + + systems/electrical/bus/dc-ess + 25 + + + nasal + + + @@ -2178,6 +2190,18 @@ nasal + + + + + systems/electrical/bus/dc-ess + 25 + + + nasal + + + @@ -2197,6 +2221,18 @@ nasal + + + + + systems/electrical/bus/dc-ess + 25 + + + nasal + + + @@ -2216,6 +2252,18 @@ nasal + + + + + systems/electrical/bus/dc-ess + 25 + + + nasal + + + @@ -2235,6 +2283,18 @@ nasal + + + + + systems/electrical/bus/dc-ess + 25 + + + nasal + + + @@ -2254,6 +2314,18 @@ nasal + + + + + systems/electrical/bus/dc-ess + 25 + + + nasal + + + @@ -2273,6 +2345,18 @@ nasal + + + + + systems/electrical/bus/dc-ess + 25 + + + nasal + + + @@ -2292,6 +2376,18 @@ nasal + + + + + systems/electrical/bus/dc-ess + 25 + + + nasal + + + @@ -2311,6 +2407,18 @@ nasal + + + + + systems/electrical/bus/dc-ess + 25 + + + nasal + + + @@ -2330,6 +2438,18 @@ nasal + + + + + systems/electrical/bus/dc-ess + 25 + + + nasal + + + @@ -2349,6 +2469,18 @@ nasal + + + + + systems/electrical/bus/dc-ess + 25 + + + nasal + + + @@ -2368,6 +2500,18 @@ nasal + + + + + systems/electrical/bus/dc-ess + 25 + + + nasal + + + diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-base.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-base.nas index fbde5c93..7534f0a8 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-base.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-base.nas @@ -17,6 +17,7 @@ var canvas_lowerECAM_base = "mipmapping": 1 }); me.canvas.addPlacement({"node": "lecam.screen"}); + me.canvas.addPlacement({"node": "uecam.screen2"}); me.font_mapper = func(family, weight) { return "LiberationFonts/LiberationSans-Regular.ttf"; diff --git a/Models/Instruments/ND/canvas/ND.nas b/Models/Instruments/ND/canvas/ND.nas index 098fc06d..72a1f2b3 100644 --- a/Models/Instruments/ND/canvas/ND.nas +++ b/Models/Instruments/ND/canvas/ND.nas @@ -14,22 +14,22 @@ var ND_2_test = nil; var elapsedtime = 0; # Fetch nodes: -var du1_test = props.globals.getNode("instrumentation/du/du1-test"); -var du1_test_time = props.globals.getNode("instrumentation/du/du1-test-time"); -var du1_test_amount = props.globals.getNode("instrumentation/du/du1-test-amount"); -var du2_test = props.globals.getNode("instrumentation/du/du2-test"); -var du2_test_time = props.globals.getNode("instrumentation/du/du2-test-time"); -var du2_test_amount = props.globals.getNode("instrumentation/du/du2-test-amount"); +var du1_test = props.globals.getNode("/instrumentation/du/du1-test"); +var du1_test_time = props.globals.getNode("/instrumentation/du/du1-test-time"); +var du1_test_amount = props.globals.getNode("/instrumentation/du/du1-test-amount"); +var du2_test = props.globals.getNode("/instrumentation/du/du2-test"); +var du2_test_time = props.globals.getNode("/instrumentation/du/du2-test-time"); +var du2_test_amount = props.globals.getNode("/instrumentation/du/du2-test-amount"); var du2_offtime = props.globals.initNode("/instrumentation/du/du2-off-time", 0.0, "DOUBLE"); -var du5_test = props.globals.getNode("instrumentation/du/du5-test"); -var du5_test_time = props.globals.getNode("instrumentation/du/du5-test-time"); +var du5_test = props.globals.getNode("/instrumentation/du/du5-test"); +var du5_test_time = props.globals.getNode("/instrumentation/du/du5-test-time"); var du5_offtime = props.globals.initNode("/instrumentation/du/du5-off-time", 0.0, "DOUBLE"); -var du5_test_amount = props.globals.getNode("instrumentation/du/du5-test-amount"); -var du6_test = props.globals.getNode("instrumentation/du/du6-test"); -var du6_test_time = props.globals.getNode("instrumentation/du/du6-test-time"); -var du6_test_amount = props.globals.getNode("instrumentation/du/du6-test-amount"); -var cpt_du_xfr = props.globals.getNode("modes/cpt-du-xfr"); -var fo_du_xfr = props.globals.getNode("modes/fo-du-xfr"); +var du5_test_amount = props.globals.getNode("/instrumentation/du/du5-test-amount"); +var du6_test = props.globals.getNode("/instrumentation/du/du6-test"); +var du6_test_time = props.globals.getNode("/instrumentation/du/du6-test-time"); +var du6_test_amount = props.globals.getNode("/instrumentation/du/du6-test-amount"); +var cpt_du_xfr = props.globals.getNode("/modes/cpt-du-xfr"); +var fo_du_xfr = props.globals.getNode("/modes/fo-du-xfr"); var wow0 = props.globals.getNode("gear/gear[0]/wow"); var nd_display = {}; @@ -204,7 +204,7 @@ var canvas_ND_1 = { m.init(canvas_group); # here we make the ND: - me.NDCpt = ND.new("instrumentation/efis", myCockpit_switches, "Airbus"); + me.NDCpt = ND.new("/instrumentation/efis", myCockpit_switches, "Airbus"); me.NDCpt.attitude_heading_setting = -1; me.NDCpt.adirs_property = props.globals.getNode("/instrumentation/efis[0]/nd/ir-1",1); me.NDCpt.newMFD(canvas_group); @@ -229,7 +229,7 @@ var canvas_ND_2 = { # here we make the ND: myCockpit_switches["ADIRS"]= {path: "/nd/ir-2", value: 0, type: "BOOL"}; - me.NDFo = ND.new("instrumentation/efis[1]", myCockpit_switches, "Airbus"); + me.NDFo = ND.new("/instrumentation/efis[1]", myCockpit_switches, "Airbus"); me.NDFo.attitude_heading_setting = 1; me.NDFo.adirs_property = props.globals.getNode("/instrumentation/efis[1]/nd/ir-2",1); me.NDFo.newMFD(canvas_group); @@ -275,11 +275,11 @@ var canvas_ND_1_test = { }, update: func() { elapsedtime = getprop("sim/time/elapsed-sec") or 0; - if ((du2_test_time.getValue() + 1 >= elapsedtime) and getprop("modes/cpt-du-xfr") != 1) { + if ((du2_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 1) { me["Test_white"].show(); me["Test_text"].hide(); - } else if ((du1_test_time.getValue() + 1 >= elapsedtime) and getprop("modes/cpt-du-xfr") != 0) { - print(getprop("modes/cpt-du-xfr")); + } else if ((du1_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 0) { + print(getprop("/modes/cpt-du-xfr")); me["Test_white"].show(); me["Test_text"].hide(); } else { @@ -317,10 +317,10 @@ var canvas_ND_2_test = { }, update: func() { elapsedtime = getprop("sim/time/elapsed-sec") or 0; - if ((du5_test_time.getValue() + 1 >= elapsedtime) and getprop("modes/cpt-du-xfr") != 1) { + if ((du5_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 1) { me["Test_white"].show(); me["Test_text"].hide(); - } else if ((du6_test_time.getValue() + 1 >= elapsedtime) and getprop("modes/cpt-du-xfr") != 0) { + } else if ((du6_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 0) { me["Test_white"].show(); me["Test_text"].hide(); } else { @@ -331,8 +331,8 @@ var canvas_ND_2_test = { }; setlistener("/sim/signals/fdm-initialized", func { - setprop("instrumentation/efis[0]/inputs/plan-wpt-index", -1); - setprop("instrumentation/efis[1]/inputs/plan-wpt-index", -1); + setprop("/instrumentation/efis[0]/inputs/plan-wpt-index", -1); + setprop("/instrumentation/efis[1]/inputs/plan-wpt-index", -1); nd_display.main = canvas.new({ "name": "ND1", @@ -430,7 +430,7 @@ for (i = 0; i < 2; i = i + 1 ) { var idx = par.getIndex(); var canvas_mode = "/instrumentation/efis["~idx~"]/nd/canvas-display-mode"; var nd_centered = "/instrumentation/efis["~idx~"]/inputs/nd-centered"; - var mode = getprop("instrumentation/efis["~idx~"]/nd/display-mode"); + var mode = getprop("/instrumentation/efis["~idx~"]/nd/display-mode"); var cvs_mode = "NAV"; var centered = 1; if (mode == "ILS") { @@ -463,7 +463,7 @@ var startChangePhase = func(nd,txt) { } #setlistener("/instrumentation/efis[0]/nd/terrain-on-nd", func{ -# var terr_on_hd = getprop("instrumentation/efis[0]/nd/terrain-on-nd"); +# var terr_on_hd = getprop("/instrumentation/efis[0]/nd/terrain-on-nd"); # var alpha = 1; # if (terr_on_hd) { # alpha = 0.5; @@ -473,10 +473,10 @@ var startChangePhase = func(nd,txt) { setlistener("/flight-management/control/capture-leg", func(n) { var capture_leg = n.getValue(); - setprop("instrumentation/efis[0]/nd/xtrk-error", capture_leg); - setprop("instrumentation/efis[1]/nd/xtrk-error", capture_leg); - setprop("instrumentation/efis[0]/nd/trk-line", capture_leg); - setprop("instrumentation/efis[1]/nd/trk-line", capture_leg); + setprop("/instrumentation/efis[0]/nd/xtrk-error", capture_leg); + setprop("/instrumentation/efis[1]/nd/xtrk-error", capture_leg); + setprop("/instrumentation/efis[0]/nd/trk-line", capture_leg); + setprop("/instrumentation/efis[1]/nd/trk-line", capture_leg); }, 0, 0); var showNd = func(nd = nil) { diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.xml b/Models/Instruments/Upper-ECAM/Upper-ECAM.xml index d2faf06f..0a64cb6e 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.xml +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.xml @@ -19,6 +19,22 @@ + + select + uecam.screen + + modes/ecam-du-xfr + + + + + select + uecam.screen2 + + modes/ecam-du-xfr + + + material uecam.screen diff --git a/Models/Instruments/Upper-ECAM/res/Upper-ECAM.ac b/Models/Instruments/Upper-ECAM/res/Upper-ECAM.ac index c0fba7cc..f63fb259 100644 --- a/Models/Instruments/Upper-ECAM/res/Upper-ECAM.ac +++ b/Models/Instruments/Upper-ECAM/res/Upper-ECAM.ac @@ -1,26 +1,44 @@ AC3Db -MATERIAL "buttonlights.001" rgb 1.000 1.000 1.000 amb 1.000 1.000 1.000 emis 1.000 1.000 1.000 spec 0.000 0.000 0.000 shi 0 trans 0.000 +MATERIAL "buttonlights.001" rgb 1 1 1 amb 1 1 1 emis 1 1 1 spec 0 0 0 shi 0 trans 0 OBJECT world -name "Blender_exporter_v2.26__Upper-ECAM.ac" -kids 1 +kids 2 OBJECT poly name "uecam.screen" data 21 uecam.screen.mesh.008 -crease 30.0 texture "screen.png" -texrep 1 1 +crease 30.000000 +numvert 4 +-0.58049 0.30536 0.06855 +-0.53427 0.14966 0.06855 +-0.53427 0.14966 -0.09384 +-0.58049 0.30536 -0.09384 +numsurf 1 +SURF 0x0 +mat 0 +refs 4 +3 1.00067 0.999407 +0 4.5e-005 0.999407 +1 4.5e-005 0.000756 +2 1.00067 0.000756 +kids 0 +OBJECT poly +name "uecam.screen2" +data 21 +uecam.screen.mesh.008 +texture "screen.png" +crease 30.000000 numvert 4 -0.58049 0.30536 -0.09384 -0.53427 0.14966 -0.09384 -0.53427 0.14966 0.06855 -0.58049 0.30536 0.06855 numsurf 1 -SURF 0X0 +SURF 0x0 mat 0 refs 4 0 1.00067 0.999407 -3 0.000045 0.999407 -2 0.000045 0.000756 +3 4.5e-005 0.999407 +2 4.5e-005 0.000756 1 1.00067 0.000756 kids 0 diff --git a/Nasal/ECAM/ECAM-main.nas b/Nasal/ECAM/ECAM-main.nas index b1b619fe..49ee52ac 100644 --- a/Nasal/ECAM/ECAM-main.nas +++ b/Nasal/ECAM/ECAM-main.nas @@ -133,7 +133,12 @@ var ECAM = { var ECAMControlPanel = { sysPageBtn: func(page) { - SystemDisplayController.manCall(page); + if (page == "REL") { + pts.Modes.EcamDuXfr.setBoolValue(0); + } else { + pts.Modes.EcamDuXfr.setBoolValue(1); + SystemDisplayController.manCall(page); + } }, rclBtn: func() { ecam.ECAM_controller.recall(); diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 7280d194..73ee448e 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -212,6 +212,10 @@ var Instrumentation = { }, }; +var Modes = { + EcamDuXfr: props.globals.getNode("/modes/ecam-du-xfr"), +}; + var Options = { eng: props.globals.getNode("/options/eng"), };