2017-11-20 06:10:59 +00:00
|
|
|
# A3XX ND Canvas
|
|
|
|
|
2018-12-20 01:55:02 +00:00
|
|
|
# Copyright (c) 2018 Joshua Davidson (it0uchpods)
|
2017-11-20 06:10:59 +00:00
|
|
|
|
2017-11-20 22:03:07 +00:00
|
|
|
io.include("A3XX_ND.nas");
|
2017-06-19 00:14:41 +00:00
|
|
|
|
2017-11-20 22:03:07 +00:00
|
|
|
io.include("A3XX_ND_drivers.nas");
|
|
|
|
canvas.NDStyles["Airbus"].options.defaults.route_driver = A3XXRouteDriver.new();
|
2017-06-19 00:14:41 +00:00
|
|
|
|
2017-11-20 22:03:07 +00:00
|
|
|
var ND_1 = nil;
|
|
|
|
var ND_2 = nil;
|
|
|
|
var ND_1_test = nil;
|
|
|
|
var ND_2_test = nil;
|
|
|
|
var elapsedtime = 0;
|
2018-09-23 15:41:32 +00:00
|
|
|
|
|
|
|
# Fetch nodes:
|
|
|
|
var du1_test = props.globals.getNode("/instrumentation/du/du1-test");
|
|
|
|
var du1_test_time = props.globals.getNode("/instrumentation/du/du1-test-time");
|
|
|
|
var du1_test_amount = props.globals.getNode("/instrumentation/du/du1-test-amount");
|
|
|
|
var du2_test = props.globals.getNode("/instrumentation/du/du2-test");
|
|
|
|
var du2_test_time = props.globals.getNode("/instrumentation/du/du2-test-time");
|
|
|
|
var du2_test_amount = props.globals.getNode("/instrumentation/du/du2-test-amount");
|
|
|
|
var du5_test = props.globals.getNode("/instrumentation/du/du5-test");
|
|
|
|
var du5_test_time = props.globals.getNode("/instrumentation/du/du5-test-time");
|
|
|
|
var du5_test_amount = props.globals.getNode("/instrumentation/du/du5-test-amount");
|
|
|
|
var du6_test = props.globals.getNode("/instrumentation/du/du6-test");
|
|
|
|
var du6_test_time = props.globals.getNode("/instrumentation/du/du6-test-time");
|
|
|
|
var du6_test_amount = props.globals.getNode("/instrumentation/du/du6-test-amount");
|
2018-09-20 17:50:33 +00:00
|
|
|
var cpt_du_xfr = props.globals.getNode("/modes/cpt-du-xfr");
|
|
|
|
var fo_du_xfr = props.globals.getNode("/modes/fo-du-xfr");
|
2018-09-23 15:41:32 +00:00
|
|
|
var wow0 = props.globals.getNode("/gear/gear[0]/wow");
|
2017-11-20 06:10:59 +00:00
|
|
|
|
2017-06-19 00:14:41 +00:00
|
|
|
var nd_display = {};
|
|
|
|
|
2017-11-20 06:10:59 +00:00
|
|
|
var ND = canvas.NavDisplay;
|
|
|
|
|
|
|
|
var myCockpit_switches = {
|
2017-11-20 22:03:07 +00:00
|
|
|
"toggle_range": {path: "/inputs/range-nm", value:40, type:"INT"},
|
|
|
|
"toggle_weather": {path: "/inputs/wxr", value:0, type:"BOOL"},
|
|
|
|
"toggle_airports": {path: "/inputs/arpt", value:0, type:"BOOL"},
|
|
|
|
"toggle_ndb": {path: "/inputs/NDB", value:0, type:"BOOL"},
|
|
|
|
"toggle_stations": {path: "/inputs/sta", value:0, type:"BOOL"},
|
|
|
|
"toggle_vor": {path: "/inputs/VORD", value:0, type:"BOOL"},
|
|
|
|
"toggle_dme": {path: "/inputs/DME", value:0, type:"BOOL"},
|
|
|
|
"toggle_cstr": {path: "/inputs/CSTR", value:0, type:"BOOL"},
|
|
|
|
"toggle_waypoints": {path: "/inputs/wpt", value:0, type:"BOOL"},
|
|
|
|
"toggle_position": {path: "/inputs/pos", value:0, type:"BOOL"},
|
|
|
|
"toggle_data": {path: "/inputs/data",value:0, type:"BOOL"},
|
|
|
|
"toggle_terrain": {path: "/inputs/terr",value:0, type:"BOOL"},
|
|
|
|
"toggle_traffic": {path: "/inputs/tfc",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_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_type": {path: "/nd/display-type", value:"LCD", type:"STRING"},
|
|
|
|
"toggle_true_north": {path: "/nd/true-north", 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_plan_loop": {path: "/nd/plan-mode-loop", value: 0, type: "INT"},
|
|
|
|
"toggle_weather_live": {path: "/nd/wxr-live-enabled", value: 0, type: "BOOL"},
|
|
|
|
"toggle_chrono": {path: "/inputs/CHRONO", value: 0, type: "INT"},
|
|
|
|
"toggle_xtrk_error": {path: "/nd/xtrk-error", value: 0, type: "BOOL"},
|
|
|
|
"toggle_trk_line": {path: "/nd/trk-line", value: 0, type: "BOOL"},
|
2017-11-20 06:10:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
var canvas_nd_base = {
|
|
|
|
init: func(canvas_group, file = nil) {
|
|
|
|
var font_mapper = func(family, weight) {
|
|
|
|
return "LiberationFonts/LiberationSans-Regular.ttf";
|
|
|
|
};
|
|
|
|
|
|
|
|
if (file != nil) {
|
2017-11-20 22:03:07 +00:00
|
|
|
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
|
2017-11-20 06:10:59 +00:00
|
|
|
|
|
|
|
var svg_keys = me.getKeys();
|
|
|
|
foreach(var key; svg_keys) {
|
|
|
|
me[key] = canvas_group.getElementById(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
me.page = canvas_group;
|
|
|
|
|
|
|
|
return me;
|
|
|
|
},
|
|
|
|
getKeys: func() {
|
|
|
|
return [];
|
|
|
|
},
|
|
|
|
update: func() {
|
2017-11-20 22:03:07 +00:00
|
|
|
elapsedtime = getprop("/sim/time/elapsed-sec");
|
2017-12-15 15:06:23 +00:00
|
|
|
if (getprop("/systems/electrical/bus/ac-ess-shed") >= 110) {
|
2018-09-23 15:41:32 +00:00
|
|
|
if (wow0.getValue() == 1) {
|
|
|
|
if (getprop("/systems/acconfig/autoconfig-running") != 1 and du2_test.getValue() != 1) {
|
|
|
|
du2_test.setValue(1);
|
|
|
|
du2_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1));
|
|
|
|
du2_test_time.setValue(getprop("/sim/time/elapsed-sec"));
|
|
|
|
} else if (getprop("/systems/acconfig/autoconfig-running") == 1 and du2_test.getValue() != 1) {
|
|
|
|
du2_test.setValue(1);
|
|
|
|
du2_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1));
|
|
|
|
du2_test_time.setValue(getprop("/sim/time/elapsed-sec") - 30);
|
|
|
|
}
|
|
|
|
} else {
|
2018-09-20 17:50:33 +00:00
|
|
|
du2_test.setValue(1);
|
2018-09-23 15:41:32 +00:00
|
|
|
du2_test_amount.setValue(0);
|
|
|
|
du2_test_time.setValue(-100);
|
2017-11-20 22:03:07 +00:00
|
|
|
}
|
2017-12-15 15:06:23 +00:00
|
|
|
} else {
|
2018-09-20 17:50:33 +00:00
|
|
|
du2_test.setValue(0);
|
2017-12-15 15:06:23 +00:00
|
|
|
}
|
|
|
|
if (getprop("/systems/electrical/bus/ac2") >= 110) {
|
2018-09-23 15:41:32 +00:00
|
|
|
if (wow0.getValue() == 1) {
|
|
|
|
if (getprop("/systems/acconfig/autoconfig-running") != 1 and du5_test.getValue() != 1) {
|
|
|
|
du5_test.setValue(1);
|
|
|
|
du5_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1));
|
|
|
|
du5_test_time.setValue(getprop("/sim/time/elapsed-sec"));
|
|
|
|
} else if (getprop("/systems/acconfig/autoconfig-running") == 1 and du5_test.getValue() != 1) {
|
|
|
|
du5_test.setValue(1);
|
|
|
|
du5_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1));
|
|
|
|
du5_test_time.setValue(getprop("/sim/time/elapsed-sec") - 30);
|
|
|
|
}
|
|
|
|
} else {
|
2018-09-20 17:50:33 +00:00
|
|
|
du5_test.setValue(1);
|
2018-09-23 15:41:32 +00:00
|
|
|
du5_test_amount.setValue(0);
|
|
|
|
du5_test_time.setValue(-100);
|
2017-11-20 22:03:07 +00:00
|
|
|
}
|
|
|
|
} else {
|
2018-09-20 17:50:33 +00:00
|
|
|
du5_test.setValue(0);
|
2017-11-20 22:03:07 +00:00
|
|
|
}
|
|
|
|
|
2017-12-15 15:06:23 +00:00
|
|
|
if (getprop("/systems/electrical/bus/ac-ess-shed") >= 110 and getprop("/controls/lighting/DU/du2") > 0) {
|
2018-09-20 17:50:33 +00:00
|
|
|
if (du2_test_time.getValue() + du2_test_amount.getValue() >= elapsedtime and cpt_du_xfr.getValue() != 1) {
|
2017-11-20 22:03:07 +00:00
|
|
|
ND_1.page.hide();
|
|
|
|
ND_1_test.page.show();
|
2017-12-31 14:33:53 +00:00
|
|
|
ND_1_test.update();
|
2018-09-20 17:50:33 +00:00
|
|
|
} else if (du1_test_time.getValue() + du1_test_amount.getValue() >= elapsedtime and cpt_du_xfr.getValue() == 1) {
|
2017-11-20 22:03:07 +00:00
|
|
|
ND_1.page.hide();
|
|
|
|
ND_1_test.page.show();
|
2017-12-31 14:33:53 +00:00
|
|
|
ND_1_test.update();
|
2017-11-20 22:03:07 +00:00
|
|
|
} else {
|
|
|
|
ND_1_test.page.hide();
|
|
|
|
ND_1.page.show();
|
|
|
|
ND_1.NDCpt.update();
|
|
|
|
}
|
2017-11-20 06:10:59 +00:00
|
|
|
} else {
|
2017-11-20 22:03:07 +00:00
|
|
|
ND_1_test.page.hide();
|
|
|
|
ND_1.page.hide();
|
2017-11-20 06:10:59 +00:00
|
|
|
}
|
2017-12-15 15:06:23 +00:00
|
|
|
if (getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du5") > 0) {
|
2018-09-20 17:50:33 +00:00
|
|
|
if (du5_test_time.getValue() + du5_test_amount.getValue() >= elapsedtime and fo_du_xfr.getValue() != 1) {
|
2017-11-20 22:03:07 +00:00
|
|
|
ND_2.page.hide();
|
|
|
|
ND_2_test.page.show();
|
2017-12-31 14:33:53 +00:00
|
|
|
ND_2_test.update();
|
2018-09-20 17:50:33 +00:00
|
|
|
} else if (du6_test_time.getValue() + du6_test_amount.getValue() >= elapsedtime and fo_du_xfr.getValue() == 1) {
|
2017-11-20 22:03:07 +00:00
|
|
|
ND_2.page.hide();
|
|
|
|
ND_2_test.page.show();
|
2017-12-31 14:33:53 +00:00
|
|
|
ND_2_test.update();
|
2017-11-20 22:03:07 +00:00
|
|
|
} else {
|
|
|
|
ND_2_test.page.hide();
|
|
|
|
ND_2.page.show();
|
|
|
|
ND_2.NDFo.update();
|
|
|
|
}
|
2017-11-20 06:10:59 +00:00
|
|
|
} else {
|
2017-11-20 22:03:07 +00:00
|
|
|
ND_2_test.page.hide();
|
|
|
|
ND_2.page.hide();
|
2017-11-20 06:10:59 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2017-11-20 22:03:07 +00:00
|
|
|
var canvas_ND_1 = {
|
2017-11-20 06:10:59 +00:00
|
|
|
new: func(canvas_group) {
|
2017-11-20 22:03:07 +00:00
|
|
|
var m = {parents: [canvas_ND_1, canvas_nd_base]};
|
2017-11-20 06:10:59 +00:00
|
|
|
m.init(canvas_group);
|
|
|
|
|
|
|
|
# here we make the ND:
|
2017-11-20 22:03:07 +00:00
|
|
|
me.NDCpt = ND.new("instrumentation/efis", myCockpit_switches, "Airbus");
|
2017-11-20 06:10:59 +00:00
|
|
|
me.NDCpt.newMFD(canvas_group);
|
|
|
|
me.NDCpt.update();
|
|
|
|
|
|
|
|
return m;
|
|
|
|
},
|
|
|
|
getKeys: func() {
|
|
|
|
return [];
|
|
|
|
},
|
|
|
|
update: func() {
|
|
|
|
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2017-11-20 22:03:07 +00:00
|
|
|
var canvas_ND_2 = {
|
2017-11-20 06:10:59 +00:00
|
|
|
new: func(canvas_group) {
|
2017-11-20 22:03:07 +00:00
|
|
|
var m = {parents: [canvas_ND_2, canvas_nd_base]};
|
2017-11-20 06:10:59 +00:00
|
|
|
m.init(canvas_group);
|
|
|
|
|
|
|
|
# here we make the ND:
|
2017-11-20 22:03:07 +00:00
|
|
|
me.NDFo = ND.new("instrumentation/efis[1]", myCockpit_switches, "Airbus");
|
2017-11-20 06:10:59 +00:00
|
|
|
me.NDFo.newMFD(canvas_group);
|
|
|
|
me.NDFo.update();
|
|
|
|
|
|
|
|
return m;
|
|
|
|
},
|
|
|
|
getKeys: func() {
|
|
|
|
return [];
|
|
|
|
},
|
|
|
|
update: func() {
|
|
|
|
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2017-11-20 22:03:07 +00:00
|
|
|
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});
|
2017-12-31 14:33:53 +00:00
|
|
|
|
|
|
|
var svg_keys = me.getKeys();
|
|
|
|
foreach(var key; svg_keys) {
|
|
|
|
me[key] = canvas_group.getElementById(key);
|
|
|
|
}
|
2017-11-20 22:03:07 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
},
|
2017-12-31 14:33:53 +00:00
|
|
|
getKeys: func() {
|
|
|
|
return ["Test_white","Test_text"];
|
|
|
|
},
|
|
|
|
update: func() {
|
2018-09-20 17:50:33 +00:00
|
|
|
elapsedtime = getprop("/sim/time/elapsed-sec") or 0;
|
|
|
|
if ((du2_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 1) {
|
2017-12-31 14:33:53 +00:00
|
|
|
me["Test_white"].show();
|
|
|
|
me["Test_text"].hide();
|
2018-09-20 17:50:33 +00:00
|
|
|
} else if ((du1_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 0) {
|
|
|
|
print(getprop("/modes/cpt-du-xfr"));
|
2017-12-31 14:33:53 +00:00
|
|
|
me["Test_white"].show();
|
|
|
|
me["Test_text"].hide();
|
|
|
|
} else {
|
|
|
|
me["Test_white"].hide();
|
|
|
|
me["Test_text"].show();
|
|
|
|
}
|
|
|
|
},
|
2017-11-20 22:03:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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});
|
2017-12-31 14:33:53 +00:00
|
|
|
|
|
|
|
var svg_keys = me.getKeys();
|
|
|
|
foreach(var key; svg_keys) {
|
|
|
|
me[key] = canvas_group.getElementById(key);
|
|
|
|
}
|
2017-11-20 22:03:07 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
},
|
2017-12-31 14:33:53 +00:00
|
|
|
getKeys: func() {
|
|
|
|
return ["Test_white","Test_text"];
|
|
|
|
},
|
|
|
|
update: func() {
|
2018-09-20 17:50:33 +00:00
|
|
|
elapsedtime = getprop("/sim/time/elapsed-sec") or 0;
|
|
|
|
if ((du5_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 1) {
|
2017-12-31 14:33:53 +00:00
|
|
|
me["Test_white"].show();
|
|
|
|
me["Test_text"].hide();
|
2018-09-20 17:50:33 +00:00
|
|
|
} else if ((du6_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 0) {
|
2017-12-31 14:33:53 +00:00
|
|
|
me["Test_white"].show();
|
|
|
|
me["Test_text"].hide();
|
|
|
|
} else {
|
|
|
|
me["Test_white"].hide();
|
|
|
|
me["Test_text"].show();
|
|
|
|
}
|
|
|
|
},
|
2017-11-20 22:03:07 +00:00
|
|
|
};
|
|
|
|
|
2017-11-20 06:10:59 +00:00
|
|
|
setlistener("sim/signals/fdm-initialized", func {
|
|
|
|
setprop("instrumentation/efis[0]/inputs/plan-wpt-index", -1);
|
|
|
|
setprop("instrumentation/efis[1]/inputs/plan-wpt-index", -1);
|
2017-06-19 00:14:41 +00:00
|
|
|
|
|
|
|
nd_display.main = canvas.new({
|
2017-11-20 06:10:59 +00:00
|
|
|
"name": "ND1",
|
2017-06-19 00:14:41 +00:00
|
|
|
"size": [1024, 1024],
|
|
|
|
"view": [1024, 1024],
|
|
|
|
"mipmapping": 1
|
|
|
|
});
|
|
|
|
|
|
|
|
nd_display.right = canvas.new({
|
2017-11-20 06:10:59 +00:00
|
|
|
"name": "ND2",
|
2017-06-19 00:14:41 +00:00
|
|
|
"size": [1024, 1024],
|
|
|
|
"view": [1024, 1024],
|
|
|
|
"mipmapping": 1
|
|
|
|
});
|
|
|
|
|
|
|
|
nd_display.main.addPlacement({"node": "ND.screen"});
|
|
|
|
nd_display.right.addPlacement({"node": "ND_R.screen"});
|
2017-11-20 22:03:07 +00:00
|
|
|
var group_nd1 = nd_display.main.createGroup();
|
|
|
|
var group_nd1_test = nd_display.main.createGroup();
|
2017-11-20 06:10:59 +00:00
|
|
|
var group_nd2 = nd_display.right.createGroup();
|
2017-11-20 22:03:07 +00:00
|
|
|
var group_nd2_test = nd_display.right.createGroup();
|
2017-06-19 00:14:41 +00:00
|
|
|
|
2017-11-20 22:03:07 +00:00
|
|
|
ND_1 = canvas_ND_1.new(group_nd1);
|
|
|
|
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");
|
2017-06-19 00:14:41 +00:00
|
|
|
|
2017-11-20 06:10:59 +00:00
|
|
|
nd_update.start();
|
2018-04-09 18:16:18 +00:00
|
|
|
if (getprop("/systems/acconfig/options/nd-rate") > 1) {
|
|
|
|
rateApply();
|
|
|
|
}
|
2017-11-20 06:10:59 +00:00
|
|
|
});
|
2017-06-19 00:14:41 +00:00
|
|
|
|
2018-04-09 18:16:18 +00:00
|
|
|
var rateApply = func {
|
|
|
|
nd_update.restart(0.05 * getprop("/systems/acconfig/options/nd-rate"));
|
|
|
|
}
|
|
|
|
|
2017-11-20 06:10:59 +00:00
|
|
|
var nd_update = maketimer(0.05, func {
|
|
|
|
canvas_nd_base.update();
|
|
|
|
});
|
2017-06-19 00:14:41 +00:00
|
|
|
|
2018-09-20 17:50:33 +00:00
|
|
|
for (i = 0; i < 2; i = i + 1 ) {
|
2017-11-20 06:10:59 +00:00
|
|
|
setlistener("/instrumentation/efis["~i~"]/nd/display-mode", func(node) {
|
2017-06-19 00:14:41 +00:00
|
|
|
var par = node.getParent().getParent();
|
|
|
|
var idx = par.getIndex();
|
2017-11-20 06:10:59 +00:00
|
|
|
var canvas_mode = "/instrumentation/efis["~idx~"]/nd/canvas-display-mode";
|
|
|
|
var nd_centered = "/instrumentation/efis["~idx~"]/inputs/nd-centered";
|
|
|
|
var mode = getprop("/instrumentation/efis["~idx~"]/nd/display-mode");
|
|
|
|
var cvs_mode = "NAV";
|
2017-06-19 00:14:41 +00:00
|
|
|
var centered = 1;
|
2017-11-20 06:10:59 +00:00
|
|
|
if (mode == "ILS") {
|
|
|
|
cvs_mode = "APP";
|
2018-09-20 17:50:33 +00:00
|
|
|
}
|
|
|
|
else if (mode == "VOR") {
|
2017-11-20 06:10:59 +00:00
|
|
|
cvs_mode = "VOR";
|
2018-09-20 17:50:33 +00:00
|
|
|
}
|
|
|
|
else if (mode == "NAV"){
|
2017-11-20 06:10:59 +00:00
|
|
|
cvs_mode = "MAP";
|
2018-09-20 17:50:33 +00:00
|
|
|
}
|
|
|
|
else if (mode == "ARC"){
|
2017-11-20 06:10:59 +00:00
|
|
|
cvs_mode = "MAP";
|
2017-06-19 00:14:41 +00:00
|
|
|
centered = 0;
|
2018-09-20 17:50:33 +00:00
|
|
|
}
|
|
|
|
else if (mode == "PLAN"){
|
2017-11-20 06:10:59 +00:00
|
|
|
cvs_mode = "PLAN";
|
2017-06-19 00:14:41 +00:00
|
|
|
}
|
|
|
|
setprop(canvas_mode, cvs_mode);
|
|
|
|
setprop(nd_centered, centered);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-11-20 06:10:59 +00:00
|
|
|
setlistener("/instrumentation/efis[0]/nd/terrain-on-nd", func{
|
|
|
|
var terr_on_hd = getprop("/instrumentation/efis[0]/nd/terrain-on-nd");
|
2017-06-19 00:14:41 +00:00
|
|
|
var alpha = 1;
|
2017-11-20 06:10:59 +00:00
|
|
|
if (terr_on_hd) {
|
|
|
|
alpha = 0.5;
|
|
|
|
}
|
2017-06-19 00:14:41 +00:00
|
|
|
nd_display.main.setColorBackground(0,0,0,alpha);
|
|
|
|
});
|
|
|
|
|
2017-11-20 06:10:59 +00:00
|
|
|
setlistener("/flight-management/control/capture-leg", func(n) {
|
2017-06-19 00:14:41 +00:00
|
|
|
var capture_leg = n.getValue();
|
2017-11-20 06:10:59 +00:00
|
|
|
setprop("instrumentation/efis[0]/nd/xtrk-error", capture_leg);
|
|
|
|
setprop("instrumentation/efis[1]/nd/xtrk-error", capture_leg);
|
|
|
|
setprop("instrumentation/efis[0]/nd/trk-line", capture_leg);
|
|
|
|
setprop("instrumentation/efis[1]/nd/trk-line", capture_leg);
|
2017-06-19 00:14:41 +00:00
|
|
|
}, 0, 0);
|
|
|
|
|
|
|
|
var showNd = func(nd = nil) {
|
2017-11-20 22:03:07 +00:00
|
|
|
if(nd == nil) nd = "main";
|
2017-11-08 20:11:12 +00:00
|
|
|
var dlg = canvas.Window.new([512, 512], "dialog");
|
2017-11-20 06:10:59 +00:00
|
|
|
dlg.setCanvas(nd_display[nd]);
|
2017-06-19 00:14:41 +00:00
|
|
|
}
|