2019-11-06 19:09:42 +00:00
|
|
|
# A3XX Display System
|
|
|
|
# Jonathan Redpath (legoboyvdlp)
|
|
|
|
|
|
|
|
# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp)
|
|
|
|
|
|
|
|
var DMC = {
|
|
|
|
_set: 0,
|
|
|
|
_setNil: 0,
|
|
|
|
|
|
|
|
new: func(num) {
|
|
|
|
var d = { parents:[DMC] };
|
|
|
|
d.activeADIRS = num;
|
2020-07-11 19:56:08 +00:00
|
|
|
d.airspeeds = [props.globals.getNode("systems/navigation/adr/output/cas-1", 1), props.globals.getNode("systems/navigation/adr/output/cas-2", 1), props.globals.getNode("systems/navigation/adr/output/cas-3", 1)];
|
|
|
|
d.altitudes = [props.globals.getNode("systems/navigation/adr/output/baro-alt-corrected-1-capt", 1), props.globals.getNode("systems/navigation/adr/output/baro-alt-corrected-2-capt", 1), props.globals.getNode("systems/navigation/adr/output/baro-alt-corrected-3-capt", 1)];
|
|
|
|
d.machs = [props.globals.getNode("systems/navigation/adr/output/mach-1", 1), props.globals.getNode("systems/navigation/adr/output/mach-2", 1), props.globals.getNode("systems/navigation/adr/output/mach-3", 1)];
|
|
|
|
d.altitudesPfd = [props.globals.getNode("instrumentation/altimeter[0]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[1]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[2]/indicated-altitude-ft-pfd", 1)];
|
|
|
|
d.sats = [props.globals.getNode("systems/navigation/adr/output/sat-1", 1), props.globals.getNode("systems/navigation/adr/output/sat-2", 1), props.globals.getNode("systems/navigation/adr/output/sat-3", 1)];
|
|
|
|
d.tats = [props.globals.getNode("systems/navigation/adr/output/tat-1", 1), props.globals.getNode("systems/navigation/adr/output/tat-2", 1), props.globals.getNode("systems/navigation/adr/output/tat-3", 1)];
|
|
|
|
d.trends = [props.globals.getNode("instrumentation/pfd/speed-lookahead-1", 1), props.globals.getNode("instrumentation/pfd/speed-lookahead-2", 1), props.globals.getNode("instrumentation/pfd/speed-lookahead-3", 1)];
|
|
|
|
d.outputs = [nil, nil, nil, nil, nil, nil, nil]; # airspeed, altitude, mach, pfd altitude, sat, tat, speed trend
|
2019-11-06 19:09:42 +00:00
|
|
|
return d;
|
|
|
|
},
|
|
|
|
changeActiveADIRS: func(newADIRS) {
|
|
|
|
me.activeADIRS = newADIRS;
|
|
|
|
me._set = 0;
|
|
|
|
},
|
|
|
|
setOutputs: func(ADIRS) {
|
|
|
|
me.outputs[0] = me.airspeeds[ADIRS];
|
2019-11-08 19:19:46 +00:00
|
|
|
me.outputs[1] = me.altitudes[ADIRS];
|
2019-11-06 19:09:42 +00:00
|
|
|
me.outputs[2] = me.machs[ADIRS];
|
2019-11-08 19:19:46 +00:00
|
|
|
me.outputs[3] = me.altitudesPfd[ADIRS];
|
2019-11-30 13:39:53 +00:00
|
|
|
me.outputs[4] = me.sats[ADIRS];
|
|
|
|
me.outputs[5] = me.tats[ADIRS];
|
2019-12-22 19:12:26 +00:00
|
|
|
me.outputs[6] = me.trends[ADIRS];
|
2019-11-06 19:09:42 +00:00
|
|
|
},
|
|
|
|
setOutputsNil: func() {
|
|
|
|
me.outputs[0] = nil;
|
|
|
|
me.outputs[1] = nil;
|
|
|
|
me.outputs[2] = nil;
|
2019-11-08 19:19:46 +00:00
|
|
|
me.outputs[3] = nil;
|
2019-11-30 13:39:53 +00:00
|
|
|
me.outputs[4] = nil;
|
|
|
|
me.outputs[5] = nil;
|
2019-12-22 19:12:26 +00:00
|
|
|
me.outputs[6] = nil;
|
2019-11-06 19:09:42 +00:00
|
|
|
},
|
|
|
|
update: func() {
|
2020-05-01 08:41:39 +00:00
|
|
|
if (systems.ADIRS.ADIRunits[me.activeADIRS].operative and systems.ADIRS.ADIRunits[me.activeADIRS].outputOn) {
|
2019-11-06 19:09:42 +00:00
|
|
|
if (me._set != 1) {
|
|
|
|
me._setNil = 0;
|
|
|
|
me.setOutputs(me.activeADIRS);
|
|
|
|
me._setADIRS = me.activeADIRS;
|
|
|
|
me._set = 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (me._setNil != 1) {
|
|
|
|
me._set = 0;
|
|
|
|
me.setOutputsNil();
|
|
|
|
me._setNil = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
var DMController = {
|
|
|
|
_init: 0,
|
|
|
|
i: nil, # to make sure scope remains local use me.i
|
|
|
|
DMCs: [nil, nil, nil],
|
|
|
|
|
|
|
|
init: func() {
|
|
|
|
if (!me._init) {
|
|
|
|
me.DMCs = [DMC.new(0), DMC.new(1), DMC.new(2)];
|
2019-11-08 19:19:46 +00:00
|
|
|
|
|
|
|
# update DMC2 to correct properties for first officer PFD
|
2020-02-07 16:10:54 +00:00
|
|
|
me.DMCs[1].altitudes = [props.globals.getNode("systems/navigation/adr/output/baro-alt-corrected-1-fo", 1), props.globals.getNode("systems/navigation/adr/output/baro-alt-corrected-2-fo", 1), props.globals.getNode("systems/navigation/adr/output/baro-alt-corrected-3-fo", 1)];
|
|
|
|
me.DMCs[1].altitudesPfd = [props.globals.getNode("instrumentation/altimeter[3]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[4]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[5]/indicated-altitude-ft-pfd", 1)];
|
2019-11-08 19:19:46 +00:00
|
|
|
|
2019-11-06 19:09:42 +00:00
|
|
|
me._init = 1;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
loop: func() {
|
|
|
|
for (me.i = 0; me.i < 3; me.i = me.i + 1) {
|
|
|
|
me.DMCs[me.i].update();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|