This repository has been archived on 2021-09-26. You can view files and clone it, but cannot push or open issues or pull requests.
IDG-A32X/Nasal/efis.nas

122 lines
4 KiB
Text
Raw Normal View History

2017-04-17 19:44:59 +00:00
# A3XX EFIS controller by Joshua Davidson (it0uchpods).
setlistener("sim/signals/fdm-initialized", func {
2017-05-30 03:20:00 +00:00
setprop("/instrumentation/efis/nd/display-mode", "NAV");
setprop("/instrumentation/efis/mfd/pnl_mode-num", 2);
setprop("/instrumentation/efis/inputs/range-nm", 20);
2017-06-19 00:14:41 +00:00
setprop("/instrumentation/efis[1]/nd/display-mode", "NAV");
setprop("/instrumentation/efis[1]/mfd/pnl_mode-num", 2);
setprop("/instrumentation/efis[1]/inputs/range-nm", 20);
setprop("/controls/lighting/ndl-norm", "1");
setprop("/controls/lighting/ndr-norm", "1");
});
# Captain
var ctl_func = func(md,val) {
if(md == "range") {
var rng = getprop("/instrumentation/efis/inputs/range-nm");
if(val ==1){
rng = rng * 2;
if(rng > 640) rng = 640;
} else if(val = -1){
rng = rng / 2;
if(rng < 10) rng = 10;
}
setprop("/instrumentation/efis/inputs/range-nm", rng);
}
}
var mode_inc = func {
var mode = getprop("/instrumentation/efis/nd/display-mode");
if (mode == "ILS") {
setprop("/instrumentation/efis/nd/display-mode", "VOR");
setprop("/instrumentation/efis/mfd/pnl_mode-num", 1);
} else if (mode == "VOR") {
setprop("/instrumentation/efis/nd/display-mode", "NAV");
setprop("/instrumentation/efis/mfd/pnl_mode-num", 2);
} else if (mode == "NAV") {
setprop("/instrumentation/efis/nd/display-mode", "ARC");
setprop("/instrumentation/efis/mfd/pnl_mode-num", 3);
} else if (mode == "ARC") {
setprop("/instrumentation/efis/nd/display-mode", "PLAN");
setprop("/instrumentation/efis/mfd/pnl_mode-num", 4);
} else {
return 0;
}
}
var mode_dec = func {
var mode = getprop("/instrumentation/efis/nd/display-mode");
if (mode == "PLAN") {
setprop("/instrumentation/efis/nd/display-mode", "ARC");
setprop("/instrumentation/efis/mfd/pnl_mode-num", 3);
} else if (mode == "ARC") {
setprop("/instrumentation/efis/nd/display-mode", "NAV");
setprop("/instrumentation/efis/mfd/pnl_mode-num", 2);
} else if (mode == "NAV") {
setprop("/instrumentation/efis/nd/display-mode", "VOR");
setprop("/instrumentation/efis/mfd/pnl_mode-num", 1);
} else if (mode == "VOR") {
setprop("/instrumentation/efis/nd/display-mode", "ILS");
setprop("/instrumentation/efis/mfd/pnl_mode-num", 0);
} else {
return 0;
}
}
2017-06-19 00:14:41 +00:00
# First Officer
var ctl2_func = func(md,val) {
if(md == "range") {
var rng = getprop("/instrumentation/efis[1]/inputs/range-nm");
if(val ==1){
rng = rng * 2;
if(rng > 640) rng = 640;
} else if(val = -1){
rng = rng / 2;
if(rng < 10) rng = 10;
}
setprop("/instrumentation/efis[1]/inputs/range-nm", rng);
}
}
var mode2_inc = func {
var mode = getprop("/instrumentation/efis[1]/nd/display-mode");
if (mode == "ILS") {
setprop("/instrumentation/efis[1]/nd/display-mode", "VOR");
setprop("/instrumentation/efis[1]/mfd/pnl_mode-num", 1);
} else if (mode == "VOR") {
setprop("/instrumentation/efis[1]/nd/display-mode", "NAV");
setprop("/instrumentation/efis[1]/mfd/pnl_mode-num", 2);
} else if (mode == "NAV") {
setprop("/instrumentation/efis[1]/nd/display-mode", "ARC");
setprop("/instrumentation/efis[1]/mfd/pnl_mode-num", 3);
} else if (mode == "ARC") {
setprop("/instrumentation/efis[1]/nd/display-mode", "PLAN");
setprop("/instrumentation/efis[1]/mfd/pnl_mode-num", 4);
} else {
return 0;
}
}
var mode2_dec = func {
var mode = getprop("/instrumentation/efis[1]/nd/display-mode");
if (mode == "PLAN") {
setprop("/instrumentation/efis[1]/nd/display-mode", "ARC");
setprop("/instrumentation/efis[1]/mfd/pnl_mode-num", 3);
} else if (mode == "ARC") {
setprop("/instrumentation/efis[1]/nd/display-mode", "NAV");
setprop("/instrumentation/efis[1]/mfd/pnl_mode-num", 2);
} else if (mode == "NAV") {
setprop("/instrumentation/efis[1]/nd/display-mode", "VOR");
setprop("/instrumentation/efis[1]/mfd/pnl_mode-num", 1);
} else if (mode == "VOR") {
setprop("/instrumentation/efis[1]/nd/display-mode", "ILS");
setprop("/instrumentation/efis[1]/mfd/pnl_mode-num", 0);
} else {
return 0;
}
}