A3XX: Add DU Test
This commit is contained in:
parent
2862819eec
commit
074fe62767
17 changed files with 1039 additions and 687 deletions
|
@ -904,6 +904,8 @@
|
||||||
<std>0</std>
|
<std>0</std>
|
||||||
<oldqnh>29.92</oldqnh>
|
<oldqnh>29.92</oldqnh>
|
||||||
</altimeter>
|
</altimeter>
|
||||||
|
<cpt-du-xfr>0</cpt-du-xfr>
|
||||||
|
<fo-du-xfr>0</fo-du-xfr>
|
||||||
<pfd>
|
<pfd>
|
||||||
<ILS1>0</ILS1>
|
<ILS1>0</ILS1>
|
||||||
<ILS2>0</ILS2>
|
<ILS2>0</ILS2>
|
||||||
|
|
|
@ -169,6 +169,15 @@ var systemsReset = func {
|
||||||
libraries.variousReset();
|
libraries.variousReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var skipDUTest = func {
|
||||||
|
setprop("/instrumentation/du/du1-test-time", getprop("/instrumentation/du/du1-test-time") - 35);
|
||||||
|
setprop("/instrumentation/du/du2-test-time", getprop("/instrumentation/du/du2-test-time") - 35);
|
||||||
|
setprop("/instrumentation/du/du3-test-time", getprop("/instrumentation/du/du3-test-time") - 35);
|
||||||
|
setprop("/instrumentation/du/du4-test-time", getprop("/instrumentation/du/du4-test-time") - 35);
|
||||||
|
setprop("/instrumentation/du/du5-test-time", getprop("/instrumentation/du/du5-test-time") - 35);
|
||||||
|
setprop("/instrumentation/du/du6-test-time", getprop("/instrumentation/du/du6-test-time") - 35);
|
||||||
|
}
|
||||||
|
|
||||||
################
|
################
|
||||||
# Panel States #
|
# Panel States #
|
||||||
################
|
################
|
||||||
|
@ -290,6 +299,7 @@ var beforestart_b = func {
|
||||||
setprop("/controls/adirs/mcducbtn", 1);
|
setprop("/controls/adirs/mcducbtn", 1);
|
||||||
setprop("/controls/lighting/beacon", 1);
|
setprop("/controls/lighting/beacon", 1);
|
||||||
setprop("/controls/lighting/nav-lights-switch", 1);
|
setprop("/controls/lighting/nav-lights-switch", 1);
|
||||||
|
skipDUTest();
|
||||||
setprop("/controls/gear/brake-left", 0);
|
setprop("/controls/gear/brake-left", 0);
|
||||||
setprop("/controls/gear/brake-right", 0);
|
setprop("/controls/gear/brake-right", 0);
|
||||||
setprop("/systems/acconfig/autoconfig-running", 0);
|
setprop("/systems/acconfig/autoconfig-running", 0);
|
||||||
|
@ -366,6 +376,7 @@ var taxi_b = func {
|
||||||
setprop("/controls/adirs/mcducbtn", 1);
|
setprop("/controls/adirs/mcducbtn", 1);
|
||||||
setprop("/controls/lighting/beacon", 1);
|
setprop("/controls/lighting/beacon", 1);
|
||||||
setprop("/controls/lighting/nav-lights-switch", 1);
|
setprop("/controls/lighting/nav-lights-switch", 1);
|
||||||
|
skipDUTest();
|
||||||
settimer(taxi_c, 2);
|
settimer(taxi_c, 2);
|
||||||
}
|
}
|
||||||
var taxi_c = func {
|
var taxi_c = func {
|
||||||
|
|
75
Models/Instruments/Common/res/du-test.svg
Normal file
75
Models/Instruments/Common/res/du-test.svg
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="1024pt"
|
||||||
|
height="1024pt"
|
||||||
|
viewBox="0 0 1024 1024"
|
||||||
|
version="1.1"
|
||||||
|
id="svg2"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="du-test.svg">
|
||||||
|
<metadata
|
||||||
|
id="metadata375">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs373" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#000000"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="20"
|
||||||
|
gridtolerance="20"
|
||||||
|
guidetolerance="20"
|
||||||
|
inkscape:pageopacity="1"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1030"
|
||||||
|
id="namedview371"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:zoom="0.25"
|
||||||
|
inkscape:cx="1402.5446"
|
||||||
|
inkscape:cy="508.4561"
|
||||||
|
inkscape:window-x="1592"
|
||||||
|
inkscape:window-y="-8"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg2"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:snap-global="false"
|
||||||
|
inkscape:guide-bbox="true">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid5153" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:32px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
x="511.80469"
|
||||||
|
y="494.27536"
|
||||||
|
id="text4335"
|
||||||
|
sodipodi:linespacing="125%"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan4337"
|
||||||
|
x="511.80469"
|
||||||
|
y="494.27536"
|
||||||
|
style="font-size:50px;text-align:center;text-anchor:middle;fill:#0dc04b;fill-opacity:1">SELF TEST IN PROGRESS</tspan><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
x="511.80469"
|
||||||
|
y="556.77533"
|
||||||
|
id="tspan4339"
|
||||||
|
style="font-size:50px;text-align:center;text-anchor:middle;fill:#0dc04b;fill-opacity:1">(MAX 40 SECONDS)</tspan></text>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.4 KiB |
|
@ -10,6 +10,7 @@ var lowerECAM_eng = nil;
|
||||||
var lowerECAM_fctl = nil;
|
var lowerECAM_fctl = nil;
|
||||||
var lowerECAM_wheel = nil;
|
var lowerECAM_wheel = nil;
|
||||||
var lowerECAM_door = nil;
|
var lowerECAM_door = nil;
|
||||||
|
var lowerECAM_test = nil;
|
||||||
var lowerECAM_display = nil;
|
var lowerECAM_display = nil;
|
||||||
var page = "eng";
|
var page = "eng";
|
||||||
var oat = getprop("/environment/temperature-degc");
|
var oat = getprop("/environment/temperature-degc");
|
||||||
|
@ -27,7 +28,7 @@ var gearlvr = 0;
|
||||||
var askidsw = 0;
|
var askidsw = 0;
|
||||||
var brakemode = 0;
|
var brakemode = 0;
|
||||||
var accum = 0;
|
var accum = 0;
|
||||||
|
var elapsedtime = 0;
|
||||||
setprop("/systems/electrical/extra/apu-load", 0);
|
setprop("/systems/electrical/extra/apu-load", 0);
|
||||||
setprop("/systems/electrical/extra/apu-volts", 0);
|
setprop("/systems/electrical/extra/apu-volts", 0);
|
||||||
setprop("/systems/electrical/extra/apu-hz", 0);
|
setprop("/systems/electrical/extra/apu-hz", 0);
|
||||||
|
@ -62,6 +63,8 @@ setprop("/controls/flight/spoiler-r2-failed", 0);
|
||||||
setprop("/controls/flight/spoiler-r3-failed", 0);
|
setprop("/controls/flight/spoiler-r3-failed", 0);
|
||||||
setprop("/controls/flight/spoiler-r4-failed", 0);
|
setprop("/controls/flight/spoiler-r4-failed", 0);
|
||||||
setprop("/controls/flight/spoiler-r5-failed", 0);
|
setprop("/controls/flight/spoiler-r5-failed", 0);
|
||||||
|
setprop("/instrumentation/du/du4-test", 0);
|
||||||
|
setprop("/instrumentation/du/du4-test-time", 0);
|
||||||
|
|
||||||
var canvas_lowerECAM_base = {
|
var canvas_lowerECAM_base = {
|
||||||
init: func(canvas_group, file) {
|
init: func(canvas_group, file) {
|
||||||
|
@ -69,7 +72,7 @@ var canvas_lowerECAM_base = {
|
||||||
return "LiberationFonts/LiberationSans-Regular.ttf";
|
return "LiberationFonts/LiberationSans-Regular.ttf";
|
||||||
};
|
};
|
||||||
|
|
||||||
canvas.parsesvg(canvas_group, file, {'font-mapper': font_mapper});
|
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
|
||||||
|
|
||||||
var svg_keys = me.getKeys();
|
var svg_keys = me.getKeys();
|
||||||
foreach(var key; svg_keys) {
|
foreach(var key; svg_keys) {
|
||||||
|
@ -84,51 +87,72 @@ var canvas_lowerECAM_base = {
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
update: func() {
|
update: func() {
|
||||||
|
elapsedtime = getprop("/sim/time/elapsed-sec");
|
||||||
|
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/bus/ac2") >= 110) {
|
||||||
|
if (getprop("/instrumentation/du/du4-test") != 1) {
|
||||||
|
setprop("/instrumentation/du/du4-test", 1);
|
||||||
|
setprop("/instrumentation/du/du4-test-time", getprop("/sim/time/elapsed-sec"));
|
||||||
|
}
|
||||||
|
} else if (getprop("/systems/electrical/ac1-src") == "XX" or getprop("/systems/electrical/ac2-src") == "XX") {
|
||||||
|
setprop("/instrumentation/du/du4-test", 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du4") > 0) {
|
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du4") > 0) {
|
||||||
page = getprop("/ECAM/Lower/page");
|
if (getprop("/instrumentation/du/du4-test-time") + 40 >= elapsedtime) {
|
||||||
if (page == "apu") {
|
|
||||||
lowerECAM_apu.page.show();
|
|
||||||
lowerECAM_eng.page.hide();
|
|
||||||
lowerECAM_fctl.page.hide();
|
|
||||||
lowerECAM_wheel.page.hide();
|
|
||||||
lowerECAM_door.page.hide();
|
|
||||||
lowerECAM_apu.update();
|
|
||||||
} else if (page == "eng") {
|
|
||||||
lowerECAM_apu.page.hide();
|
|
||||||
lowerECAM_eng.page.show();
|
|
||||||
lowerECAM_fctl.page.hide();
|
|
||||||
lowerECAM_wheel.page.hide();
|
|
||||||
lowerECAM_door.page.hide();
|
|
||||||
lowerECAM_eng.update();
|
|
||||||
} else if (page == "fctl") {
|
|
||||||
lowerECAM_apu.page.hide();
|
|
||||||
lowerECAM_eng.page.hide();
|
|
||||||
lowerECAM_fctl.page.show();
|
|
||||||
lowerECAM_wheel.page.hide();
|
|
||||||
lowerECAM_door.page.hide();
|
|
||||||
lowerECAM_fctl.update();
|
|
||||||
} else if (page == "wheel") {
|
|
||||||
lowerECAM_apu.page.hide();
|
|
||||||
lowerECAM_eng.page.hide();
|
|
||||||
lowerECAM_fctl.page.hide();
|
|
||||||
lowerECAM_wheel.page.show();
|
|
||||||
lowerECAM_door.page.hide();
|
|
||||||
lowerECAM_wheel.update();
|
|
||||||
} else if (page == "door") {
|
|
||||||
lowerECAM_apu.page.hide();
|
lowerECAM_apu.page.hide();
|
||||||
lowerECAM_eng.page.hide();
|
lowerECAM_eng.page.hide();
|
||||||
lowerECAM_fctl.page.hide();
|
lowerECAM_fctl.page.hide();
|
||||||
lowerECAM_wheel.page.hide();
|
lowerECAM_wheel.page.hide();
|
||||||
lowerECAM_door.page.show();
|
lowerECAM_door.page.hide();
|
||||||
lowerECAM_door.update();
|
lowerECAM_test.page.show();
|
||||||
} else {
|
} else {
|
||||||
lowerECAM_apu.page.hide();
|
lowerECAM_test.page.hide();
|
||||||
lowerECAM_eng.page.hide();
|
page = getprop("/ECAM/Lower/page");
|
||||||
lowerECAM_fctl.page.hide();
|
if (page == "apu") {
|
||||||
lowerECAM_wheel.page.hide();
|
lowerECAM_apu.page.show();
|
||||||
lowerECAM_door.page.hide();
|
lowerECAM_eng.page.hide();
|
||||||
|
lowerECAM_fctl.page.hide();
|
||||||
|
lowerECAM_wheel.page.hide();
|
||||||
|
lowerECAM_door.page.hide();
|
||||||
|
lowerECAM_apu.update();
|
||||||
|
} else if (page == "eng") {
|
||||||
|
lowerECAM_apu.page.hide();
|
||||||
|
lowerECAM_eng.page.show();
|
||||||
|
lowerECAM_fctl.page.hide();
|
||||||
|
lowerECAM_wheel.page.hide();
|
||||||
|
lowerECAM_door.page.hide();
|
||||||
|
lowerECAM_eng.update();
|
||||||
|
} else if (page == "fctl") {
|
||||||
|
lowerECAM_apu.page.hide();
|
||||||
|
lowerECAM_eng.page.hide();
|
||||||
|
lowerECAM_fctl.page.show();
|
||||||
|
lowerECAM_wheel.page.hide();
|
||||||
|
lowerECAM_door.page.hide();
|
||||||
|
lowerECAM_fctl.update();
|
||||||
|
} else if (page == "wheel") {
|
||||||
|
lowerECAM_apu.page.hide();
|
||||||
|
lowerECAM_eng.page.hide();
|
||||||
|
lowerECAM_fctl.page.hide();
|
||||||
|
lowerECAM_wheel.page.show();
|
||||||
|
lowerECAM_door.page.hide();
|
||||||
|
lowerECAM_wheel.update();
|
||||||
|
} else if (page == "door") {
|
||||||
|
lowerECAM_apu.page.hide();
|
||||||
|
lowerECAM_eng.page.hide();
|
||||||
|
lowerECAM_fctl.page.hide();
|
||||||
|
lowerECAM_wheel.page.hide();
|
||||||
|
lowerECAM_door.page.show();
|
||||||
|
lowerECAM_door.update();
|
||||||
|
} else {
|
||||||
|
lowerECAM_apu.page.hide();
|
||||||
|
lowerECAM_eng.page.hide();
|
||||||
|
lowerECAM_fctl.page.hide();
|
||||||
|
lowerECAM_wheel.page.hide();
|
||||||
|
lowerECAM_door.page.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
lowerECAM_test.page.hide();
|
||||||
lowerECAM_apu.page.hide();
|
lowerECAM_apu.page.hide();
|
||||||
lowerECAM_eng.page.hide();
|
lowerECAM_eng.page.hide();
|
||||||
lowerECAM_fctl.page.hide();
|
lowerECAM_fctl.page.hide();
|
||||||
|
@ -1290,6 +1314,26 @@ var canvas_lowerECAM_wheel = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var canvas_lowerECAM_test = {
|
||||||
|
init: func(canvas_group, file) {
|
||||||
|
var font_mapper = func(family, weight) {
|
||||||
|
return "LiberationFonts/LiberationSans-Regular.ttf";
|
||||||
|
};
|
||||||
|
|
||||||
|
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
|
||||||
|
|
||||||
|
me.page = canvas_group;
|
||||||
|
|
||||||
|
return me;
|
||||||
|
},
|
||||||
|
new: func(canvas_group, file) {
|
||||||
|
var m = {parents: [canvas_lowerECAM_test]};
|
||||||
|
m.init(canvas_group, file);
|
||||||
|
|
||||||
|
return m;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
setlistener("sim/signals/fdm-initialized", func {
|
setlistener("sim/signals/fdm-initialized", func {
|
||||||
lowerECAM_display = canvas.new({
|
lowerECAM_display = canvas.new({
|
||||||
"name": "lowerECAM",
|
"name": "lowerECAM",
|
||||||
|
@ -1303,12 +1347,14 @@ setlistener("sim/signals/fdm-initialized", func {
|
||||||
var groupFctl = lowerECAM_display.createGroup();
|
var groupFctl = lowerECAM_display.createGroup();
|
||||||
var groupWheel = lowerECAM_display.createGroup();
|
var groupWheel = lowerECAM_display.createGroup();
|
||||||
var groupDoor = lowerECAM_display.createGroup();
|
var groupDoor = lowerECAM_display.createGroup();
|
||||||
|
var group_test = lowerECAM_display.createGroup();
|
||||||
|
|
||||||
lowerECAM_apu = canvas_lowerECAM_apu.new(groupApu, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/apu.svg");
|
lowerECAM_apu = canvas_lowerECAM_apu.new(groupApu, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/apu.svg");
|
||||||
lowerECAM_eng = canvas_lowerECAM_eng.new(groupEng, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/eng-eis2.svg");
|
lowerECAM_eng = canvas_lowerECAM_eng.new(groupEng, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/eng-eis2.svg");
|
||||||
lowerECAM_fctl = canvas_lowerECAM_fctl.new(groupFctl, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/fctl.svg");
|
lowerECAM_fctl = canvas_lowerECAM_fctl.new(groupFctl, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/fctl.svg");
|
||||||
lowerECAM_wheel = canvas_lowerECAM_wheel.new(groupWheel, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/wheel.svg");
|
lowerECAM_wheel = canvas_lowerECAM_wheel.new(groupWheel, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/wheel.svg");
|
||||||
lowerECAM_door = canvas_lowerECAM_door.new(groupDoor, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/door.svg");
|
lowerECAM_door = canvas_lowerECAM_door.new(groupDoor, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/door.svg");
|
||||||
|
lowerECAM_test = canvas_lowerECAM_test.new(group_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg");
|
||||||
|
|
||||||
lowerECAM_update.start();
|
lowerECAM_update.start();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
# A3XX ND Implementation
|
# A3XX ND Implementation
|
||||||
|
|
||||||
var get_local_path = func(file){
|
var get_local_path = func(file){
|
||||||
var aircraft_dir = split('/', getprop("/sim/aircraft-dir"))[-1];
|
var aircraft_dir = split("/", getprop("/sim/aircraft-dir"))[-1];
|
||||||
return "Aircraft/" ~ aircraft_dir ~ "/Models/Instruments/ND/canvas/"~ file;
|
return "Aircraft/" ~ aircraft_dir ~ "/Models/Instruments/ND/canvas/"~ file;
|
||||||
};
|
};
|
||||||
|
|
||||||
var version = getprop('sim/version/flightgear');
|
var version = getprop("sim/version/flightgear");
|
||||||
var v = split('.', version);
|
var v = split(".", version);
|
||||||
version = num(v[0]~'.'~v[1]);
|
version = num(v[0]~"."~v[1]);
|
||||||
|
|
||||||
var SymbolLayer = canvas.SymbolLayer;
|
var SymbolLayer = canvas.SymbolLayer;
|
||||||
var SingleSymbolLayer = canvas.SingleSymbolLayer;
|
var SingleSymbolLayer = canvas.SingleSymbolLayer;
|
||||||
|
@ -25,10 +25,10 @@ var SymbolCache32x32 = canvas.SymbolCache32x32;
|
||||||
var SymbolCache = canvas.SymbolCache;
|
var SymbolCache = canvas.SymbolCache;
|
||||||
var Text = canvas.Text;
|
var Text = canvas.Text;
|
||||||
|
|
||||||
io.include('ND_config.nas');
|
io.include("ND_config.nas");
|
||||||
io.include('framework/canvas.nas');
|
io.include("framework/canvas.nas");
|
||||||
io.include('framework/navdisplay.nas');
|
io.include("framework/navdisplay.nas");
|
||||||
io.include('framework/MapDrivers.nas');
|
io.include("framework/MapDrivers.nas");
|
||||||
io.include('loaders.nas');
|
io.include("loaders.nas");
|
||||||
io.include('helpers.nas');
|
io.include("helpers.nas");
|
||||||
io.include('style.nas');
|
io.include("style.nas");
|
||||||
|
|
|
@ -13,7 +13,7 @@ var A3XXRouteDriver = {
|
||||||
me.flightplan = flightplan();
|
me.flightplan = flightplan();
|
||||||
},
|
},
|
||||||
getNumberOfFlightPlans: func(){1},
|
getNumberOfFlightPlans: func(){1},
|
||||||
getFlightPlanType: func(fpNum){'current'},
|
getFlightPlanType: func(fpNum){"current"},
|
||||||
getFlightPlan: func(fpNum){me.flightplan},
|
getFlightPlan: func(fpNum){me.flightplan},
|
||||||
getPlanSize: func(fpNum){me.flightplan.getPlanSize()},
|
getPlanSize: func(fpNum){me.flightplan.getPlanSize()},
|
||||||
getWP: func(fpNum, idx){me.flightplan.getWP(idx)},
|
getWP: func(fpNum, idx){me.flightplan.getWP(idx)},
|
||||||
|
@ -55,16 +55,16 @@ var MultiA3XXRouteDriver = {
|
||||||
me._flightplans = subv_l ~ subv_r;
|
me._flightplans = subv_l ~ subv_r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
me.triggerSignal('fp-added');
|
me.triggerSignal("fp-added");
|
||||||
},
|
},
|
||||||
removeFlightPlanOfType: func(type){
|
removeFlightPlanOfType: func(type){
|
||||||
var new_vec = [];
|
var new_vec = [];
|
||||||
foreach(var fp; me._flightplans){
|
foreach(var fp; me._flightplans){
|
||||||
if(fp['type'] != type)
|
if(fp["type"] != type)
|
||||||
append(new_vec, fp);
|
append(new_vec, fp);
|
||||||
}
|
}
|
||||||
me._flightplans = new_vec;
|
me._flightplans = new_vec;
|
||||||
me.triggerSignal('fp-removed');
|
me.triggerSignal("fp-removed");
|
||||||
},
|
},
|
||||||
getNumberOfFlightPlans: func(){
|
getNumberOfFlightPlans: func(){
|
||||||
size(me._flightplans);
|
size(me._flightplans);
|
||||||
|
@ -96,10 +96,10 @@ var MultiA3XXRouteDriver = {
|
||||||
setprop(me.signalPath(signal));
|
setprop(me.signalPath(signal));
|
||||||
},
|
},
|
||||||
signalPath: func(signal){
|
signalPath: func(signal){
|
||||||
'autopilot/route-manager/signals/rd-'~ signal;
|
"autopilot/route-manager/signals/rd-"~ signal;
|
||||||
},
|
},
|
||||||
getListeners: func(){[
|
getListeners: func(){[
|
||||||
me.getSignal('fp-added'),
|
me.getSignal("fp-added"),
|
||||||
me.getSignal('fp-removed')
|
me.getSignal("fp-removed")
|
||||||
]}
|
]}
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,45 +5,52 @@
|
||||||
# Copyright (c) Joshua Davidson (it0uchpods) #
|
# Copyright (c) Joshua Davidson (it0uchpods) #
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
io.include('A3XX_ND.nas');
|
io.include("A3XX_ND.nas");
|
||||||
|
|
||||||
io.include('A3XX_ND_drivers.nas');
|
io.include("A3XX_ND_drivers.nas");
|
||||||
canvas.NDStyles['Airbus'].options.defaults.route_driver = A3XXRouteDriver.new();
|
canvas.NDStyles["Airbus"].options.defaults.route_driver = A3XXRouteDriver.new();
|
||||||
|
|
||||||
var nd_nd = nil;
|
var ND_1 = nil;
|
||||||
var nd_nd2 = nil;
|
var ND_2 = nil;
|
||||||
|
var ND_1_test = nil;
|
||||||
|
var ND_2_test = nil;
|
||||||
|
var elapsedtime = 0;
|
||||||
|
setprop("/instrumentation/du/du2-test", 0);
|
||||||
|
setprop("/instrumentation/du/du2-test-time", 0);
|
||||||
|
setprop("/instrumentation/du/du5-test", 0);
|
||||||
|
setprop("/instrumentation/du/du5-test-time", 0);
|
||||||
|
|
||||||
var nd_display = {};
|
var nd_display = {};
|
||||||
|
|
||||||
var ND = canvas.NavDisplay;
|
var ND = canvas.NavDisplay;
|
||||||
|
|
||||||
var myCockpit_switches = {
|
var myCockpit_switches = {
|
||||||
'toggle_range': {path: '/inputs/range-nm', value:40, type:'INT'},
|
"toggle_range": {path: "/inputs/range-nm", value:40, type:"INT"},
|
||||||
'toggle_weather': {path: '/inputs/wxr', value:0, type:'BOOL'},
|
"toggle_weather": {path: "/inputs/wxr", value:0, type:"BOOL"},
|
||||||
'toggle_airports': {path: '/inputs/arpt', value:0, type:'BOOL'},
|
"toggle_airports": {path: "/inputs/arpt", value:0, type:"BOOL"},
|
||||||
'toggle_ndb': {path: '/inputs/NDB', value:0, type:'BOOL'},
|
"toggle_ndb": {path: "/inputs/NDB", value:0, type:"BOOL"},
|
||||||
'toggle_stations': {path: '/inputs/sta', value:0, type:'BOOL'},
|
"toggle_stations": {path: "/inputs/sta", value:0, type:"BOOL"},
|
||||||
'toggle_vor': {path: '/inputs/VORD', value:0, type:'BOOL'},
|
"toggle_vor": {path: "/inputs/VORD", value:0, type:"BOOL"},
|
||||||
'toggle_dme': {path: '/inputs/DME', value:0, type:'BOOL'},
|
"toggle_dme": {path: "/inputs/DME", value:0, type:"BOOL"},
|
||||||
'toggle_cstr': {path: '/inputs/CSTR', value:0, type:'BOOL'},
|
"toggle_cstr": {path: "/inputs/CSTR", value:0, type:"BOOL"},
|
||||||
'toggle_waypoints': {path: '/inputs/wpt', value:0, type:'BOOL'},
|
"toggle_waypoints": {path: "/inputs/wpt", value:0, type:"BOOL"},
|
||||||
'toggle_position': {path: '/inputs/pos', value:0, type:'BOOL'},
|
"toggle_position": {path: "/inputs/pos", value:0, type:"BOOL"},
|
||||||
'toggle_data': {path: '/inputs/data',value:0, type:'BOOL'},
|
"toggle_data": {path: "/inputs/data",value:0, type:"BOOL"},
|
||||||
'toggle_terrain': {path: '/inputs/terr',value:0, type:'BOOL'},
|
"toggle_terrain": {path: "/inputs/terr",value:0, type:"BOOL"},
|
||||||
'toggle_traffic': {path: '/inputs/tfc',value:0, type:'BOOL'},
|
"toggle_traffic": {path: "/inputs/tfc",value:0, type:"BOOL"},
|
||||||
'toggle_centered': {path: '/inputs/nd-centered',value:0, type:'BOOL'},
|
"toggle_centered": {path: "/inputs/nd-centered",value:0, type:"BOOL"},
|
||||||
'toggle_lh_vor_adf': {path: '/input/lh-vor-adf',value:0, type:'INT'},
|
"toggle_lh_vor_adf": {path: "/input/lh-vor-adf",value:0, type:"INT"},
|
||||||
'toggle_rh_vor_adf': {path: '/input/rh-vor-adf',value:0, type:'INT'},
|
"toggle_rh_vor_adf": {path: "/input/rh-vor-adf",value:0, type:"INT"},
|
||||||
'toggle_display_mode': {path: '/nd/canvas-display-mode', value:'NAV', type:'STRING'},
|
"toggle_display_mode": {path: "/nd/canvas-display-mode", value:"NAV", type:"STRING"},
|
||||||
'toggle_display_type': {path: '/nd/display-type', value:'LCD', type:'STRING'},
|
"toggle_display_type": {path: "/nd/display-type", value:"LCD", type:"STRING"},
|
||||||
'toggle_true_north': {path: '/nd/true-north', value:0, type:'BOOL'},
|
"toggle_true_north": {path: "/nd/true-north", value:0, type:"BOOL"},
|
||||||
'toggle_track_heading': {path: '/trk-selected', value:0, type:'BOOL'},
|
"toggle_track_heading": {path: "/trk-selected", value:0, type:"BOOL"},
|
||||||
'toggle_wpt_idx': {path: '/inputs/plan-wpt-index', value: -1, type: 'INT'},
|
"toggle_wpt_idx": {path: "/inputs/plan-wpt-index", value: -1, type: "INT"},
|
||||||
'toggle_plan_loop': {path: '/nd/plan-mode-loop', value: 0, type: 'INT'},
|
"toggle_plan_loop": {path: "/nd/plan-mode-loop", value: 0, type: "INT"},
|
||||||
'toggle_weather_live': {path: '/nd/wxr-live-enabled', value: 0, type: 'BOOL'},
|
"toggle_weather_live": {path: "/nd/wxr-live-enabled", value: 0, type: "BOOL"},
|
||||||
'toggle_chrono': {path: '/inputs/CHRONO', value: 0, type: 'INT'},
|
"toggle_chrono": {path: "/inputs/CHRONO", value: 0, type: "INT"},
|
||||||
'toggle_xtrk_error': {path: '/nd/xtrk-error', value: 0, type: 'BOOL'},
|
"toggle_xtrk_error": {path: "/nd/xtrk-error", value: 0, type: "BOOL"},
|
||||||
'toggle_trk_line': {path: '/nd/trk-line', value: 0, type: 'BOOL'},
|
"toggle_trk_line": {path: "/nd/trk-line", value: 0, type: "BOOL"},
|
||||||
};
|
};
|
||||||
|
|
||||||
var canvas_nd_base = {
|
var canvas_nd_base = {
|
||||||
|
@ -53,7 +60,7 @@ var canvas_nd_base = {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (file != nil) {
|
if (file != nil) {
|
||||||
canvas.parsesvg(canvas_group, file, {'font-mapper': font_mapper});
|
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
|
||||||
|
|
||||||
var svg_keys = me.getKeys();
|
var svg_keys = me.getKeys();
|
||||||
foreach(var key; svg_keys) {
|
foreach(var key; svg_keys) {
|
||||||
|
@ -68,28 +75,63 @@ var canvas_nd_base = {
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
update: func() {
|
update: func() {
|
||||||
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du2") > 0) {
|
elapsedtime = getprop("/sim/time/elapsed-sec");
|
||||||
nd_nd.page.show();
|
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/bus/ac2") >= 110) {
|
||||||
nd_nd.NDCpt.update();
|
if (getprop("/instrumentation/du/du2-test") != 1) {
|
||||||
|
setprop("/instrumentation/du/du2-test", 1);
|
||||||
|
setprop("/instrumentation/du/du2-test-time", getprop("/sim/time/elapsed-sec"));
|
||||||
|
}
|
||||||
|
if (getprop("/instrumentation/du/du5-test") != 1) {
|
||||||
|
setprop("/instrumentation/du/du5-test", 1);
|
||||||
|
setprop("/instrumentation/du/du5-test-time", getprop("/sim/time/elapsed-sec"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
nd_nd.page.hide();
|
setprop("/instrumentation/du/du2-test", 0);
|
||||||
|
setprop("/instrumentation/du/du5-test", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du2") > 0) {
|
||||||
|
if (getprop("/instrumentation/du/du2-test-time") + 38.5 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) {
|
||||||
|
ND_1.page.hide();
|
||||||
|
ND_1_test.page.show();
|
||||||
|
} else if (getprop("/instrumentation/du/du1-test-time") + 39.5 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) {
|
||||||
|
ND_1.page.hide();
|
||||||
|
ND_1_test.page.show();
|
||||||
|
} else {
|
||||||
|
ND_1_test.page.hide();
|
||||||
|
ND_1.page.show();
|
||||||
|
ND_1.NDCpt.update();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ND_1_test.page.hide();
|
||||||
|
ND_1.page.hide();
|
||||||
}
|
}
|
||||||
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du5") > 0) {
|
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du5") > 0) {
|
||||||
nd_nd2.page.show();
|
if (getprop("/instrumentation/du/du5-test-time") + 38.5 >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) {
|
||||||
nd_nd2.NDFo.update();
|
ND_2.page.hide();
|
||||||
|
ND_2_test.page.show();
|
||||||
|
} else if (getprop("/instrumentation/du/du6-test-time") + 39.5 >= elapsedtime and getprop("/modes/fo-du-xfr") == 1) {
|
||||||
|
ND_2.page.hide();
|
||||||
|
ND_2_test.page.show();
|
||||||
|
} else {
|
||||||
|
ND_2_test.page.hide();
|
||||||
|
ND_2.page.show();
|
||||||
|
ND_2.NDFo.update();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
nd_nd2.page.hide();
|
ND_2_test.page.hide();
|
||||||
|
ND_2.page.hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var canvas_nd_nd = {
|
var canvas_ND_1 = {
|
||||||
new: func(canvas_group) {
|
new: func(canvas_group) {
|
||||||
var m = {parents: [canvas_nd_nd, canvas_nd_base]};
|
var m = {parents: [canvas_ND_1, canvas_nd_base]};
|
||||||
m.init(canvas_group);
|
m.init(canvas_group);
|
||||||
|
|
||||||
# here we make the ND:
|
# 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.newMFD(canvas_group);
|
me.NDCpt.newMFD(canvas_group);
|
||||||
me.NDCpt.update();
|
me.NDCpt.update();
|
||||||
|
|
||||||
|
@ -103,13 +145,13 @@ var canvas_nd_nd = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var canvas_nd_nd_r = {
|
var canvas_ND_2 = {
|
||||||
new: func(canvas_group) {
|
new: func(canvas_group) {
|
||||||
var m = {parents: [canvas_nd_nd_r, canvas_nd_base]};
|
var m = {parents: [canvas_ND_2, canvas_nd_base]};
|
||||||
m.init(canvas_group);
|
m.init(canvas_group);
|
||||||
|
|
||||||
# here we make the ND:
|
# here we make the ND:
|
||||||
me.NDFo = ND.new("instrumentation/efis[1]", myCockpit_switches, 'Airbus');
|
me.NDFo = ND.new("instrumentation/efis[1]", myCockpit_switches, "Airbus");
|
||||||
me.NDFo.newMFD(canvas_group);
|
me.NDFo.newMFD(canvas_group);
|
||||||
me.NDFo.update();
|
me.NDFo.update();
|
||||||
|
|
||||||
|
@ -123,6 +165,46 @@ var canvas_nd_nd_r = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var canvas_ND_1_test = {
|
||||||
|
init: func(canvas_group, file) {
|
||||||
|
var font_mapper = func(family, weight) {
|
||||||
|
return "LiberationFonts/LiberationSans-Regular.ttf";
|
||||||
|
};
|
||||||
|
|
||||||
|
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
|
||||||
|
|
||||||
|
me.page = canvas_group;
|
||||||
|
|
||||||
|
return me;
|
||||||
|
},
|
||||||
|
new: func(canvas_group, file) {
|
||||||
|
var m = {parents: [canvas_ND_1_test]};
|
||||||
|
m.init(canvas_group, file);
|
||||||
|
|
||||||
|
return m;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
var canvas_ND_2_test = {
|
||||||
|
init: func(canvas_group, file) {
|
||||||
|
var font_mapper = func(family, weight) {
|
||||||
|
return "LiberationFonts/LiberationSans-Regular.ttf";
|
||||||
|
};
|
||||||
|
|
||||||
|
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
|
||||||
|
|
||||||
|
me.page = canvas_group;
|
||||||
|
|
||||||
|
return me;
|
||||||
|
},
|
||||||
|
new: func(canvas_group, file) {
|
||||||
|
var m = {parents: [canvas_ND_2_test]};
|
||||||
|
m.init(canvas_group, file);
|
||||||
|
|
||||||
|
return m;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
setlistener("sim/signals/fdm-initialized", func {
|
setlistener("sim/signals/fdm-initialized", func {
|
||||||
setprop("instrumentation/efis[0]/inputs/plan-wpt-index", -1);
|
setprop("instrumentation/efis[0]/inputs/plan-wpt-index", -1);
|
||||||
setprop("instrumentation/efis[1]/inputs/plan-wpt-index", -1);
|
setprop("instrumentation/efis[1]/inputs/plan-wpt-index", -1);
|
||||||
|
@ -143,11 +225,15 @@ setlistener("sim/signals/fdm-initialized", func {
|
||||||
|
|
||||||
nd_display.main.addPlacement({"node": "ND.screen"});
|
nd_display.main.addPlacement({"node": "ND.screen"});
|
||||||
nd_display.right.addPlacement({"node": "ND_R.screen"});
|
nd_display.right.addPlacement({"node": "ND_R.screen"});
|
||||||
var group_nd = nd_display.main.createGroup();
|
var group_nd1 = nd_display.main.createGroup();
|
||||||
|
var group_nd1_test = nd_display.main.createGroup();
|
||||||
var group_nd2 = nd_display.right.createGroup();
|
var group_nd2 = nd_display.right.createGroup();
|
||||||
|
var group_nd2_test = nd_display.right.createGroup();
|
||||||
|
|
||||||
nd_nd = canvas_nd_nd.new(group_nd);
|
ND_1 = canvas_ND_1.new(group_nd1);
|
||||||
nd_nd2 = canvas_nd_nd_r.new(group_nd2);
|
ND_1_test = canvas_ND_1_test.new(group_nd1_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg");
|
||||||
|
ND_2 = canvas_ND_2.new(group_nd2);
|
||||||
|
ND_2_test = canvas_ND_2_test.new(group_nd2_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg");
|
||||||
|
|
||||||
nd_update.start();
|
nd_update.start();
|
||||||
});
|
});
|
||||||
|
@ -204,7 +290,7 @@ setlistener("/flight-management/control/capture-leg", func(n) {
|
||||||
}, 0, 0);
|
}, 0, 0);
|
||||||
|
|
||||||
var showNd = func(nd = nil) {
|
var showNd = func(nd = nil) {
|
||||||
if(nd == nil) nd = 'main';
|
if(nd == nil) nd = "main";
|
||||||
var dlg = canvas.Window.new([512, 512], "dialog");
|
var dlg = canvas.Window.new([512, 512], "dialog");
|
||||||
dlg.setCanvas(nd_display[nd]);
|
dlg.setCanvas(nd_display[nd]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,18 +4,18 @@ canvas.NDConfig = {
|
||||||
dep_apt: "/autopilot/route-manager/departure/airport",
|
dep_apt: "/autopilot/route-manager/departure/airport",
|
||||||
des_rwy: "/autopilot/route-manager/destination/runway",
|
des_rwy: "/autopilot/route-manager/destination/runway",
|
||||||
dep_rwy: "/autopilot/route-manager/departure/runway",
|
dep_rwy: "/autopilot/route-manager/departure/runway",
|
||||||
fplan_active: 'autopilot/route-manager/active',
|
fplan_active: "autopilot/route-manager/active",
|
||||||
athr: '/it-autoflight/output/athr',
|
athr: "/it-autoflight/output/athr",
|
||||||
cur_wp: "/autopilot/route-manager/current-wp",
|
cur_wp: "/autopilot/route-manager/current-wp",
|
||||||
vnav_node: "/autopilot/route-manager/vnav/",
|
vnav_node: "/autopilot/route-manager/vnav/",
|
||||||
spd_node: "/autopilot/route-manager/spd/",
|
spd_node: "/autopilot/route-manager/spd/",
|
||||||
holding: "/flight-management/hold",
|
holding: "/flight-management/hold",
|
||||||
holding_points: "/flight-management/hold/points",
|
holding_points: "/flight-management/hold/points",
|
||||||
adf1_frq: 'instrumentation/adf/frequencies/selected-khz',
|
adf1_frq: "instrumentation/adf/frequencies/selected-khz",
|
||||||
adf2_frq: 'instrumentation/adf[1]/frequencies/selected-khz',
|
adf2_frq: "instrumentation/adf[1]/frequencies/selected-khz",
|
||||||
nav1_frq: 'instrumentation/nav/frequencies/selected-mhz',
|
nav1_frq: "instrumentation/nav/frequencies/selected-mhz",
|
||||||
nav2_frq: 'instrumentation/nav[1]/frequencies/selected-mhz',
|
nav2_frq: "instrumentation/nav[1]/frequencies/selected-mhz",
|
||||||
lat_ctrl: 'flight-management/control/lat-ctrl',
|
lat_ctrl: "flight-management/control/lat-ctrl",
|
||||||
ver_ctrl: "flight-management/control/ver-ctrl",
|
ver_ctrl: "flight-management/control/ver-ctrl",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,7 @@ canvas.RouteDriver = {
|
||||||
me.flightplan = flightplan();
|
me.flightplan = flightplan();
|
||||||
},
|
},
|
||||||
getNumberOfFlightPlans: func(){1},
|
getNumberOfFlightPlans: func(){1},
|
||||||
getFlightPlanType: func(fpNum){'active'},
|
getFlightPlanType: func(fpNum){"active"},
|
||||||
getFlightPlan: func(fpNum){me.flightplan},
|
getFlightPlan: func(fpNum){me.flightplan},
|
||||||
getPlanSize: func(fpNum){me.flightplan.getPlanSize()},
|
getPlanSize: func(fpNum){me.flightplan.getPlanSize()},
|
||||||
getWP: func(fpNum, idx){me.flightplan.getWP(idx)},
|
getWP: func(fpNum, idx){me.flightplan.getWP(idx)},
|
||||||
|
@ -24,7 +24,7 @@ canvas.RouteDriver = {
|
||||||
getHoldPatterns: func(fpNum){[]},
|
getHoldPatterns: func(fpNum){[]},
|
||||||
shouldUpdate: func 1,
|
shouldUpdate: func 1,
|
||||||
shouldDisplayWP: func(fpNum, idx) 1,
|
shouldDisplayWP: func(fpNum, idx) 1,
|
||||||
getCurrentWPIdx: func(fpNum) getprop('autopilot/route-manager/current-wp'),
|
getCurrentWPIdx: func(fpNum) getprop("autopilot/route-manager/current-wp"),
|
||||||
getTimeConstraint: func (fpNum, wp_idx) {nil}
|
getTimeConstraint: func (fpNum, wp_idx) {nil}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,16 +60,16 @@ canvas.MultiRouteDriver = {
|
||||||
me._flightplans = subv_l ~ subv_r;
|
me._flightplans = subv_l ~ subv_r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
me.triggerSignal('fp-added');
|
me.triggerSignal("fp-added");
|
||||||
},
|
},
|
||||||
removeFlightPlanOfType: func(type){
|
removeFlightPlanOfType: func(type){
|
||||||
var new_vec = [];
|
var new_vec = [];
|
||||||
foreach(var fp; me._flightplans){
|
foreach(var fp; me._flightplans){
|
||||||
if(fp['type'] != type)
|
if(fp["type"] != type)
|
||||||
append(new_vec, fp);
|
append(new_vec, fp);
|
||||||
}
|
}
|
||||||
me._flightplans = new_vec;
|
me._flightplans = new_vec;
|
||||||
me.triggerSignal('fp-removed');
|
me.triggerSignal("fp-removed");
|
||||||
},
|
},
|
||||||
getNumberOfFlightPlans: func(){
|
getNumberOfFlightPlans: func(){
|
||||||
size(me._flightplans);
|
size(me._flightplans);
|
||||||
|
@ -101,11 +101,11 @@ canvas.MultiRouteDriver = {
|
||||||
setprop(me.signalPath(signal));
|
setprop(me.signalPath(signal));
|
||||||
},
|
},
|
||||||
signalPath: func(signal){
|
signalPath: func(signal){
|
||||||
'autopilot/route-manager/signals/rd-'~ signal;
|
"autopilot/route-manager/signals/rd-"~ signal;
|
||||||
},
|
},
|
||||||
getListeners: func(){[
|
getListeners: func(){[
|
||||||
me.getSignal('fp-added'),
|
me.getSignal("fp-added"),
|
||||||
me.getSignal('fp-removed')
|
me.getSignal("fp-removed")
|
||||||
]},
|
]},
|
||||||
getCurrentWPIdx: func(fpNum) {
|
getCurrentWPIdx: func(fpNum) {
|
||||||
var fp = me.getFlightPlan(fpNum);
|
var fp = me.getFlightPlan(fpNum);
|
||||||
|
|
|
@ -10,7 +10,7 @@ canvas.Group.getChildrenOfType = func(type, array = nil){
|
||||||
if(children == nil)
|
if(children == nil)
|
||||||
children = [];
|
children = [];
|
||||||
var my_children = me.getChildren();
|
var my_children = me.getChildren();
|
||||||
if(typeof(type) != 'vector')
|
if(typeof(type) != "vector")
|
||||||
type = [type];
|
type = [type];
|
||||||
foreach(var c; my_children){
|
foreach(var c; my_children){
|
||||||
foreach(var t; type){
|
foreach(var t; type){
|
||||||
|
@ -32,14 +32,14 @@ canvas.Group.setColor = func(){
|
||||||
var color = arg;
|
var color = arg;
|
||||||
var types = [Path, Text];
|
var types = [Path, Text];
|
||||||
var arg_c = size(color);
|
var arg_c = size(color);
|
||||||
if(arg_c > 1 and typeof(color[-1]) == 'vector'){
|
if(arg_c > 1 and typeof(color[-1]) == "vector"){
|
||||||
types = color[-1];
|
types = color[-1];
|
||||||
color = subvec(color, 0, arg_c - 1);
|
color = subvec(color, 0, arg_c - 1);
|
||||||
}
|
}
|
||||||
var children = me.getChildrenOfType(types);
|
var children = me.getChildrenOfType(types);
|
||||||
if(typeof(color) == 'vector'){
|
if(typeof(color) == "vector"){
|
||||||
var first = color[0];
|
var first = color[0];
|
||||||
if(typeof(first) == 'vector')
|
if(typeof(first) == "vector")
|
||||||
color = first;
|
color = first;
|
||||||
}
|
}
|
||||||
foreach(var c; children)
|
foreach(var c; children)
|
||||||
|
@ -97,8 +97,8 @@ canvas.Symbol.formattedString = func(frmt, model_props){
|
||||||
if(contains(me.model, prop)){
|
if(contains(me.model, prop)){
|
||||||
var val = me.model[prop];
|
var val = me.model[prop];
|
||||||
var tp = typeof(val);
|
var tp = typeof(val);
|
||||||
if(tp != 'scalar'){
|
if(tp != "scalar"){
|
||||||
val = '';
|
val = "";
|
||||||
#printlog("warn", "formattedString: invalid type for "~prop~" (" ~ tp ~ ")");
|
#printlog("warn", "formattedString: invalid type for "~prop~" (" ~ tp ~ ")");
|
||||||
} else {
|
} else {
|
||||||
append(args, val);
|
append(args, val);
|
||||||
|
@ -124,7 +124,7 @@ canvas.Symbol.getStyle = func(name, default = nil){
|
||||||
st = me.layer.style;
|
st = me.layer.style;
|
||||||
if(st == nil) return default;
|
if(st == nil) return default;
|
||||||
var val = opt_member(st, name);
|
var val = opt_member(st, name);
|
||||||
if(typeof(val) == 'func'){
|
if(typeof(val) == "func"){
|
||||||
val = (call(val,[],me));
|
val = (call(val,[],me));
|
||||||
}
|
}
|
||||||
if(val == nil) return default;
|
if(val == nil) return default;
|
||||||
|
@ -133,14 +133,14 @@ canvas.Symbol.getStyle = func(name, default = nil){
|
||||||
|
|
||||||
canvas.Symbol.getLabelFromModel = func(default_val = nil){
|
canvas.Symbol.getLabelFromModel = func(default_val = nil){
|
||||||
if(me.model == nil) return default_val;
|
if(me.model == nil) return default_val;
|
||||||
if(default_val == nil and contains(me.model, 'id'))
|
if(default_val == nil and contains(me.model, "id"))
|
||||||
default_val = me.model.id;
|
default_val = me.model.id;
|
||||||
var label_content = me.getOption('label_content');
|
var label_content = me.getOption("label_content");
|
||||||
if(label_content == nil) return default_val;
|
if(label_content == nil) return default_val;
|
||||||
if(typeof(label_content) == 'scalar')
|
if(typeof(label_content) == "scalar")
|
||||||
label_content = [label_content];
|
label_content = [label_content];
|
||||||
var format_s = me.getOption('label_format');
|
var format_s = me.getOption("label_format");
|
||||||
var label = '';
|
var label = "";
|
||||||
if(format_s == nil){
|
if(format_s == nil){
|
||||||
format_s = "%s";
|
format_s = "%s";
|
||||||
}
|
}
|
||||||
|
@ -148,9 +148,9 @@ canvas.Symbol.getLabelFromModel = func(default_val = nil){
|
||||||
};
|
};
|
||||||
|
|
||||||
canvas.Symbol.callback = func(name, args...){
|
canvas.Symbol.callback = func(name, args...){
|
||||||
name = name ~'_callback';
|
name = name ~"_callback";
|
||||||
var f = me.getOption(name);
|
var f = me.getOption(name);
|
||||||
if(typeof(f) == 'func'){
|
if(typeof(f) == "func"){
|
||||||
return call(f, args, me);
|
return call(f, args, me);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -167,7 +167,7 @@ canvas.DotSym.update = func() {
|
||||||
} else
|
} else
|
||||||
me.element.show();
|
me.element.show();
|
||||||
me.draw();
|
me.draw();
|
||||||
if(me.getOption('disable_position', 0)) return; # << CHECK FOR OPTION 'disable_position'
|
if(me.getOption("disable_position", 0)) return; # << CHECK FOR OPTION "disable_position"
|
||||||
var pos = me.controller.getpos(me.model);
|
var pos = me.controller.getpos(me.model);
|
||||||
if (size(pos) == 2)
|
if (size(pos) == 2)
|
||||||
pos~=[nil]; # fall through
|
pos~=[nil]; # fall through
|
||||||
|
@ -183,27 +183,27 @@ canvas.DotSym.update = func() {
|
||||||
# SVGSymbol
|
# SVGSymbol
|
||||||
|
|
||||||
canvas.SVGSymbol.init = func() {
|
canvas.SVGSymbol.init = func() {
|
||||||
me.callback('init_before');
|
me.callback("init_before");
|
||||||
var opt_path = me.getStyle('svg_path');
|
var opt_path = me.getStyle("svg_path");
|
||||||
if(opt_path != nil)
|
if(opt_path != nil)
|
||||||
me.svg_path = opt_path;
|
me.svg_path = opt_path;
|
||||||
if (!me.cacheable) {
|
if (!me.cacheable) {
|
||||||
if(me.svg_path != nil and me.svg_path != '')
|
if(me.svg_path != nil and me.svg_path != "")
|
||||||
canvas.parsesvg(me.element, me.svg_path);
|
canvas.parsesvg(me.element, me.svg_path);
|
||||||
# hack:
|
# hack:
|
||||||
if (var scale = me.layer.style['scale_factor'])
|
if (var scale = me.layer.style["scale_factor"])
|
||||||
me.element.setScale(scale);
|
me.element.setScale(scale);
|
||||||
if ((var transl = me.layer.style['translate']) != nil)
|
if ((var transl = me.layer.style["translate"]) != nil)
|
||||||
me.element.setTranslation(transl);
|
me.element.setTranslation(transl);
|
||||||
} else {
|
} else {
|
||||||
__die("cacheable not implemented yet!");
|
__die("cacheable not implemented yet!");
|
||||||
}
|
}
|
||||||
me.callback('init_after');
|
me.callback("init_after");
|
||||||
me.draw();
|
me.draw();
|
||||||
};
|
};
|
||||||
|
|
||||||
canvas.SVGSymbol.draw = func{
|
canvas.SVGSymbol.draw = func{
|
||||||
me.callback('draw');
|
me.callback("draw");
|
||||||
};
|
};
|
||||||
|
|
||||||
# SymbolLayer
|
# SymbolLayer
|
||||||
|
@ -223,13 +223,13 @@ canvas.SymbolLayer._new = func(m, style, controller, options) {
|
||||||
if (controller.parents[0].parents[0] != SymbolLayer.Controller)
|
if (controller.parents[0].parents[0] != SymbolLayer.Controller)
|
||||||
__die("MultiSymbolLayer: OOP error");
|
__die("MultiSymbolLayer: OOP error");
|
||||||
if(options != nil){ # << CHECK FOR CONFIGURABLE LISTENERS
|
if(options != nil){ # << CHECK FOR CONFIGURABLE LISTENERS
|
||||||
var listeners = opt_member(controller, 'listeners');
|
var listeners = opt_member(controller, "listeners");
|
||||||
var listen = opt_member(options, 'listen');
|
var listen = opt_member(options, "listen");
|
||||||
if (listen != nil and listeners != nil){
|
if (listen != nil and listeners != nil){
|
||||||
var listen_tp = typeof(listen);
|
var listen_tp = typeof(listen);
|
||||||
if(listen_tp != 'vector' and listen_tp != 'scalar')
|
if(listen_tp != "vector" and listen_tp != "scalar")
|
||||||
__die("Options 'listen' cannot be a "~ listen_tp);
|
__die("Options 'listen' cannot be a "~ listen_tp);
|
||||||
if(typeof(listen) == 'scalar')
|
if(typeof(listen) == "scalar")
|
||||||
listen = [listen];
|
listen = [listen];
|
||||||
foreach(var node_name; listen){
|
foreach(var node_name; listen){
|
||||||
var node = opt_member(options, node_name);
|
var node = opt_member(options, node_name);
|
||||||
|
@ -247,9 +247,9 @@ canvas.SymbolLayer._new = func(m, style, controller, options) {
|
||||||
|
|
||||||
canvas.LineSymbol.new = func(group, layer, model, controller=nil) {
|
canvas.LineSymbol.new = func(group, layer, model, controller=nil) {
|
||||||
if (me == nil) __die("Need me reference for LineSymbol.new()");
|
if (me == nil) __die("Need me reference for LineSymbol.new()");
|
||||||
if (typeof(model) != 'vector') {
|
if (typeof(model) != "vector") {
|
||||||
if(typeof(model) == 'hash'){
|
if(typeof(model) == "hash"){
|
||||||
if(!contains(model, 'path'))
|
if(!contains(model, "path"))
|
||||||
canvas.__die("LineSymbol.new(): model hash requires path");
|
canvas.__die("LineSymbol.new(): model hash requires path");
|
||||||
}
|
}
|
||||||
else canvas.__die("LineSymbol.new(): need a vector of points or a hash");
|
else canvas.__die("LineSymbol.new(): need a vector of points or a hash");
|
||||||
|
@ -272,7 +272,7 @@ canvas.LineSymbol.new = func(group, layer, model, controller=nil) {
|
||||||
};
|
};
|
||||||
# Non-static:
|
# Non-static:
|
||||||
canvas.LineSymbol.draw = func() {
|
canvas.LineSymbol.draw = func() {
|
||||||
me.callback('draw_before');
|
me.callback("draw_before");
|
||||||
if (!me.needs_update) return;
|
if (!me.needs_update) return;
|
||||||
#printlog(_MP_dbg_lvl, "redrawing a LineSymbol "~me.layer.type);
|
#printlog(_MP_dbg_lvl, "redrawing a LineSymbol "~me.layer.type);
|
||||||
me.element.reset();
|
me.element.reset();
|
||||||
|
@ -280,7 +280,7 @@ canvas.LineSymbol.draw = func() {
|
||||||
var coords = [];
|
var coords = [];
|
||||||
var cmd = canvas.Path.VG_MOVE_TO;
|
var cmd = canvas.Path.VG_MOVE_TO;
|
||||||
var path = me.model;
|
var path = me.model;
|
||||||
if(typeof(path) == 'hash'){
|
if(typeof(path) == "hash"){
|
||||||
path = me.model.path;
|
path = me.model.path;
|
||||||
if(path == nil)
|
if(path == nil)
|
||||||
canvas.__die("LineSymbol model requires a 'path' member (vector)");
|
canvas.__die("LineSymbol model requires a 'path' member (vector)");
|
||||||
|
@ -297,7 +297,7 @@ canvas.LineSymbol.draw = func() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
me.element.setDataGeo(cmds, coords);
|
me.element.setDataGeo(cmds, coords);
|
||||||
me.element.update(); # this doesn't help with flickering, it seems
|
me.element.update(); # this doesn"t help with flickering, it seems
|
||||||
me.callback('draw_after');
|
me.callback("draw_after");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ canvas.NavDisplay.set_switch = func(s, v) {
|
||||||
};
|
};
|
||||||
|
|
||||||
canvas.NavDisplay.get_nav_path = func (type, idx) {
|
canvas.NavDisplay.get_nav_path = func (type, idx) {
|
||||||
var name = (type == 'dme' ? type : 'nav');
|
var name = (type == "dme" ? type : "nav");
|
||||||
var path = 'instrumentation/%s[%d]/';
|
var path = "instrumentation/%s[%d]/";
|
||||||
var indexes = me.radio_cfg[type];
|
var indexes = me.radio_cfg[type];
|
||||||
if (indexes != nil) {
|
if (indexes != nil) {
|
||||||
idx = indexes[idx];
|
idx = indexes[idx];
|
||||||
|
@ -34,32 +34,32 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update
|
||||||
me.nd = canvas_group;
|
me.nd = canvas_group;
|
||||||
me.canvas_handle = parent;
|
me.canvas_handle = parent;
|
||||||
me.df_options = nil;
|
me.df_options = nil;
|
||||||
if(contains(me.nd_style, 'options'))
|
if(contains(me.nd_style, "options"))
|
||||||
me.df_options = me.nd_style.options;
|
me.df_options = me.nd_style.options;
|
||||||
nd_options = default_hash(nd_options, me.df_options);
|
nd_options = default_hash(nd_options, me.df_options);
|
||||||
me.options = nd_options;
|
me.options = nd_options;
|
||||||
me.route_driver = nil;
|
me.route_driver = nil;
|
||||||
if(contains(me.options, 'route_driver')){
|
if(contains(me.options, "route_driver")){
|
||||||
me.route_driver = me.options.route_driver;
|
me.route_driver = me.options.route_driver;
|
||||||
}
|
}
|
||||||
elsif(contains(me.options, 'defaults')){
|
elsif(contains(me.options, "defaults")){
|
||||||
if(contains(me.options.defaults, 'route_driver'))
|
if(contains(me.options.defaults, "route_driver"))
|
||||||
me.route_driver = me.options.defaults.route_driver;
|
me.route_driver = me.options.defaults.route_driver;
|
||||||
}
|
}
|
||||||
me.radio_cfg = me.options['radio'];
|
me.radio_cfg = me.options["radio"];
|
||||||
if (me.radio_cfg == nil) me.radio_cfg = {};
|
if (me.radio_cfg == nil) me.radio_cfg = {};
|
||||||
|
|
||||||
# load the specified SVG file into the me.nd group and populate all sub groups
|
# load the specified SVG file into the me.nd group and populate all sub groups
|
||||||
|
|
||||||
canvas.parsesvg(me.nd, me.nd_style.svg_filename, {'font-mapper': me.nd_style.font_mapper});
|
canvas.parsesvg(me.nd, me.nd_style.svg_filename, {"font-mapper": me.nd_style.font_mapper});
|
||||||
me.symbols = {}; # storage for SVG elements, to avoid namespace pollution (all SVG elements end up here)
|
me.symbols = {}; # storage for SVG elements, to avoid namespace pollution (all SVG elements end up here)
|
||||||
|
|
||||||
foreach(var feature; me.nd_style.features ) {
|
foreach(var feature; me.nd_style.features ) {
|
||||||
me.symbols[feature.id] = me.nd.getElementById(feature.id).updateCenter();
|
me.symbols[feature.id] = me.nd.getElementById(feature.id).updateCenter();
|
||||||
if(contains(feature.impl,'init')) feature.impl.init(me.nd, feature); # call The element's init code (i.e. updateCenter)
|
if(contains(feature.impl,"init")) feature.impl.init(me.nd, feature); # call The element"s init code (i.e. updateCenter)
|
||||||
}
|
}
|
||||||
|
|
||||||
### this is the "old" method that's less flexible, we want to use the style hash instead (see above)
|
### this is the "old" method that"s less flexible, we want to use the style hash instead (see above)
|
||||||
# because things are much better configurable that way
|
# because things are much better configurable that way
|
||||||
# now look up all required SVG elements and initialize member fields using the same name to have a convenient handle
|
# now look up all required SVG elements and initialize member fields using the same name to have a convenient handle
|
||||||
foreach(var element; ["dmeLDist","dmeRDist","dmeL","dmeR","vorL","vorR","vorLId","vorRId",
|
foreach(var element; ["dmeLDist","dmeRDist","dmeL","dmeR","vorL","vorR","vorLId","vorRId",
|
||||||
|
@ -78,7 +78,7 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update
|
||||||
me.map = me.nd.createChild("map","map")
|
me.map = me.nd.createChild("map","map")
|
||||||
.set("clip", "rect(124, 1024, 1024, 0)")
|
.set("clip", "rect(124, 1024, 1024, 0)")
|
||||||
.set("screen-range", 700)
|
.set("screen-range", 700)
|
||||||
.set('z-index',-1);
|
.set("z-index",-1);
|
||||||
|
|
||||||
me.update_sub(); # init some map properties based on switches
|
me.update_sub(); # init some map properties based on switches
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update
|
||||||
}
|
}
|
||||||
|
|
||||||
# a hash with controller callbacks, will be passed onto draw routines to customize behavior/appearance
|
# a hash with controller callbacks, will be passed onto draw routines to customize behavior/appearance
|
||||||
# the point being that draw routines don't know anything about their frontends (instrument or GUI dialog)
|
# the point being that draw routines don"t know anything about their frontends (instrument or GUI dialog)
|
||||||
# so we need some simple way to communicate between frontend<->backend until we have real controllers
|
# so we need some simple way to communicate between frontend<->backend until we have real controllers
|
||||||
# for now, a single controller hash is shared by most layers - unsupported callbacks are simply ignored by the draw files
|
# for now, a single controller hash is shared by most layers - unsupported callbacks are simply ignored by the draw files
|
||||||
#
|
#
|
||||||
|
@ -148,32 +148,32 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update
|
||||||
|
|
||||||
###
|
###
|
||||||
# set up various layers, controlled via callbacks in the controller hash
|
# set up various layers, controlled via callbacks in the controller hash
|
||||||
# revisit this code once Philosopher's "Smart MVC Symbols/Layers" work is committed and integrated
|
# revisit this code once Philosopher"s "Smart MVC Symbols/Layers" work is committed and integrated
|
||||||
|
|
||||||
# helper / closure generator
|
# helper / closure generator
|
||||||
var make_event_handler = func(predicate, layer) func predicate(me, layer);
|
var make_event_handler = func(predicate, layer) func predicate(me, layer);
|
||||||
|
|
||||||
me.layers={}; # storage container for all ND specific layers
|
me.layers={}; # storage container for all ND specific layers
|
||||||
# look up all required layers as specified per the NDStyle hash and do the initial setup for event handling
|
# look up all required layers as specified per the NDStyle hash and do the initial setup for event handling
|
||||||
var default_opts = me.options != nil and contains(me.options, 'defaults') ? me.options.defaults : nil;
|
var default_opts = me.options != nil and contains(me.options, "defaults") ? me.options.defaults : nil;
|
||||||
foreach(var layer; me.nd_style.layers) {
|
foreach(var layer; me.nd_style.layers) {
|
||||||
if(layer['disabled']) continue; # skip this layer
|
if(layer["disabled"]) continue; # skip this layer
|
||||||
#print("newMFD(): Setting up ND layer:", layer.name);
|
#print("newMFD(): Setting up ND layer:", layer.name);
|
||||||
|
|
||||||
var the_layer = nil;
|
var the_layer = nil;
|
||||||
if(!layer['isMapStructure']) # set up an old INEFFICIENT and SLOW layer
|
if(!layer["isMapStructure"]) # set up an old INEFFICIENT and SLOW layer
|
||||||
the_layer = me.layers[layer.name] = canvas.MAP_LAYERS[layer.name].new( me.map, layer.name, controller );
|
the_layer = me.layers[layer.name] = canvas.MAP_LAYERS[layer.name].new( me.map, layer.name, controller );
|
||||||
else {
|
else {
|
||||||
printlog(_MP_dbg_lvl, "Setting up MapStructure-based layer for ND, name:", layer.name);
|
printlog(_MP_dbg_lvl, "Setting up MapStructure-based layer for ND, name:", layer.name);
|
||||||
var opt = me.options != nil and me.options[layer.name] != nil ? me.options[layer.name] :nil;
|
var opt = me.options != nil and me.options[layer.name] != nil ? me.options[layer.name] :nil;
|
||||||
if(opt == nil and contains(layer, 'options'))
|
if(opt == nil and contains(layer, "options"))
|
||||||
opt = layer.options;
|
opt = layer.options;
|
||||||
if(opt != nil and default_opts != nil)
|
if(opt != nil and default_opts != nil)
|
||||||
opt = default_hash(opt, default_opts);
|
opt = default_hash(opt, default_opts);
|
||||||
#elsif(default_opts != nil)
|
#elsif(default_opts != nil)
|
||||||
# opt = default_opts;
|
# opt = default_opts;
|
||||||
var style = nil;
|
var style = nil;
|
||||||
if(contains(layer, 'style'))
|
if(contains(layer, "style"))
|
||||||
style = layer.style;
|
style = layer.style;
|
||||||
#print("Options is: ", opt!=nil?"enabled":"disabled");
|
#print("Options is: ", opt!=nil?"enabled":"disabled");
|
||||||
#debug.dump(opt);
|
#debug.dump(opt);
|
||||||
|
@ -183,15 +183,15 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update
|
||||||
opts: opt,
|
opts: opt,
|
||||||
visible:0,
|
visible:0,
|
||||||
style: style,
|
style: style,
|
||||||
priority: layer['z-index']
|
priority: layer["z-index"]
|
||||||
);
|
);
|
||||||
#me.map.addLayer(canvas.SymbolLayer, layer.name, layer['z-index'], style, opt, 0);
|
#me.map.addLayer(canvas.SymbolLayer, layer.name, layer["z-index"], style, opt, 0);
|
||||||
the_layer = me.layers[layer.name] = me.map.getLayer(layer.name);
|
the_layer = me.layers[layer.name] = me.map.getLayer(layer.name);
|
||||||
if(opt != nil and contains(opt, 'range_dependant')){
|
if(opt != nil and contains(opt, "range_dependant")){
|
||||||
if(opt.range_dependant)
|
if(opt.range_dependant)
|
||||||
append(me.range_dependant_layers, the_layer);
|
append(me.range_dependant_layers, the_layer);
|
||||||
}
|
}
|
||||||
if(contains(layer, 'always_update'))
|
if(contains(layer, "always_update"))
|
||||||
me.always_update_layers[layer.name] = layer.always_update;
|
me.always_update_layers[layer.name] = layer.always_update;
|
||||||
if (1) (func {
|
if (1) (func {
|
||||||
var l = layer;
|
var l = layer;
|
||||||
|
@ -206,11 +206,11 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update
|
||||||
|
|
||||||
# now register all layer specific notification listeners and their corresponding update predicate/callback
|
# now register all layer specific notification listeners and their corresponding update predicate/callback
|
||||||
# pass the ND instance and the layer handle to the predicate when it is called
|
# pass the ND instance and the layer handle to the predicate when it is called
|
||||||
# so that it can directly access the ND instance and its own layer (without having to know the layer's name)
|
# so that it can directly access the ND instance and its own layer (without having to know the layer"s name)
|
||||||
var event_handler = make_event_handler(layer.predicate, the_layer);
|
var event_handler = make_event_handler(layer.predicate, the_layer);
|
||||||
foreach(var event; layer.update_on) {
|
foreach(var event; layer.update_on) {
|
||||||
# this handles timers
|
# this handles timers
|
||||||
if (typeof(event)=='hash' and contains(event, 'rate_hz')) {
|
if (typeof(event)=="hash" and contains(event, "rate_hz")) {
|
||||||
#print("FIXME: navdisplay.mfd timer handling is broken ATM");
|
#print("FIXME: navdisplay.mfd timer handling is broken ATM");
|
||||||
var job=me.addtimer(1/event.rate_hz, event_handler);
|
var job=me.addtimer(1/event.rate_hz, event_handler);
|
||||||
job.start();
|
job.start();
|
||||||
|
@ -239,14 +239,14 @@ canvas.NavDisplay.update_sub = func(){
|
||||||
var userLon = me.aircraft_source.get_lon();
|
var userLon = me.aircraft_source.get_lon();
|
||||||
var userGndSpd = me.aircraft_source.get_gnd_spd();
|
var userGndSpd = me.aircraft_source.get_gnd_spd();
|
||||||
var userVSpd = me.aircraft_source.get_vspd();
|
var userVSpd = me.aircraft_source.get_vspd();
|
||||||
var dispLCD = me.get_switch('toggle_display_type') == "LCD";
|
var dispLCD = me.get_switch("toggle_display_type") == "LCD";
|
||||||
# Heading update
|
# Heading update
|
||||||
var userHdgMag = me.aircraft_source.get_hdg_mag();
|
var userHdgMag = me.aircraft_source.get_hdg_mag();
|
||||||
var userHdgTru = me.aircraft_source.get_hdg_tru();
|
var userHdgTru = me.aircraft_source.get_hdg_tru();
|
||||||
var userTrkMag = me.aircraft_source.get_trk_mag();
|
var userTrkMag = me.aircraft_source.get_trk_mag();
|
||||||
var userTrkTru = me.aircraft_source.get_trk_tru();
|
var userTrkTru = me.aircraft_source.get_trk_tru();
|
||||||
|
|
||||||
if(me.get_switch('toggle_true_north')) {
|
if(me.get_switch("toggle_true_north")) {
|
||||||
var userHdg=userHdgTru;
|
var userHdg=userHdgTru;
|
||||||
me.userHdg=userHdgTru;
|
me.userHdg=userHdgTru;
|
||||||
var userTrk=userTrkTru;
|
var userTrk=userTrkTru;
|
||||||
|
@ -268,8 +268,8 @@ canvas.NavDisplay.update_sub = func(){
|
||||||
me.userTrk=userHdg;
|
me.userTrk=userHdg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((me.in_mode('toggle_display_mode', ['MAP']) and me.get_switch('toggle_display_type') == "CRT")
|
if((me.in_mode("toggle_display_mode", ["MAP"]) and me.get_switch("toggle_display_type") == "CRT")
|
||||||
or (me.get_switch('toggle_track_heading') and me.get_switch('toggle_display_type') == "LCD"))
|
or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD"))
|
||||||
{
|
{
|
||||||
userHdgTrk = userTrk;
|
userHdgTrk = userTrk;
|
||||||
me.userHdgTrk = userTrk;
|
me.userHdgTrk = userTrk;
|
||||||
|
@ -291,7 +291,7 @@ canvas.NavDisplay.update_sub = func(){
|
||||||
};
|
};
|
||||||
# reposition the map, change heading & range:
|
# reposition the map, change heading & range:
|
||||||
var pln_wpt_idx = getprop(me.efis_path ~ "/inputs/plan-wpt-index");
|
var pln_wpt_idx = getprop(me.efis_path ~ "/inputs/plan-wpt-index");
|
||||||
if(me.in_mode('toggle_display_mode', ['PLAN']) and pln_wpt_idx >= 0) {
|
if(me.in_mode("toggle_display_mode", ["PLAN"]) and pln_wpt_idx >= 0) {
|
||||||
if(me.route_driver != nil){
|
if(me.route_driver != nil){
|
||||||
var wp = me.route_driver.getPlanModeWP(pln_wpt_idx);
|
var wp = me.route_driver.getPlanModeWP(pln_wpt_idx);
|
||||||
if(wp != nil){
|
if(wp != nil){
|
||||||
|
@ -309,14 +309,14 @@ canvas.NavDisplay.update_sub = func(){
|
||||||
pos.lat = userLat;
|
pos.lat = userLat;
|
||||||
pos.lon = userLon;
|
pos.lon = userLon;
|
||||||
}
|
}
|
||||||
if(me.in_mode('toggle_display_mode', ['PLAN'])) {
|
if(me.in_mode("toggle_display_mode", ["PLAN"])) {
|
||||||
pos.hdg = 0;
|
pos.hdg = 0;
|
||||||
pos.range = me.rangeNm()*2
|
pos.range = me.rangeNm()*2
|
||||||
} else {
|
} else {
|
||||||
pos.range = me.rangeNm(); # avoid this here, use a listener instead
|
pos.range = me.rangeNm(); # avoid this here, use a listener instead
|
||||||
pos.hdg = userHdgTrkTru;
|
pos.hdg = userHdgTrkTru;
|
||||||
}
|
}
|
||||||
if(me.options != nil and (var pos_callback = me.options['position_callback']) != nil)
|
if(me.options != nil and (var pos_callback = me.options["position_callback"]) != nil)
|
||||||
pos_callback(me, pos);
|
pos_callback(me, pos);
|
||||||
call(me.map.setPos, [pos.lat, pos.lon], me.map, pos);
|
call(me.map.setPos, [pos.lat, pos.lon], me.map, pos);
|
||||||
if(pos.range != oldRange){
|
if(pos.range != oldRange){
|
||||||
|
@ -329,12 +329,12 @@ canvas.NavDisplay.update_sub = func(){
|
||||||
canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft specific, cannot easily be reused by other aircraft
|
canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft specific, cannot easily be reused by other aircraft
|
||||||
{
|
{
|
||||||
var _time = systime();
|
var _time = systime();
|
||||||
# Disables WXR Live if it's not enabled. The toggle_weather_live should be common to all
|
# Disables WXR Live if it"s not enabled. The toggle_weather_live should be common to all
|
||||||
# ND instances.
|
# ND instances.
|
||||||
var wxr_live_enabled = getprop(wxr_live_tree~'/enabled');
|
var wxr_live_enabled = getprop(wxr_live_tree~"/enabled");
|
||||||
if(wxr_live_enabled == nil or wxr_live_enabled == '')
|
if(wxr_live_enabled == nil or wxr_live_enabled == "")
|
||||||
wxr_live_enabled = 0;
|
wxr_live_enabled = 0;
|
||||||
me.set_switch('toggle_weather_live', wxr_live_enabled);
|
me.set_switch("toggle_weather_live", wxr_live_enabled);
|
||||||
call(me.update_sub, nil, nil, caller(0)[0]); # call this in the same namespace to "steal" its variables
|
call(me.update_sub, nil, nil, caller(0)[0]); # call this in the same namespace to "steal" its variables
|
||||||
|
|
||||||
# MapStructure update!
|
# MapStructure update!
|
||||||
|
@ -351,14 +351,14 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
# TODO: should be refactored!
|
# TODO: should be refactored!
|
||||||
var translation_callback = nil;
|
var translation_callback = nil;
|
||||||
if(me.options != nil)
|
if(me.options != nil)
|
||||||
translation_callback = me.options['translation_callback'];
|
translation_callback = me.options["translation_callback"];
|
||||||
if(typeof(translation_callback) == 'func'){
|
if(typeof(translation_callback) == "func"){
|
||||||
var trsl = translation_callback(me);
|
var trsl = translation_callback(me);
|
||||||
me.map.setTranslation(trsl.x, trsl.y);
|
me.map.setTranslation(trsl.x, trsl.y);
|
||||||
} else {
|
} else {
|
||||||
if(me.in_mode('toggle_display_mode', ['PLAN']))
|
if(me.in_mode("toggle_display_mode", ["PLAN"]))
|
||||||
me.map.setTranslation(512,512);
|
me.map.setTranslation(512,512);
|
||||||
elsif(me.get_switch('toggle_centered'))
|
elsif(me.get_switch("toggle_centered"))
|
||||||
me.map.setTranslation(512,565);
|
me.map.setTranslation(512,565);
|
||||||
else
|
else
|
||||||
me.map.setTranslation(512,824);
|
me.map.setTranslation(512,824);
|
||||||
|
@ -368,7 +368,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
var dme1_path = "/instrumentation/dme[2]";
|
var dme1_path = "/instrumentation/dme[2]";
|
||||||
var dme2_path = "/instrumentation/dme[3]";
|
var dme2_path = "/instrumentation/dme[3]";
|
||||||
|
|
||||||
if(me.get_switch('toggle_rh_vor_adf') == 1) {
|
if(me.get_switch("toggle_rh_vor_adf") == 1) {
|
||||||
me.symbols.vorR.setText("VOR R");
|
me.symbols.vorR.setText("VOR R");
|
||||||
me.symbols.vorR.setColor(0.195,0.96,0.097);
|
me.symbols.vorR.setColor(0.195,0.96,0.097);
|
||||||
me.symbols.dmeR.setText("DME");
|
me.symbols.dmeR.setText("DME");
|
||||||
|
@ -382,7 +382,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
me.symbols.dmeRDist.setText(sprintf("%3.1f",getprop(dme2_path~ "indicated-distance-nm")));
|
me.symbols.dmeRDist.setText(sprintf("%3.1f",getprop(dme2_path~ "indicated-distance-nm")));
|
||||||
else me.symbols.dmeRDist.setText(" ---");
|
else me.symbols.dmeRDist.setText(" ---");
|
||||||
me.symbols.dmeRDist.setColor(0.195,0.96,0.097);
|
me.symbols.dmeRDist.setColor(0.195,0.96,0.097);
|
||||||
} elsif(me.get_switch('toggle_rh_vor_adf') == -1) {
|
} elsif(me.get_switch("toggle_rh_vor_adf") == -1) {
|
||||||
me.symbols.vorR.setText("ADF R");
|
me.symbols.vorR.setText("ADF R");
|
||||||
me.symbols.vorR.setColor(0,0.6,0.85);
|
me.symbols.vorR.setColor(0,0.6,0.85);
|
||||||
me.symbols.dmeR.setText("");
|
me.symbols.dmeR.setText("");
|
||||||
|
@ -406,8 +406,8 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
if (hdg_bug_active == nil)
|
if (hdg_bug_active == nil)
|
||||||
hdg_bug_active = 1;
|
hdg_bug_active = 1;
|
||||||
|
|
||||||
if((me.in_mode('toggle_display_mode', ['MAP']) and me.get_switch('toggle_display_type') == "CRT")
|
if((me.in_mode("toggle_display_mode", ["MAP"]) and me.get_switch("toggle_display_type") == "CRT")
|
||||||
or (me.get_switch('toggle_track_heading') and me.get_switch('toggle_display_type') == "LCD"))
|
or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD"))
|
||||||
{
|
{
|
||||||
me.symbols.trkInd.setRotation(0);
|
me.symbols.trkInd.setRotation(0);
|
||||||
me.symbols.curHdgPtr.setRotation((userHdg-userTrk)*D2R);
|
me.symbols.curHdgPtr.setRotation((userHdg-userTrk)*D2R);
|
||||||
|
@ -419,7 +419,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
me.symbols.curHdgPtr.setRotation(0);
|
me.symbols.curHdgPtr.setRotation(0);
|
||||||
me.symbols.curHdgPtr2.setRotation(0);
|
me.symbols.curHdgPtr2.setRotation(0);
|
||||||
}
|
}
|
||||||
if(!me.in_mode('toggle_display_mode', ['PLAN']))
|
if(!me.in_mode("toggle_display_mode", ["PLAN"]))
|
||||||
{
|
{
|
||||||
var hdgBugRot = (vhdg_bug-userHdgTrk)*D2R;
|
var hdgBugRot = (vhdg_bug-userHdgTrk)*D2R;
|
||||||
me.symbols.selHdgLine.setRotation(hdgBugRot);
|
me.symbols.selHdgLine.setRotation(hdgBugRot);
|
||||||
|
@ -428,9 +428,9 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
me.symbols.selHdgLine2.setRotation(hdgBugRot);
|
me.symbols.selHdgLine2.setRotation(hdgBugRot);
|
||||||
}
|
}
|
||||||
|
|
||||||
var staPtrVis = !me.in_mode('toggle_display_mode', ['PLAN']);
|
var staPtrVis = !me.in_mode("toggle_display_mode", ["PLAN"]);
|
||||||
if((me.in_mode('toggle_display_mode', ['MAP']) and me.get_switch('toggle_display_type') == "CRT")
|
if((me.in_mode("toggle_display_mode", ["MAP"]) and me.get_switch("toggle_display_type") == "CRT")
|
||||||
or (me.get_switch('toggle_track_heading') and me.get_switch('toggle_display_type') == "LCD"))
|
or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD"))
|
||||||
{
|
{
|
||||||
var vorheading = userTrkTru;
|
var vorheading = userTrkTru;
|
||||||
var adfheading = userTrkMag;
|
var adfheading = userTrkMag;
|
||||||
|
@ -440,35 +440,35 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
var vorheading = userHdgTru;
|
var vorheading = userHdgTru;
|
||||||
var adfheading = userHdgMag;
|
var adfheading = userHdgMag;
|
||||||
}
|
}
|
||||||
if (getprop("/instrumentation/nav[2]/heading-deg") != nil and me.get_switch('toggle_true_north') == 0) {
|
if (getprop("/instrumentation/nav[2]/heading-deg") != nil and me.get_switch("toggle_true_north") == 0) {
|
||||||
var nav0hdg = getprop("/instrumentation/nav[2]/heading-deg") - getprop("/orientation/heading-magnetic-deg");
|
var nav0hdg = getprop("/instrumentation/nav[2]/heading-deg") - getprop("/orientation/heading-magnetic-deg");
|
||||||
} else if (getprop("/instrumentation/nav[2]/heading-deg") != nil and me.get_switch('toggle_true_north') == 1) {
|
} else if (getprop("/instrumentation/nav[2]/heading-deg") != nil and me.get_switch("toggle_true_north") == 1) {
|
||||||
var nav0hdg = getprop("/instrumentation/nav[2]/heading-deg") - getprop("/orientation/heading-deg");
|
var nav0hdg = getprop("/instrumentation/nav[2]/heading-deg") - getprop("/orientation/heading-deg");
|
||||||
} else {
|
} else {
|
||||||
var nav0hdg = 0;
|
var nav0hdg = 0;
|
||||||
}
|
}
|
||||||
if (getprop("/instrumentation/nav[3]/heading-deg") != nil and me.get_switch('toggle_true_north') == 0) {
|
if (getprop("/instrumentation/nav[3]/heading-deg") != nil and me.get_switch("toggle_true_north") == 0) {
|
||||||
var nav1hdg = getprop("/instrumentation/nav[3]/heading-deg") - getprop("/orientation/heading-magnetic-deg");
|
var nav1hdg = getprop("/instrumentation/nav[3]/heading-deg") - getprop("/orientation/heading-magnetic-deg");
|
||||||
} else if (getprop("/instrumentation/nav[3]/heading-deg") != nil and me.get_switch('toggle_true_north') == 1) {
|
} else if (getprop("/instrumentation/nav[3]/heading-deg") != nil and me.get_switch("toggle_true_north") == 1) {
|
||||||
var nav1hdg = getprop("/instrumentation/nav[3]/heading-deg") - getprop("/orientation/heading-deg");
|
var nav1hdg = getprop("/instrumentation/nav[3]/heading-deg") - getprop("/orientation/heading-deg");
|
||||||
} else {
|
} else {
|
||||||
var nav1hdg = 0;
|
var nav1hdg = 0;
|
||||||
}
|
}
|
||||||
var adf0hdg=getprop("instrumentation/adf/indicated-bearing-deg");
|
var adf0hdg=getprop("instrumentation/adf/indicated-bearing-deg");
|
||||||
var adf1hdg=getprop("instrumentation/adf[1]/indicated-bearing-deg");
|
var adf1hdg=getprop("instrumentation/adf[1]/indicated-bearing-deg");
|
||||||
if(!me.get_switch('toggle_centered'))
|
if(!me.get_switch("toggle_centered"))
|
||||||
{
|
{
|
||||||
if(me.in_mode('toggle_display_mode', ['PLAN']))
|
if(me.in_mode("toggle_display_mode", ["PLAN"]))
|
||||||
me.symbols.trkInd.hide();
|
me.symbols.trkInd.hide();
|
||||||
else
|
else
|
||||||
me.symbols.trkInd.show();
|
me.symbols.trkInd.show();
|
||||||
if((getprop("instrumentation/nav[2]/in-range") and me.get_switch('toggle_lh_vor_adf') == 1)) {
|
if((getprop("instrumentation/nav[2]/in-range") and me.get_switch("toggle_lh_vor_adf") == 1)) {
|
||||||
me.symbols.staArrowL.setVisible(staPtrVis);
|
me.symbols.staArrowL.setVisible(staPtrVis);
|
||||||
me.symbols.staToL.setColor(0.195,0.96,0.097);
|
me.symbols.staToL.setColor(0.195,0.96,0.097);
|
||||||
me.symbols.staFromL.setColor(0.195,0.96,0.097);
|
me.symbols.staFromL.setColor(0.195,0.96,0.097);
|
||||||
me.symbols.staArrowL.setRotation(nav0hdg*D2R);
|
me.symbols.staArrowL.setRotation(nav0hdg*D2R);
|
||||||
}
|
}
|
||||||
elsif(getprop("instrumentation/adf/in-range") and (me.get_switch('toggle_lh_vor_adf') == -1)) {
|
elsif(getprop("instrumentation/adf/in-range") and (me.get_switch("toggle_lh_vor_adf") == -1)) {
|
||||||
me.symbols.staArrowL.setVisible(staPtrVis);
|
me.symbols.staArrowL.setVisible(staPtrVis);
|
||||||
me.symbols.staToL.setColor(0,0.6,0.85);
|
me.symbols.staToL.setColor(0,0.6,0.85);
|
||||||
me.symbols.staFromL.setColor(0,0.6,0.85);
|
me.symbols.staFromL.setColor(0,0.6,0.85);
|
||||||
|
@ -476,12 +476,12 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
} else {
|
} else {
|
||||||
me.symbols.staArrowL.hide();
|
me.symbols.staArrowL.hide();
|
||||||
}
|
}
|
||||||
if((getprop("instrumentation/nav[3]/in-range") and me.get_switch('toggle_rh_vor_adf') == 1)) {
|
if((getprop("instrumentation/nav[3]/in-range") and me.get_switch("toggle_rh_vor_adf") == 1)) {
|
||||||
me.symbols.staArrowR.setVisible(staPtrVis);
|
me.symbols.staArrowR.setVisible(staPtrVis);
|
||||||
me.symbols.staToR.setColor(0.195,0.96,0.097);
|
me.symbols.staToR.setColor(0.195,0.96,0.097);
|
||||||
me.symbols.staFromR.setColor(0.195,0.96,0.097);
|
me.symbols.staFromR.setColor(0.195,0.96,0.097);
|
||||||
me.symbols.staArrowR.setRotation(nav1hdg*D2R);
|
me.symbols.staArrowR.setRotation(nav1hdg*D2R);
|
||||||
} elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch('toggle_rh_vor_adf') == -1)) {
|
} elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch("toggle_rh_vor_adf") == -1)) {
|
||||||
me.symbols.staArrowR.setVisible(staPtrVis);
|
me.symbols.staArrowR.setVisible(staPtrVis);
|
||||||
me.symbols.staToR.setColor(0,0.6,0.85);
|
me.symbols.staToR.setColor(0,0.6,0.85);
|
||||||
me.symbols.staFromR.setColor(0,0.6,0.85);
|
me.symbols.staFromR.setColor(0,0.6,0.85);
|
||||||
|
@ -498,7 +498,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
me.symbols.selHdgLine2.hide();
|
me.symbols.selHdgLine2.hide();
|
||||||
me.symbols.curHdgPtr.setVisible(staPtrVis);
|
me.symbols.curHdgPtr.setVisible(staPtrVis);
|
||||||
me.symbols.HdgBugCRT.setVisible(staPtrVis and !dispLCD);
|
me.symbols.HdgBugCRT.setVisible(staPtrVis and !dispLCD);
|
||||||
if(me.get_switch('toggle_track_heading'))
|
if(me.get_switch("toggle_track_heading"))
|
||||||
{
|
{
|
||||||
me.symbols.HdgBugLCD.hide();
|
me.symbols.HdgBugLCD.hide();
|
||||||
me.symbols.TrkBugLCD.setVisible(staPtrVis and dispLCD);
|
me.symbols.TrkBugLCD.setVisible(staPtrVis and dispLCD);
|
||||||
|
@ -511,12 +511,12 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
me.symbols.selHdgLine.setVisible(staPtrVis and hdg_bug_active);
|
me.symbols.selHdgLine.setVisible(staPtrVis and hdg_bug_active);
|
||||||
} else {
|
} else {
|
||||||
me.symbols.trkInd.hide();
|
me.symbols.trkInd.hide();
|
||||||
if((getprop("instrumentation/nav[2]/in-range") and me.get_switch('toggle_lh_vor_adf') == 1)) {
|
if((getprop("instrumentation/nav[2]/in-range") and me.get_switch("toggle_lh_vor_adf") == 1)) {
|
||||||
me.symbols.staArrowL2.setVisible(staPtrVis);
|
me.symbols.staArrowL2.setVisible(staPtrVis);
|
||||||
me.symbols.staFromL2.setColor(0.195,0.96,0.097);
|
me.symbols.staFromL2.setColor(0.195,0.96,0.097);
|
||||||
me.symbols.staToL2.setColor(0.195,0.96,0.097);
|
me.symbols.staToL2.setColor(0.195,0.96,0.097);
|
||||||
me.symbols.staArrowL2.setRotation(nav0hdg*D2R);
|
me.symbols.staArrowL2.setRotation(nav0hdg*D2R);
|
||||||
} elsif(getprop("instrumentation/adf/in-range") and (me.get_switch('toggle_lh_vor_adf') == -1)) {
|
} elsif(getprop("instrumentation/adf/in-range") and (me.get_switch("toggle_lh_vor_adf") == -1)) {
|
||||||
me.symbols.staArrowL2.setVisible(staPtrVis);
|
me.symbols.staArrowL2.setVisible(staPtrVis);
|
||||||
me.symbols.staFromL2.setColor(0,0.6,0.85);
|
me.symbols.staFromL2.setColor(0,0.6,0.85);
|
||||||
me.symbols.staToL2.setColor(0,0.6,0.85);
|
me.symbols.staToL2.setColor(0,0.6,0.85);
|
||||||
|
@ -524,12 +524,12 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
} else {
|
} else {
|
||||||
me.symbols.staArrowL2.hide();
|
me.symbols.staArrowL2.hide();
|
||||||
}
|
}
|
||||||
if((getprop("instrumentation/nav[3]/in-range") and me.get_switch('toggle_rh_vor_adf') == 1)) {
|
if((getprop("instrumentation/nav[3]/in-range") and me.get_switch("toggle_rh_vor_adf") == 1)) {
|
||||||
me.symbols.staArrowR2.setVisible(staPtrVis);
|
me.symbols.staArrowR2.setVisible(staPtrVis);
|
||||||
me.symbols.staFromR2.setColor(0.195,0.96,0.097);
|
me.symbols.staFromR2.setColor(0.195,0.96,0.097);
|
||||||
me.symbols.staToR2.setColor(0.195,0.96,0.097);
|
me.symbols.staToR2.setColor(0.195,0.96,0.097);
|
||||||
me.symbols.staArrowR2.setRotation(nav1hdg*D2R);
|
me.symbols.staArrowR2.setRotation(nav1hdg*D2R);
|
||||||
} elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch('toggle_rh_vor_adf') == -1)) {
|
} elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch("toggle_rh_vor_adf") == -1)) {
|
||||||
me.symbols.staArrowR2.setVisible(staPtrVis);
|
me.symbols.staArrowR2.setVisible(staPtrVis);
|
||||||
me.symbols.staFromR2.setColor(0,0.6,0.85);
|
me.symbols.staFromR2.setColor(0,0.6,0.85);
|
||||||
me.symbols.staToR2.setColor(0,0.6,0.85);
|
me.symbols.staToR2.setColor(0,0.6,0.85);
|
||||||
|
@ -546,7 +546,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
me.symbols.selHdgLine.hide();
|
me.symbols.selHdgLine.hide();
|
||||||
me.symbols.curHdgPtr2.setVisible(staPtrVis);
|
me.symbols.curHdgPtr2.setVisible(staPtrVis);
|
||||||
me.symbols.HdgBugCRT2.setVisible(staPtrVis and !dispLCD);
|
me.symbols.HdgBugCRT2.setVisible(staPtrVis and !dispLCD);
|
||||||
if(me.get_switch('toggle_track_heading'))
|
if(me.get_switch("toggle_track_heading"))
|
||||||
{
|
{
|
||||||
me.symbols.HdgBugLCD2.hide();
|
me.symbols.HdgBugLCD2.hide();
|
||||||
me.symbols.TrkBugLCD2.setVisible(staPtrVis and dispLCD);
|
me.symbols.TrkBugLCD2.setVisible(staPtrVis and dispLCD);
|
||||||
|
@ -560,16 +560,16 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
}
|
}
|
||||||
|
|
||||||
## run all predicates in the NDStyle hash and evaluate their true/false behavior callbacks
|
## run all predicates in the NDStyle hash and evaluate their true/false behavior callbacks
|
||||||
## this is in line with the original design, but normally we don't need to getprop/poll here,
|
## this is in line with the original design, but normally we don"t need to getprop/poll here,
|
||||||
## using listeners or timers would be more canvas-friendly whenever possible
|
## using listeners or timers would be more canvas-friendly whenever possible
|
||||||
## because running setprop() on any group/canvas element at framerate means that the canvas
|
## because running setprop() on any group/canvas element at framerate means that the canvas
|
||||||
## will be updated at frame rate too - wasteful ... (check the performance monitor!)
|
## will be updated at frame rate too - wasteful ... (check the performance monitor!)
|
||||||
|
|
||||||
foreach(var feature; me.nd_style.features ) {
|
foreach(var feature; me.nd_style.features ) {
|
||||||
# for stuff that always needs to be updated
|
# for stuff that always needs to be updated
|
||||||
if (contains(feature.impl, 'common')) feature.impl.common(me);
|
if (contains(feature.impl, "common")) feature.impl.common(me);
|
||||||
# conditional stuff
|
# conditional stuff
|
||||||
if(!contains(feature.impl, 'predicate')) continue; # no conditional stuff
|
if(!contains(feature.impl, "predicate")) continue; # no conditional stuff
|
||||||
if ( var result=feature.impl.predicate(me) )
|
if ( var result=feature.impl.predicate(me) )
|
||||||
feature.impl.is_true(me, result); # pass the result to the predicate
|
feature.impl.is_true(me, result); # pass the result to the predicate
|
||||||
else
|
else
|
||||||
|
@ -578,10 +578,10 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
|
||||||
|
|
||||||
## update the status flags shown on the ND (wxr, wpt, arpt, sta)
|
## update the status flags shown on the ND (wxr, wpt, arpt, sta)
|
||||||
# this could/should be using listeners instead ...
|
# this could/should be using listeners instead ...
|
||||||
me.symbols['status.wxr'].setVisible( me.get_switch('toggle_weather') and me.in_mode('toggle_display_mode', ['MAP']));
|
me.symbols["status.wxr"].setVisible( me.get_switch("toggle_weather") and me.in_mode("toggle_display_mode", ["MAP"]));
|
||||||
me.symbols['status.wpt'].setVisible( me.get_switch('toggle_waypoints') and me.in_mode('toggle_display_mode', ['MAP']));
|
me.symbols["status.wpt"].setVisible( me.get_switch("toggle_waypoints") and me.in_mode("toggle_display_mode", ["MAP"]));
|
||||||
me.symbols['status.arpt'].setVisible( me.get_switch('toggle_airports') and me.in_mode('toggle_display_mode', ['MAP']));
|
me.symbols["status.arpt"].setVisible( me.get_switch("toggle_airports") and me.in_mode("toggle_display_mode", ["MAP"]));
|
||||||
me.symbols['status.sta'].setVisible( me.get_switch('toggle_stations') and me.in_mode('toggle_display_mode', ['MAP']));
|
me.symbols["status.sta"].setVisible( me.get_switch("toggle_stations") and me.in_mode("toggle_display_mode", ["MAP"]));
|
||||||
# Okay, _how_ do we hook this up with FGPlot?
|
# Okay, _how_ do we hook this up with FGPlot?
|
||||||
printlog(_MP_dbg_lvl, "Total ND update took "~((systime()-_time)*100)~"ms");
|
printlog(_MP_dbg_lvl, "Total ND update took "~((systime()-_time)*100)~"ms");
|
||||||
setprop("/instrumentation/navdisplay["~ canvas.NavDisplay.id ~"]/update-ms", systime() - _time);
|
setprop("/instrumentation/navdisplay["~ canvas.NavDisplay.id ~"]/update-ms", systime() - _time);
|
||||||
|
|
|
@ -3,21 +3,21 @@ var SymbolPainter = {
|
||||||
getOpts: func(opts){
|
getOpts: func(opts){
|
||||||
if(opts == nil) opts = {};
|
if(opts == nil) opts = {};
|
||||||
var defOpts = {id:nil,color:nil,scale:1,create_group:0,update_center:0};
|
var defOpts = {id:nil,color:nil,scale:1,create_group:0,update_center:0};
|
||||||
if(contains(opts, 'id'))
|
if(contains(opts, "id"))
|
||||||
defOpts.id = opts.id;
|
defOpts.id = opts.id;
|
||||||
if(contains(opts, 'color'))
|
if(contains(opts, "color"))
|
||||||
defOpts.color = opts.color;
|
defOpts.color = opts.color;
|
||||||
if(contains(opts, 'scale'))
|
if(contains(opts, "scale"))
|
||||||
defOpts.scale = opts.scale;
|
defOpts.scale = opts.scale;
|
||||||
if(contains(opts, 'create_group'))
|
if(contains(opts, "create_group"))
|
||||||
defOpts.create_group = opts.create_group;
|
defOpts.create_group = opts.create_group;
|
||||||
if(contains(opts, 'update_center'))
|
if(contains(opts, "update_center"))
|
||||||
defOpts.update_center = opts.update_center;
|
defOpts.update_center = opts.update_center;
|
||||||
return defOpts;
|
return defOpts;
|
||||||
},
|
},
|
||||||
getAircraftDir: func(){
|
getAircraftDir: func(){
|
||||||
if(me.aircraft_dir == nil)
|
if(me.aircraft_dir == nil)
|
||||||
me.aircraft_dir = split('/', getprop("/sim/aircraft-dir"))[-1];
|
me.aircraft_dir = split("/", getprop("/sim/aircraft-dir"))[-1];
|
||||||
return me.aircraft_dir;
|
return me.aircraft_dir;
|
||||||
},
|
},
|
||||||
svgPath: func(file){
|
svgPath: func(file){
|
||||||
|
@ -60,16 +60,16 @@ var SymbolPainter = {
|
||||||
else
|
else
|
||||||
grp = grp.createChild("group");
|
grp = grp.createChild("group");
|
||||||
}
|
}
|
||||||
var svg_path = me.svgPath('airbus_vor.svg');
|
var svg_path = me.svgPath("airbus_vor.svg");
|
||||||
canvas.parsesvg(grp, svg_path);
|
canvas.parsesvg(grp, svg_path);
|
||||||
var scale = opts.scale;
|
var scale = opts.scale;
|
||||||
if(scale == nil) scale = 0.8;
|
if(scale == nil) scale = 0.8;
|
||||||
grp.setScale(scale,scale);
|
grp.setScale(scale,scale);
|
||||||
if(opts.update_center)
|
if(opts.update_center)
|
||||||
grp.setTranslation(-24 * scale,-24 * scale);
|
grp.setTranslation(-24 * scale,-24 * scale);
|
||||||
if(!contains(grp, 'setColor')){
|
if(!contains(grp, "setColor")){
|
||||||
grp.setColor = func {
|
grp.setColor = func {
|
||||||
var layer1 = grp.getElementById('layer1');
|
var layer1 = grp.getElementById("layer1");
|
||||||
if(layer1 == nil) return;
|
if(layer1 == nil) return;
|
||||||
var children = layer1.getChildren();
|
var children = layer1.getChildren();
|
||||||
foreach(var c; children){
|
foreach(var c; children){
|
||||||
|
@ -117,7 +117,7 @@ var SymbolPainter = {
|
||||||
else
|
else
|
||||||
grp = grp.createChild("group");
|
grp = grp.createChild("group");
|
||||||
}
|
}
|
||||||
var svg_path = me.svgPath('airbus_airport.svg');
|
var svg_path = me.svgPath("airbus_airport.svg");
|
||||||
canvas.parsesvg(grp, svg_path);
|
canvas.parsesvg(grp, svg_path);
|
||||||
var scale = opts.scale;
|
var scale = opts.scale;
|
||||||
if(scale == nil) scale = 0.8;
|
if(scale == nil) scale = 0.8;
|
||||||
|
@ -127,11 +127,11 @@ var SymbolPainter = {
|
||||||
return grp;
|
return grp;
|
||||||
},
|
},
|
||||||
draw: func(type, grp, opts = nil){
|
draw: func(type, grp, opts = nil){
|
||||||
if(type == 'VOR' or type == 'vor')
|
if(type == "VOR" or type == "vor")
|
||||||
return me.drawVOR(grp, opts);
|
return me.drawVOR(grp, opts);
|
||||||
elsif(type == 'NDB' or type == 'ndb')
|
elsif(type == "NDB" or type == "ndb")
|
||||||
return me.drawNDB(grp, opts);
|
return me.drawNDB(grp, opts);
|
||||||
elsif(type == 'ARPT' or type == 'arpt')
|
elsif(type == "ARPT" or type == "arpt")
|
||||||
return me.drawAirport(grp, opts);
|
return me.drawAirport(grp, opts);
|
||||||
else
|
else
|
||||||
return me.drawFIX(grp, opts);
|
return me.drawFIX(grp, opts);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var version = getprop('sim/version/flightgear');
|
var version = getprop("sim/version/flightgear");
|
||||||
var v = split('.', version);
|
var v = split(".", version);
|
||||||
version = num(v[0]~'.'~v[1]);
|
version = num(v[0]~"."~v[1]);
|
||||||
|
|
||||||
setlistener("/nasal/canvas/loaded", func() {
|
setlistener("/nasal/canvas/loaded", func() {
|
||||||
|
|
||||||
|
@ -40,14 +40,14 @@ setlistener("/nasal/canvas/loaded", func() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var load_deps = func(name) {
|
var load_deps = func(name) {
|
||||||
print('Loading MapStructure Layer: '~ name);
|
print("Loading MapStructure Layer: "~ name);
|
||||||
load(aircraft_root~"/Models/Instruments/ND/map/"~name~".lcontroller", name);
|
load(aircraft_root~"/Models/Instruments/ND/map/"~name~".lcontroller", name);
|
||||||
load(aircraft_root~"/Models/Instruments/ND/map/"~name~".symbol", name);
|
load(aircraft_root~"/Models/Instruments/ND/map/"~name~".symbol", name);
|
||||||
if(version < 3.2)
|
if(version < 3.2)
|
||||||
load(aircraft_root~"/Models/Instruments/ND/map/"~name~".scontroller", name);
|
load(aircraft_root~"/Models/Instruments/ND/map/"~name~".scontroller", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#foreach( var name; ['APS','ALT-profile','SPD-profile','RTE','WPT','DECEL','NDB'] )
|
#foreach( var name; ["APS","ALT-profile","SPD-profile","RTE","WPT","DECEL","NDB"] )
|
||||||
#load_deps( name );
|
#load_deps( name );
|
||||||
var dep_names = [
|
var dep_names = [
|
||||||
# With these extensions, in this order:
|
# With these extensions, in this order:
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -7,32 +7,11 @@
|
||||||
|
|
||||||
var PFD_1 = nil;
|
var PFD_1 = nil;
|
||||||
var PFD_2 = nil;
|
var PFD_2 = nil;
|
||||||
|
var PFD_1_test = nil;
|
||||||
|
var PFD_2_test = nil;
|
||||||
var PFD1_display = nil;
|
var PFD1_display = nil;
|
||||||
var PFD2_display = nil;
|
var PFD2_display = nil;
|
||||||
setprop("/instrumentation/pfd/vs-needle", 0);
|
var elapsedtime = 0;
|
||||||
setprop("/instrumentation/pfd/vs-digit-trans", 0);
|
|
||||||
setprop("/it-autoflight/input/spd-managed", 0);
|
|
||||||
setprop("/FMGC/internal/target-ias-pfd", 0);
|
|
||||||
setprop("/it-autoflight/output/ap1", 0);
|
|
||||||
setprop("/it-autoflight/output/ap2", 0);
|
|
||||||
setprop("/it-autoflight/output/fd1", 0);
|
|
||||||
setprop("/it-autoflight/output/fd2", 0);
|
|
||||||
setprop("/it-autoflight/output/athr", 0);
|
|
||||||
setprop("/instrumentation/pfd/alt-diff", 0);
|
|
||||||
setprop("/instrumentation/pfd/heading-deg", 0);
|
|
||||||
setprop("/instrumentation/pfd/horizon-pitch", 0);
|
|
||||||
setprop("/instrumentation/pfd/horizon-ground", 0);
|
|
||||||
setprop("/instrumentation/pfd/hdg-diff", 0);
|
|
||||||
setprop("/instrumentation/pfd/heading-scale", 0);
|
|
||||||
setprop("/instrumentation/pfd/track-deg", 0);
|
|
||||||
setprop("/instrumentation/pfd/track-hdg-diff", 0);
|
|
||||||
setprop("/it-autoflight/internal/vert-speed-fpm-pfd", 0);
|
|
||||||
setprop("/position/gear-agl-ft", 0);
|
|
||||||
setprop("/controls/flight/aileron-input-fast", 0);
|
|
||||||
setprop("/controls/flight/elevator-input-fast", 0);
|
|
||||||
setprop("/instrumentation/adirs/ir[0]/aligned", 0);
|
|
||||||
setprop("/instrumentation/adirs/ir[1]/aligned", 0);
|
|
||||||
setprop("/instrumentation/adirs/ir[2]/aligned", 0);
|
|
||||||
var ASI = 0;
|
var ASI = 0;
|
||||||
var ASItrgt = 0;
|
var ASItrgt = 0;
|
||||||
var ASItrgtdiff = 0;
|
var ASItrgtdiff = 0;
|
||||||
|
@ -60,6 +39,34 @@ var wow2 = getprop("/gear/gear[2]/wow");
|
||||||
var pitch = 0;
|
var pitch = 0;
|
||||||
var roll = 0;
|
var roll = 0;
|
||||||
var spdTrend_c = 0;
|
var spdTrend_c = 0;
|
||||||
|
setprop("/instrumentation/pfd/vs-needle", 0);
|
||||||
|
setprop("/instrumentation/pfd/vs-digit-trans", 0);
|
||||||
|
setprop("/it-autoflight/input/spd-managed", 0);
|
||||||
|
setprop("/FMGC/internal/target-ias-pfd", 0);
|
||||||
|
setprop("/it-autoflight/output/ap1", 0);
|
||||||
|
setprop("/it-autoflight/output/ap2", 0);
|
||||||
|
setprop("/it-autoflight/output/fd1", 0);
|
||||||
|
setprop("/it-autoflight/output/fd2", 0);
|
||||||
|
setprop("/it-autoflight/output/athr", 0);
|
||||||
|
setprop("/instrumentation/pfd/alt-diff", 0);
|
||||||
|
setprop("/instrumentation/pfd/heading-deg", 0);
|
||||||
|
setprop("/instrumentation/pfd/horizon-pitch", 0);
|
||||||
|
setprop("/instrumentation/pfd/horizon-ground", 0);
|
||||||
|
setprop("/instrumentation/pfd/hdg-diff", 0);
|
||||||
|
setprop("/instrumentation/pfd/heading-scale", 0);
|
||||||
|
setprop("/instrumentation/pfd/track-deg", 0);
|
||||||
|
setprop("/instrumentation/pfd/track-hdg-diff", 0);
|
||||||
|
setprop("/instrumentation/du/du1-test", 0);
|
||||||
|
setprop("/instrumentation/du/du1-test-time", 0);
|
||||||
|
setprop("/instrumentation/du/du6-test", 0);
|
||||||
|
setprop("/instrumentation/du/du6-test-time", 0);
|
||||||
|
setprop("/it-autoflight/internal/vert-speed-fpm-pfd", 0);
|
||||||
|
setprop("/position/gear-agl-ft", 0);
|
||||||
|
setprop("/controls/flight/aileron-input-fast", 0);
|
||||||
|
setprop("/controls/flight/elevator-input-fast", 0);
|
||||||
|
setprop("/instrumentation/adirs/ir[0]/aligned", 0);
|
||||||
|
setprop("/instrumentation/adirs/ir[1]/aligned", 0);
|
||||||
|
setprop("/instrumentation/adirs/ir[2]/aligned", 0);
|
||||||
|
|
||||||
var canvas_PFD_base = {
|
var canvas_PFD_base = {
|
||||||
init: func(canvas_group, file) {
|
init: func(canvas_group, file) {
|
||||||
|
@ -67,7 +74,7 @@ var canvas_PFD_base = {
|
||||||
return "LiberationFonts/LiberationSans-Regular.ttf";
|
return "LiberationFonts/LiberationSans-Regular.ttf";
|
||||||
};
|
};
|
||||||
|
|
||||||
canvas.parsesvg(canvas_group, file, {'font-mapper': font_mapper});
|
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
|
||||||
|
|
||||||
var svg_keys = me.getKeys();
|
var svg_keys = me.getKeys();
|
||||||
foreach(var key; svg_keys) {
|
foreach(var key; svg_keys) {
|
||||||
|
@ -93,8 +100,6 @@ var canvas_PFD_base = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
me.page = canvas_group;
|
|
||||||
|
|
||||||
me.AI_horizon_trans = me["AI_horizon"].createTransform();
|
me.AI_horizon_trans = me["AI_horizon"].createTransform();
|
||||||
me.AI_horizon_rot = me["AI_horizon"].createTransform();
|
me.AI_horizon_rot = me["AI_horizon"].createTransform();
|
||||||
|
@ -107,6 +112,8 @@ var canvas_PFD_base = {
|
||||||
me.AI_horizon_hdg_trans = me["AI_heading"].createTransform();
|
me.AI_horizon_hdg_trans = me["AI_heading"].createTransform();
|
||||||
me.AI_horizon_hdg_rot = me["AI_heading"].createTransform();
|
me.AI_horizon_hdg_rot = me["AI_heading"].createTransform();
|
||||||
|
|
||||||
|
me.page = canvas_group;
|
||||||
|
|
||||||
return me;
|
return me;
|
||||||
},
|
},
|
||||||
getKeys: func() {
|
getKeys: func() {
|
||||||
|
@ -118,17 +125,54 @@ var canvas_PFD_base = {
|
||||||
"GS_pointer","CRS_pointer","HDG_target","HDG_scale","HDG_one","HDG_two","HDG_three","HDG_four","HDG_five","HDG_six","HDG_seven","HDG_digit_L","HDG_digit_R","HDG_error","HDG_group","HDG_frame","TRK_pointer"];
|
"GS_pointer","CRS_pointer","HDG_target","HDG_scale","HDG_one","HDG_two","HDG_three","HDG_four","HDG_five","HDG_six","HDG_seven","HDG_digit_L","HDG_digit_R","HDG_error","HDG_group","HDG_frame","TRK_pointer"];
|
||||||
},
|
},
|
||||||
update: func() {
|
update: func() {
|
||||||
if ((getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110) and getprop("/controls/lighting/DU/du1") > 0) {
|
elapsedtime = getprop("/sim/time/elapsed-sec");
|
||||||
PFD_1.page.show();
|
if (getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110) {
|
||||||
PFD_1.update();
|
if (getprop("/instrumentation/du/du1-test") != 1) {
|
||||||
|
setprop("/instrumentation/du/du1-test", 1);
|
||||||
|
setprop("/instrumentation/du/du1-test-time", getprop("/sim/time/elapsed-sec"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
PFD_1.page.hide();
|
setprop("/instrumentation/du/du1-test", 0);
|
||||||
|
}
|
||||||
|
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/bus/ac2") >= 110) {
|
||||||
|
if (getprop("/instrumentation/du/du6-test") != 1) {
|
||||||
|
setprop("/instrumentation/du/du6-test", 1);
|
||||||
|
setprop("/instrumentation/du/du6-test-time", getprop("/sim/time/elapsed-sec"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setprop("/instrumentation/du/du6-test", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du6") > 0) {
|
if ((getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110) and getprop("/controls/lighting/DU/du1") > 0) {
|
||||||
PFD_2.page.show();
|
if (getprop("/instrumentation/du/du1-test-time") + 39.5 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) {
|
||||||
PFD_2.update();
|
PFD_1.page.hide();
|
||||||
|
PFD_1_test.page.show();
|
||||||
|
} else if (getprop("/instrumentation/du/du2-test-time") + 38.5 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) {
|
||||||
|
PFD_1.page.hide();
|
||||||
|
PFD_1_test.page.show();
|
||||||
|
} else {
|
||||||
|
PFD_1_test.page.hide();
|
||||||
|
PFD_1.page.show();
|
||||||
|
PFD_1.update();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
PFD_1_test.page.hide();
|
||||||
|
PFD_1.page.hide();
|
||||||
|
}
|
||||||
|
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du6") > 0) {
|
||||||
|
if (getprop("/instrumentation/du/du6-test-time") + 39.5 >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) {
|
||||||
|
PFD_2.page.hide();
|
||||||
|
PFD_2_test.page.show();
|
||||||
|
} else if (getprop("/instrumentation/du/du5-test-time") + 38.5 >= elapsedtime and getprop("/modes/fo-du-xfr") == 1) {
|
||||||
|
PFD_2.page.hide();
|
||||||
|
PFD_2_test.page.show();
|
||||||
|
} else {
|
||||||
|
PFD_2_test.page.hide();
|
||||||
|
PFD_2.page.show();
|
||||||
|
PFD_2.update();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PFD_2_test.page.hide();
|
||||||
PFD_2.page.hide();
|
PFD_2.page.hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -359,7 +403,7 @@ var canvas_PFD_base = {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Airspeed
|
# Airspeed
|
||||||
# Subtract 30, since the scale starts at 30, but don't allow less than 0, or more than 420 situations
|
# Subtract 30, since the scale starts at 30, but don"t allow less than 0, or more than 420 situations
|
||||||
if (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") <= 30) {
|
if (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") <= 30) {
|
||||||
ASI = 0;
|
ASI = 0;
|
||||||
} else if (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") >= 420) {
|
} else if (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") >= 420) {
|
||||||
|
@ -844,6 +888,46 @@ var canvas_PFD_2 = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var canvas_PFD_1_test = {
|
||||||
|
init: func(canvas_group, file) {
|
||||||
|
var font_mapper = func(family, weight) {
|
||||||
|
return "LiberationFonts/LiberationSans-Regular.ttf";
|
||||||
|
};
|
||||||
|
|
||||||
|
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
|
||||||
|
|
||||||
|
me.page = canvas_group;
|
||||||
|
|
||||||
|
return me;
|
||||||
|
},
|
||||||
|
new: func(canvas_group, file) {
|
||||||
|
var m = {parents: [canvas_PFD_1_test]};
|
||||||
|
m.init(canvas_group, file);
|
||||||
|
|
||||||
|
return m;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
var canvas_PFD_2_test = {
|
||||||
|
init: func(canvas_group, file) {
|
||||||
|
var font_mapper = func(family, weight) {
|
||||||
|
return "LiberationFonts/LiberationSans-Regular.ttf";
|
||||||
|
};
|
||||||
|
|
||||||
|
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
|
||||||
|
|
||||||
|
me.page = canvas_group;
|
||||||
|
|
||||||
|
return me;
|
||||||
|
},
|
||||||
|
new: func(canvas_group, file) {
|
||||||
|
var m = {parents: [canvas_PFD_2_test]};
|
||||||
|
m.init(canvas_group, file);
|
||||||
|
|
||||||
|
return m;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
setprop("/testing", 0); # REMOVE WHEN PFD FINISHED
|
setprop("/testing", 0); # REMOVE WHEN PFD FINISHED
|
||||||
|
|
||||||
setlistener("sim/signals/fdm-initialized", func {
|
setlistener("sim/signals/fdm-initialized", func {
|
||||||
|
@ -862,10 +946,14 @@ setlistener("sim/signals/fdm-initialized", func {
|
||||||
PFD1_display.addPlacement({"node": "pfd1.screen"});
|
PFD1_display.addPlacement({"node": "pfd1.screen"});
|
||||||
PFD2_display.addPlacement({"node": "pfd2.screen"});
|
PFD2_display.addPlacement({"node": "pfd2.screen"});
|
||||||
var group_pfd1 = PFD1_display.createGroup();
|
var group_pfd1 = PFD1_display.createGroup();
|
||||||
|
var group_pfd1_test = PFD1_display.createGroup();
|
||||||
var group_pfd2 = PFD2_display.createGroup();
|
var group_pfd2 = PFD2_display.createGroup();
|
||||||
|
var group_pfd2_test = PFD2_display.createGroup();
|
||||||
|
|
||||||
PFD_1 = canvas_PFD_1.new(group_pfd1, "Aircraft/IDG-A32X/Models/Instruments/PFD/res/pfd.svg");
|
PFD_1 = canvas_PFD_1.new(group_pfd1, "Aircraft/IDG-A32X/Models/Instruments/PFD/res/pfd.svg");
|
||||||
|
PFD_1_test = canvas_PFD_1_test.new(group_pfd1_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg");
|
||||||
PFD_2 = canvas_PFD_2.new(group_pfd2, "Aircraft/IDG-A32X/Models/Instruments/PFD/res/pfd.svg");
|
PFD_2 = canvas_PFD_2.new(group_pfd2, "Aircraft/IDG-A32X/Models/Instruments/PFD/res/pfd.svg");
|
||||||
|
PFD_2_test = canvas_PFD_2_test.new(group_pfd2_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg");
|
||||||
|
|
||||||
PFD_update.start();
|
PFD_update.start();
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
|
|
||||||
var upperECAM_cfm_eis2 = nil;
|
var upperECAM_cfm_eis2 = nil;
|
||||||
var upperECAM_iae_eis2 = nil;
|
var upperECAM_iae_eis2 = nil;
|
||||||
|
var upperECAM_test = nil;
|
||||||
var upperECAM_display = nil;
|
var upperECAM_display = nil;
|
||||||
|
var elapsedtime = 0;
|
||||||
setprop("/engines/engine[0]/fuel-flow_actual", 0);
|
setprop("/engines/engine[0]/fuel-flow_actual", 0);
|
||||||
setprop("/engines/engine[1]/fuel-flow_actual", 0);
|
setprop("/engines/engine[1]/fuel-flow_actual", 0);
|
||||||
setprop("/ECAM/Upper/EPR[0]", 0);
|
setprop("/ECAM/Upper/EPR[0]", 0);
|
||||||
|
@ -22,6 +24,8 @@ setprop("/ECAM/Upper/N1[1]", 0);
|
||||||
setprop("/ECAM/Upper/N1thr[0]", 0);
|
setprop("/ECAM/Upper/N1thr[0]", 0);
|
||||||
setprop("/ECAM/Upper/N1thr[1]", 0);
|
setprop("/ECAM/Upper/N1thr[1]", 0);
|
||||||
setprop("/ECAM/Upper/N1ylim", 0);
|
setprop("/ECAM/Upper/N1ylim", 0);
|
||||||
|
setprop("/instrumentation/du/du3-test", 0);
|
||||||
|
setprop("/instrumentation/du/du3-test-time", 0);
|
||||||
|
|
||||||
var canvas_upperECAM_base = {
|
var canvas_upperECAM_base = {
|
||||||
init: func(canvas_group, file) {
|
init: func(canvas_group, file) {
|
||||||
|
@ -29,7 +33,7 @@ var canvas_upperECAM_base = {
|
||||||
return "LiberationFonts/LiberationSans-Regular.ttf";
|
return "LiberationFonts/LiberationSans-Regular.ttf";
|
||||||
};
|
};
|
||||||
|
|
||||||
canvas.parsesvg(canvas_group, file, {'font-mapper': font_mapper});
|
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
|
||||||
|
|
||||||
var svg_keys = me.getKeys();
|
var svg_keys = me.getKeys();
|
||||||
foreach(var key; svg_keys) {
|
foreach(var key; svg_keys) {
|
||||||
|
@ -44,17 +48,35 @@ var canvas_upperECAM_base = {
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
update: func() {
|
update: func() {
|
||||||
if (getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du3") > 0) {
|
elapsedtime = getprop("/sim/time/elapsed-sec");
|
||||||
if (getprop("/options/eng") == "CFM") {
|
if (getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110) {
|
||||||
upperECAM_cfm_eis2.page.show();
|
if (getprop("/instrumentation/du/du3-test") != 1) {
|
||||||
upperECAM_iae_eis2.page.hide();
|
setprop("/instrumentation/du/du3-test", 1);
|
||||||
upperECAM_cfm_eis2.update();
|
setprop("/instrumentation/du/du3-test-time", getprop("/sim/time/elapsed-sec"));
|
||||||
} else if (getprop("/options/eng") == "IAE") {
|
|
||||||
upperECAM_cfm_eis2.page.hide();
|
|
||||||
upperECAM_iae_eis2.page.show();
|
|
||||||
upperECAM_iae_eis2.update();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
setprop("/instrumentation/du/du3-test", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du3") > 0) {
|
||||||
|
if (getprop("/instrumentation/du/du3-test-time") + 39 >= elapsedtime) {
|
||||||
|
upperECAM_cfm_eis2.page.hide();
|
||||||
|
upperECAM_iae_eis2.page.hide();
|
||||||
|
upperECAM_test.page.show();
|
||||||
|
} else {
|
||||||
|
upperECAM_test.page.hide();
|
||||||
|
if (getprop("/options/eng") == "CFM") {
|
||||||
|
upperECAM_cfm_eis2.page.show();
|
||||||
|
upperECAM_iae_eis2.page.hide();
|
||||||
|
upperECAM_cfm_eis2.update();
|
||||||
|
} else if (getprop("/options/eng") == "IAE") {
|
||||||
|
upperECAM_cfm_eis2.page.hide();
|
||||||
|
upperECAM_iae_eis2.page.show();
|
||||||
|
upperECAM_iae_eis2.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
upperECAM_test.page.hide();
|
||||||
upperECAM_cfm_eis2.page.hide();
|
upperECAM_cfm_eis2.page.hide();
|
||||||
upperECAM_iae_eis2.page.hide();
|
upperECAM_iae_eis2.page.hide();
|
||||||
}
|
}
|
||||||
|
@ -713,6 +735,26 @@ var canvas_upperECAM_iae_eis2 = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var canvas_upperECAM_test = {
|
||||||
|
init: func(canvas_group, file) {
|
||||||
|
var font_mapper = func(family, weight) {
|
||||||
|
return "LiberationFonts/LiberationSans-Regular.ttf";
|
||||||
|
};
|
||||||
|
|
||||||
|
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
|
||||||
|
|
||||||
|
me.page = canvas_group;
|
||||||
|
|
||||||
|
return me;
|
||||||
|
},
|
||||||
|
new: func(canvas_group, file) {
|
||||||
|
var m = {parents: [canvas_upperECAM_test]};
|
||||||
|
m.init(canvas_group, file);
|
||||||
|
|
||||||
|
return m;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
setlistener("sim/signals/fdm-initialized", func {
|
setlistener("sim/signals/fdm-initialized", func {
|
||||||
upperECAM_display = canvas.new({
|
upperECAM_display = canvas.new({
|
||||||
"name": "upperECAM",
|
"name": "upperECAM",
|
||||||
|
@ -723,9 +765,11 @@ setlistener("sim/signals/fdm-initialized", func {
|
||||||
upperECAM_display.addPlacement({"node": "uecam.screen"});
|
upperECAM_display.addPlacement({"node": "uecam.screen"});
|
||||||
var group_cfm_eis2 = upperECAM_display.createGroup();
|
var group_cfm_eis2 = upperECAM_display.createGroup();
|
||||||
var group_iae_eis2 = upperECAM_display.createGroup();
|
var group_iae_eis2 = upperECAM_display.createGroup();
|
||||||
|
var group_test = upperECAM_display.createGroup();
|
||||||
|
|
||||||
upperECAM_cfm_eis2 = canvas_upperECAM_cfm_eis2.new(group_cfm_eis2, "Aircraft/IDG-A32X/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg");
|
upperECAM_cfm_eis2 = canvas_upperECAM_cfm_eis2.new(group_cfm_eis2, "Aircraft/IDG-A32X/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg");
|
||||||
upperECAM_iae_eis2 = canvas_upperECAM_iae_eis2.new(group_iae_eis2, "Aircraft/IDG-A32X/Models/Instruments/Upper-ECAM/res/iae-eis2.svg");
|
upperECAM_iae_eis2 = canvas_upperECAM_iae_eis2.new(group_iae_eis2, "Aircraft/IDG-A32X/Models/Instruments/Upper-ECAM/res/iae-eis2.svg");
|
||||||
|
upperECAM_test = canvas_upperECAM_test.new(group_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg");
|
||||||
|
|
||||||
upperECAM_update.start();
|
upperECAM_update.start();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
4020
|
4022
|
Reference in a new issue