2019-10-14 16:48:35 +00:00
|
|
|
# A320 Main Libraries
|
|
|
|
# Joshua Davidson (Octal450)
|
|
|
|
|
2021-04-23 17:21:07 +00:00
|
|
|
# Copyright (c) 2021 Josh Davidson (Octal450)
|
2019-10-14 16:48:35 +00:00
|
|
|
|
2020-04-27 13:58:38 +00:00
|
|
|
print("------------------------------------------------");
|
2021-04-23 20:30:35 +00:00
|
|
|
print("Copyright (c) 2016-2021 Josh Davidson (Octal450)");
|
2020-04-27 13:58:38 +00:00
|
|
|
print("------------------------------------------------");
|
2019-10-14 16:48:35 +00:00
|
|
|
|
2020-11-28 13:40:33 +00:00
|
|
|
# Disable specific menubar items
|
2020-05-12 02:40:59 +00:00
|
|
|
setprop("/sim/menubar/default/menu[0]/item[0]/enabled", 0);
|
|
|
|
setprop("/sim/menubar/default/menu[2]/item[0]/enabled", 0);
|
|
|
|
setprop("/sim/menubar/default/menu[2]/item[2]/enabled", 0);
|
|
|
|
setprop("/sim/menubar/default/menu[3]/enabled", 0);
|
|
|
|
setprop("/sim/menubar/default/menu[5]/item[9]/enabled", 0);
|
|
|
|
setprop("/sim/menubar/default/menu[5]/item[10]/enabled", 0);
|
|
|
|
setprop("/sim/menubar/default/menu[5]/item[11]/enabled", 0);
|
2019-10-14 16:48:35 +00:00
|
|
|
|
|
|
|
# Oil Qty
|
|
|
|
var qty1 = math.round((rand() * 5 ) + 20, 0.1);
|
|
|
|
var qty2 = math.round((rand() * 5 ) + 20, 0.1);
|
2020-05-12 02:40:59 +00:00
|
|
|
setprop("/engines/engine[0]/oil-qt-actual", qty1);
|
|
|
|
setprop("/engines/engine[1]/oil-qt-actual", qty2);
|
2019-10-14 16:48:35 +00:00
|
|
|
|
|
|
|
##########
|
|
|
|
# Lights #
|
|
|
|
##########
|
|
|
|
var beacon = aircraft.light.new("/sim/model/lights/beacon", [0.1, 1], "/controls/lighting/beacon");
|
|
|
|
var strobe = aircraft.light.new("/sim/model/lights/strobe", [0.05, 0.06, 0.05, 1], "/controls/lighting/strobe");
|
|
|
|
var tail_strobe = aircraft.light.new("/sim/model/lights/tailstrobe", [0.1, 1], "/controls/lighting/strobe");
|
|
|
|
|
2020-07-11 23:35:03 +00:00
|
|
|
###########
|
|
|
|
# Effects #
|
|
|
|
###########
|
2019-10-14 16:48:35 +00:00
|
|
|
|
|
|
|
var tiresmoke_system = aircraft.tyresmoke_system.new(0, 1, 2);
|
|
|
|
aircraft.rain.init();
|
|
|
|
|
2020-11-29 22:13:28 +00:00
|
|
|
var aero = getprop("/sim/aero");
|
|
|
|
if (aero == "A320-200-CFM") {
|
2020-11-29 23:32:34 +00:00
|
|
|
var livery = aircraft.canvas_livery.init("Models/Liveries/A320/CFM");
|
2021-03-19 16:47:37 +00:00
|
|
|
elements = ["EngineCFM56R", "EngineCFM56L", "PylonCFM56R", "PylonCFM56L", "ReverserRDoor1", "ReverserRDoor2", "ReverserRDoor3", "ReverserRDoor4", "ReverserLDoor1", "ReverserLDoor2", "ReverserLDoor3", "ReverserLDoor4"];
|
2020-11-29 22:13:28 +00:00
|
|
|
livery.createTarget("engines", elements, "/sim/model/livery/texture-engine");
|
|
|
|
livery.addLayer("engines", "dirt", "Aircraft/A320-family/Models/CFM-Dirt-test-s.png");
|
|
|
|
} else if (aero == "A320-200-IAE") {
|
2020-11-29 23:32:34 +00:00
|
|
|
var livery = aircraft.canvas_livery.init("Models/Liveries/A320/IAE");
|
2020-11-29 22:13:28 +00:00
|
|
|
elements = ["EngineIAEV2500R", "EngineIAEV2500L", "PylonIAEV2500R", "PylonIAEV2500R", "ReverserRDoor", "ReverserLDoor"];
|
|
|
|
livery.createTarget("engines", elements, "/sim/model/livery/texture-engine");
|
|
|
|
livery.addLayer("engines", "dirt", "Aircraft/A320-family/Models/CFM-Dirt-test-s.png");
|
|
|
|
}
|
2020-07-11 23:35:03 +00:00
|
|
|
|
2021-04-06 10:48:04 +00:00
|
|
|
var elements = ["Fuselage", "Wings", "Hstabs", "ElevatorL", "ElevatorR", "FlapL1", "FlapL2", "FlapR1", "FlapR2", "SpoilerL1", "SpoilerL2", "SpoilerL3", "SpoilerL4", "SpoilerL5", "SpoilerR1", "SpoilerR2", "SpoilerR3", "SpoilerR4", "SpoilerR5", "DoorL1", "DoorL4", "DoorR1", "DoorR4", "Cargo1", "Cargo2", "Cargo3", "MLGGearDoorR", "MLGGearDoorL", "MLGWingDoorR1", "MLGWingDoorL1", "MLGWingDoorR2", "MLGWingDoorL2", "NLGForewardDoorL", "NLGForewardDoorR", "NLGAftDoorL", "NLGAftDoorR", "GPUServiceDoor", "AvionicsVentDoor", "OutflowValveDoor1", "OutflowValveDoor2", "ApuFlap", "Rudder", "Sharklet", "WingtipFence", "RatDoorL", "RatDoorR"];
|
2021-03-19 16:47:37 +00:00
|
|
|
livery.createTarget("fuselage", elements, "/sim/model/livery/texture-fuselage", resolution=16384);
|
2020-11-29 23:32:34 +00:00
|
|
|
livery.addLayer("fuselage", "dirt", "Aircraft/A320-family/Models/seam-dirt.png");
|
|
|
|
|
2019-10-14 16:48:35 +00:00
|
|
|
#########
|
|
|
|
# Doors #
|
|
|
|
#########
|
|
|
|
|
|
|
|
# Front doors
|
2020-06-30 16:44:22 +00:00
|
|
|
var doorl1 = aircraft.door.new("/sim/model/door-positions/doorl1", 5);
|
|
|
|
var doorr1 = aircraft.door.new("/sim/model/door-positions/doorr1", 5);
|
2019-10-14 16:48:35 +00:00
|
|
|
|
|
|
|
# Rear doors
|
2020-06-30 16:44:22 +00:00
|
|
|
var doorl4 = aircraft.door.new("/sim/model/door-positions/doorl4", 5);
|
|
|
|
var doorr4 = aircraft.door.new("/sim/model/door-positions/doorr4", 5);
|
2019-10-14 16:48:35 +00:00
|
|
|
|
|
|
|
# Cargo holds
|
|
|
|
var cargobulk = aircraft.door.new("/sim/model/door-positions/cargobulk", 3);
|
|
|
|
var cargoaft = aircraft.door.new("/sim/model/door-positions/cargoaft", 10);
|
|
|
|
var cargofwd = aircraft.door.new("/sim/model/door-positions/cargofwd", 10);
|
|
|
|
|
|
|
|
# Seat armrests in the flight deck (unused)
|
|
|
|
var armrests = aircraft.door.new("/sim/model/door-positions/armrests", 2);
|
2020-06-21 13:24:43 +00:00
|
|
|
var windowLeft = aircraft.door.new("/sim/model/door-positions/windowLeft", 1);
|
|
|
|
var windowRight = aircraft.door.new("/sim/model/door-positions/windowRight", 1);
|
2019-10-14 16:48:35 +00:00
|
|
|
|
|
|
|
# door opener/closer
|
|
|
|
var triggerDoor = func(door, doorName, doorDesc) {
|
2020-05-12 02:40:59 +00:00
|
|
|
if (getprop("/sim/model/door-positions/" ~ doorName ~ "/position-norm") > 0) {
|
2019-10-14 16:48:35 +00:00
|
|
|
gui.popupTip("Closing " ~ doorDesc ~ " door");
|
|
|
|
door.toggle();
|
|
|
|
} else {
|
2020-05-12 02:40:59 +00:00
|
|
|
if (getprop("/velocities/groundspeed-kt") > 5) {
|
2019-10-14 16:48:35 +00:00
|
|
|
gui.popupTip("You cannot open the doors while the aircraft is moving!");
|
|
|
|
} else {
|
|
|
|
gui.popupTip("Opening " ~ doorDesc ~ " door");
|
|
|
|
door.toggle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-07-11 23:35:03 +00:00
|
|
|
###########
|
|
|
|
# Systems #
|
|
|
|
###########
|
2020-11-28 13:40:33 +00:00
|
|
|
var systemsInitialized = 0;
|
|
|
|
var A320Libraries = nil;
|
|
|
|
|
2020-11-28 15:38:17 +00:00
|
|
|
var systemsInit = func() {
|
2020-11-28 13:40:33 +00:00
|
|
|
systemsInitialized = 0;
|
2019-11-30 13:39:53 +00:00
|
|
|
fbw.FBW.init();
|
2021-06-22 16:52:24 +00:00
|
|
|
effects.lightManager.init();
|
2019-10-14 16:48:35 +00:00
|
|
|
systems.ELEC.init();
|
|
|
|
systems.PNEU.init();
|
|
|
|
systems.HYD.init();
|
|
|
|
systems.FUEL.init();
|
|
|
|
systems.ADIRS.init();
|
|
|
|
systems.eng_init();
|
2021-04-24 17:05:23 +00:00
|
|
|
systems.ENGINE.init();
|
2021-04-22 21:44:17 +00:00
|
|
|
systems.FADEC.init();
|
2020-04-14 17:07:01 +00:00
|
|
|
systems.APUController.init();
|
2020-09-16 18:07:45 +00:00
|
|
|
systems.BrakeSys.reset();
|
2020-07-25 23:13:54 +00:00
|
|
|
systems.Autobrake.init();
|
2020-05-16 20:04:03 +00:00
|
|
|
systems.fire_init();
|
2020-01-07 20:48:27 +00:00
|
|
|
fmgc.flightPlanController.reset();
|
2020-06-10 02:42:30 +00:00
|
|
|
fmgc.windController.reset();
|
2019-10-14 16:48:35 +00:00
|
|
|
fmgc.ITAF.init();
|
|
|
|
fmgc.FMGCinit();
|
|
|
|
mcdu.MCDU_init(0);
|
|
|
|
mcdu.MCDU_init(1);
|
2020-05-25 17:56:13 +00:00
|
|
|
mcdu_scratchpad.mcduMsgtimer1.start();
|
|
|
|
mcdu_scratchpad.mcduMsgtimer2.start();
|
2020-05-05 18:12:14 +00:00
|
|
|
effects.icingInit();
|
2020-05-16 20:04:03 +00:00
|
|
|
ecam.ECAM.init();
|
2019-10-14 16:48:35 +00:00
|
|
|
libraries.variousReset();
|
|
|
|
rmp.init();
|
|
|
|
acp.init();
|
|
|
|
ecam.ECAM_controller.init();
|
|
|
|
atc.init();
|
2019-10-27 20:54:00 +00:00
|
|
|
fcu.FCUController.init();
|
2019-11-06 19:09:42 +00:00
|
|
|
dmc.DMController.init();
|
2020-05-21 20:02:28 +00:00
|
|
|
fmgc.flightPlanController.init();
|
2020-06-10 02:42:30 +00:00
|
|
|
fmgc.windController.init();
|
2020-07-23 14:29:44 +00:00
|
|
|
atsu.CompanyCall.init();
|
2020-11-28 13:40:33 +00:00
|
|
|
systemsInitialized = 1;
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
|
2020-11-28 15:38:17 +00:00
|
|
|
setlistener("/sim/signals/fdm-initialized", func() {
|
2019-10-14 16:48:35 +00:00
|
|
|
systemsInit();
|
2020-07-10 00:09:19 +00:00
|
|
|
fmgc.postInit();
|
2020-01-07 20:48:27 +00:00
|
|
|
fmgc.flightPlanTimer.start();
|
2020-05-18 23:09:09 +00:00
|
|
|
fmgc.WaypointDatabase.read();
|
2020-11-28 13:40:33 +00:00
|
|
|
|
|
|
|
A320Libraries = LibrariesRecipient.new("A320 Libraries");
|
|
|
|
emesary.GlobalTransmitter.Register(A320Libraries);
|
2019-10-14 16:48:35 +00:00
|
|
|
});
|
|
|
|
|
2020-07-11 23:35:03 +00:00
|
|
|
var collectorTankL = props.globals.getNode("/fdm/jsbsim/propulsion/tank[5]/contents-lbs");
|
|
|
|
var collectorTankR = props.globals.getNode("/fdm/jsbsim/propulsion/tank[6]/contents-lbs");
|
|
|
|
var groundAir = props.globals.getNode("/controls/pneumatics/switches/groundair");
|
|
|
|
var groundCart = props.globals.getNode("/controls/electrical/ground-cart");
|
|
|
|
var chocks = props.globals.getNode("/services/chocks/enable");
|
|
|
|
var groundspeed = 0;
|
2020-11-28 13:40:33 +00:00
|
|
|
var stateL = 0;
|
|
|
|
var stateR = 0;
|
2020-07-11 23:35:03 +00:00
|
|
|
|
2021-06-12 23:24:46 +00:00
|
|
|
var seatbeltSwitch = props.globals.getNode("/controls/switches/seatbelt-sign");
|
|
|
|
var noSmokingSwitch = props.globals.getNode("/controls/switches/no-smoking-sign");
|
|
|
|
var emerLtsSwitch = props.globals.getNode("/controls/switches/emer-lights");
|
2020-11-28 13:40:33 +00:00
|
|
|
var seatbeltLight = props.globals.getNode("/controls/lighting/seatbelt-sign");
|
|
|
|
var noSmokingLight = props.globals.getNode("/controls/lighting/no-smoking-sign");
|
2020-07-11 23:35:03 +00:00
|
|
|
|
2020-11-28 13:40:33 +00:00
|
|
|
var update_items = [
|
|
|
|
props.UpdateManager.FromHashValue("seatbelt", nil, func(val) {
|
|
|
|
if (val) {
|
|
|
|
if (!seatbeltLight.getBoolValue()) {
|
|
|
|
seatbeltLight.setValue(1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (seatbeltLight.getBoolValue()) {
|
|
|
|
seatbeltLight.setValue(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
props.UpdateManager.FromHashList(["noSmoking","gearPosNorm"], nil, func(val) {
|
2020-11-28 15:25:02 +00:00
|
|
|
if (val.noSmoking == 1) {
|
2020-11-28 13:40:33 +00:00
|
|
|
if (!noSmokingLight.getBoolValue()) {
|
|
|
|
noSmokingLight.setBoolValue(1);
|
|
|
|
}
|
|
|
|
} elsif (val.noSmoking == 0.5 and val.gearPosNorm != 0) { # todo: should be when uplocks not engaged
|
|
|
|
if (!noSmokingLight.getBoolValue()) {
|
|
|
|
noSmokingLight.setBoolValue(1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
noSmokingLight.setBoolValue(0); # sign stays on in cabin but sound still occurs
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
];
|
2020-11-28 15:25:02 +00:00
|
|
|
|
2020-11-28 13:40:33 +00:00
|
|
|
var systemsLoop = func(notification) {
|
|
|
|
if (!systemsInitialized) { return; }
|
2021-02-08 15:45:57 +00:00
|
|
|
systems.PNEU.loop(notification);
|
|
|
|
systems.ADIRS.loop(notification);
|
|
|
|
systems.BrakeSys.update(notification);
|
|
|
|
systems.HFLoop(notification);
|
2020-09-12 17:21:23 +00:00
|
|
|
systems.APUController.loop();
|
2021-04-22 21:44:17 +00:00
|
|
|
systems.FADEC.loop();
|
2019-10-14 16:48:35 +00:00
|
|
|
rmp.rmpUpdate();
|
2021-02-08 15:45:57 +00:00
|
|
|
fcu.FCUController.loop(notification);
|
|
|
|
atc.Transponders.vector[atc.transponderPanel.atcSel - 1].update(notification);
|
2019-11-06 19:09:42 +00:00
|
|
|
dmc.DMController.loop();
|
2020-07-30 18:36:00 +00:00
|
|
|
atsu.ATSU.loop();
|
2020-09-12 17:21:23 +00:00
|
|
|
libraries.BUTTONS.update();
|
2019-10-14 16:48:35 +00:00
|
|
|
|
2020-11-28 15:38:17 +00:00
|
|
|
if ((notification.engine1State == 2 or notification.engine1State == 3) and collectorTankL.getValue() < 1) {
|
2019-10-14 16:48:35 +00:00
|
|
|
systems.cutoff_one();
|
|
|
|
}
|
2020-11-28 15:38:17 +00:00
|
|
|
if ((notification.engine2State == 2 or notification.engine2State == 3) and collectorTankR.getValue() < 1) {
|
2019-10-14 16:48:35 +00:00
|
|
|
systems.cutoff_two();
|
|
|
|
}
|
2020-11-28 13:40:33 +00:00
|
|
|
|
|
|
|
foreach (var update_item; update_items) {
|
|
|
|
update_item.update(notification);
|
|
|
|
}
|
|
|
|
}
|
2020-07-11 23:35:03 +00:00
|
|
|
|
|
|
|
# GPWS
|
|
|
|
var GPWS = {
|
|
|
|
inhibitNode: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit"),
|
2021-02-24 22:00:46 +00:00
|
|
|
tatcfInhibit: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit"),
|
2020-07-11 23:35:03 +00:00
|
|
|
volume: props.globals.getNode("/instrumentation/mk-viii/speaker/volume"),
|
|
|
|
flapAllOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override"),
|
|
|
|
flap3Override: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override"),
|
|
|
|
flapOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-override"),
|
2021-02-24 22:00:46 +00:00
|
|
|
alertMode: props.globals.initNode("/instrumentation/mk-viii/outputs/alert-mode",0,"INT"),
|
2020-07-11 23:35:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
setlistener("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit", func() {
|
|
|
|
if (GPWS.inhibitNode.getBoolValue()) {
|
|
|
|
GPWS.volume.setValue(2);
|
|
|
|
} else {
|
|
|
|
GPWS.volume.setValue(0);
|
|
|
|
}
|
|
|
|
}, 0, 0);
|
|
|
|
|
|
|
|
var updateGPWSFlap = func() {
|
|
|
|
if (GPWS.flapAllOverride.getBoolValue() or (GPWS.flap3Override.getBoolValue() and pts.Controls.Flight.flapsPos.getValue() >= 4)) {
|
|
|
|
GPWS.flapOverride.setBoolValue(1);
|
|
|
|
} else {
|
|
|
|
GPWS.flapOverride.setBoolValue(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setlistener("/instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override", func() {
|
|
|
|
updateGPWSFlap();
|
|
|
|
}, 0, 0);
|
|
|
|
|
|
|
|
setlistener("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", func() {
|
|
|
|
updateGPWSFlap();
|
|
|
|
}, 0, 0);
|
|
|
|
|
2021-02-24 22:00:46 +00:00
|
|
|
# GPWS alert pooling for get mode change - a little esoteric way but it works
|
|
|
|
var gpws_alert_watch = maketimer(0.8,func {
|
|
|
|
var alert = 0;
|
|
|
|
if (getprop("instrumentation/mk-viii/outputs/discretes/gpws-warning")) alert = 2; # MODE2 - warning - RED
|
|
|
|
else if (getprop("instrumentation/mk-viii/outputs/discretes/gpws-alert")) alert = 1; # MODE1 - caution - YELLOW
|
|
|
|
if (GPWS.alertMode.getValue()!=alert) GPWS.alertMode.setValue(alert);
|
|
|
|
});
|
|
|
|
|
|
|
|
setlistener("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", func{ # detect GPWS switch status
|
|
|
|
var failure = GPWS.tatcfInhibit.getBoolValue();
|
|
|
|
if (!failure) gpws_alert_watch.start();
|
|
|
|
else gpws_alert_watch.stop();
|
|
|
|
},1,0);
|
|
|
|
|
2020-07-11 23:35:03 +00:00
|
|
|
# Replay
|
|
|
|
var replayState = props.globals.getNode("/sim/replay/replay-state");
|
2021-06-06 21:21:58 +00:00
|
|
|
setlistener(replayState, func(v) {
|
|
|
|
if (v.getBoolValue()) {
|
2020-07-11 23:35:03 +00:00
|
|
|
} else {
|
2019-10-14 16:48:35 +00:00
|
|
|
acconfig.colddark();
|
|
|
|
gui.popupTip("Replay Ended: Setting Cold and Dark state...");
|
|
|
|
}
|
2020-07-11 23:35:03 +00:00
|
|
|
}, 0, 0);
|
2019-10-14 16:48:35 +00:00
|
|
|
|
2020-07-11 23:35:03 +00:00
|
|
|
# Steep ILS
|
2020-11-28 15:38:17 +00:00
|
|
|
setlistener("/options/steep-ils", func() {
|
2020-05-12 02:40:59 +00:00
|
|
|
if (getprop("/options/steep-ils") == 1) {
|
|
|
|
setprop("/instrumentation/mk-viii/inputs/discretes/steep-approach", 1);
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
2020-05-12 02:40:59 +00:00
|
|
|
setprop("/instrumentation/mk-viii/inputs/discretes/steep-approach", 0);
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
2020-07-11 23:35:03 +00:00
|
|
|
}, 0, 0);
|
2019-10-14 16:48:35 +00:00
|
|
|
|
2020-07-11 23:35:03 +00:00
|
|
|
# hackCanvas
|
2019-10-14 16:48:35 +00:00
|
|
|
canvas.Text._lastText = canvas.Text["_lastText"];
|
|
|
|
canvas.Text.setText = func(text) {
|
|
|
|
if (text == me._lastText and text != nil and size(text) == size(me._lastText)) {return me;}
|
|
|
|
me._lastText = text;
|
|
|
|
me.set("text", typeof(text) == 'scalar' ? text : "");
|
|
|
|
};
|
|
|
|
canvas.Element._lastVisible = nil;
|
2020-11-28 15:38:17 +00:00
|
|
|
canvas.Element.show = func() {
|
2019-10-14 16:48:35 +00:00
|
|
|
if (1 == me._lastVisible) {return me;}
|
|
|
|
me._lastVisible = 1;
|
|
|
|
me.setBool("visible", 1);
|
|
|
|
};
|
2020-11-28 15:38:17 +00:00
|
|
|
canvas.Element.hide = func() {
|
2019-10-14 16:48:35 +00:00
|
|
|
if (0 == me._lastVisible) {return me;}
|
|
|
|
me._lastVisible = 0;
|
|
|
|
me.setBool("visible", 0);
|
|
|
|
};
|
|
|
|
canvas.Element.setVisible = func(vis) {
|
|
|
|
if (vis == me._lastVisible) {return me;}
|
|
|
|
me._lastVisible = vis;
|
|
|
|
me.setBool("visible", vis);
|
|
|
|
};
|
2019-11-01 10:59:18 +00:00
|
|
|
|
2020-07-11 23:35:03 +00:00
|
|
|
##########
|
2020-11-28 15:38:17 +00:00
|
|
|
# Misc #
|
2020-07-11 23:35:03 +00:00
|
|
|
##########
|
|
|
|
var pilotComfortTwoPos = func(prop) {
|
|
|
|
var item = getprop(prop);
|
|
|
|
if (item < 0.5) {
|
|
|
|
interpolate(prop, 0.5, 0.5);
|
|
|
|
} elsif (item == 0.5) {
|
|
|
|
interpolate(prop, 1.0, 0.5);
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
2020-07-11 23:35:03 +00:00
|
|
|
interpolate(prop, 0.0, 1.0);
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-11 23:35:03 +00:00
|
|
|
var pilotComfortOnePos = func(prop) {
|
|
|
|
var item = getprop(prop);
|
|
|
|
if (item < 1.0) {
|
|
|
|
interpolate(prop, 1.0, 1.0);
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
2020-07-11 23:35:03 +00:00
|
|
|
interpolate(prop, 0.0, 1.0);
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-28 15:38:17 +00:00
|
|
|
var lTray = func() {
|
2020-07-11 23:35:03 +00:00
|
|
|
pilotComfortTwoPos("/controls/tray/lefttrayext");
|
|
|
|
}
|
2020-11-28 15:38:17 +00:00
|
|
|
var rTray = func() {
|
2020-07-11 23:35:03 +00:00
|
|
|
pilotComfortTwoPos("/controls/tray/righttrayext");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
|
2020-11-28 15:38:17 +00:00
|
|
|
var l1Pedal = func() {
|
2020-07-11 23:35:03 +00:00
|
|
|
pilotComfortOnePos("/controls/footrest-cpt[0]");
|
|
|
|
}
|
2020-11-28 15:38:17 +00:00
|
|
|
var l2Pedal = func() {
|
2020-07-11 23:35:03 +00:00
|
|
|
pilotComfortOnePos("/controls/footrest-cpt[1]");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
|
2020-11-28 15:38:17 +00:00
|
|
|
var r1Pedal = func() {
|
2020-07-11 23:35:03 +00:00
|
|
|
pilotComfortOnePos("/controls/footrest-fo[0]");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
2020-11-28 15:38:17 +00:00
|
|
|
var r2Pedal = func() {
|
2020-07-11 23:35:03 +00:00
|
|
|
pilotComfortOnePos("/controls/footrest-fo[1]");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
|
2020-07-11 23:35:03 +00:00
|
|
|
#####################
|
|
|
|
# Auto-coordination #
|
|
|
|
#####################
|
|
|
|
|
|
|
|
if (pts.Controls.Flight.autoCoordination.getBoolValue()) {
|
|
|
|
pts.Controls.Flight.autoCoordination.setBoolValue(0);
|
|
|
|
pts.Controls.Flight.aileronDrivesTiller.setBoolValue(1);
|
|
|
|
} else {
|
|
|
|
pts.Controls.Flight.aileronDrivesTiller.setBoolValue(0);
|
|
|
|
}
|
|
|
|
|
2020-11-28 15:38:17 +00:00
|
|
|
setlistener("/controls/flight/auto-coordination", func() {
|
2020-07-11 23:35:03 +00:00
|
|
|
pts.Controls.Flight.autoCoordination.setBoolValue(0);
|
2019-11-09 16:29:57 +00:00
|
|
|
print("System: Auto Coordination has been turned off as it is not compatible with the fly-by-wire of this aircraft.");
|
|
|
|
screen.log.write("Auto Coordination has been disabled as it is not compatible with the fly-by-wire of this aircraft", 1, 0, 0);
|
2020-07-25 18:14:56 +00:00
|
|
|
}, 0, 0);
|
2019-10-14 16:48:35 +00:00
|
|
|
|
2020-07-11 23:35:03 +00:00
|
|
|
##############
|
|
|
|
# Legacy FCU #
|
|
|
|
##############
|
2019-10-27 20:54:00 +00:00
|
|
|
var APPanel = {
|
|
|
|
APDisc: func() {
|
|
|
|
fcu.FCUController.APDisc();
|
|
|
|
},
|
|
|
|
ATDisc: func() {
|
|
|
|
fcu.FCUController.ATDisc();
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-11-28 13:40:33 +00:00
|
|
|
|
|
|
|
# Emesary
|
|
|
|
var LibrariesRecipient =
|
|
|
|
{
|
|
|
|
new: func(_ident)
|
|
|
|
{
|
|
|
|
var NewLibrariesRecipient = emesary.Recipient.new(_ident);
|
|
|
|
NewLibrariesRecipient.Receive = func(notification)
|
|
|
|
{
|
|
|
|
if (notification.NotificationType == "FrameNotification")
|
|
|
|
{
|
|
|
|
if (math.mod(notifications.frameNotification.FrameCount,4) == 0) {
|
|
|
|
systemsLoop(notification);
|
|
|
|
}
|
|
|
|
return emesary.Transmitter.ReceiptStatus_OK;
|
|
|
|
}
|
|
|
|
return emesary.Transmitter.ReceiptStatus_NotProcessed;
|
|
|
|
};
|
|
|
|
return NewLibrariesRecipient;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
var input = {
|
2020-11-28 15:38:17 +00:00
|
|
|
# Libraries
|
2020-11-28 13:40:33 +00:00
|
|
|
"seatbelt": "/controls/switches/seatbelt-sign",
|
|
|
|
"noSmoking": "/controls/switches/no-smoking-sign",
|
|
|
|
"gearPosNorm": "/gear/gear[0]/position-norm",
|
2021-07-16 14:34:17 +00:00
|
|
|
"gearPosNorm1": "/gear/gear[1]/position-norm",
|
|
|
|
"gearPosNorm2": "/gear/gear[2]/position-norm",
|
2021-07-24 11:29:58 +00:00
|
|
|
"engine1Running": "/engines/engine[0]/running",
|
|
|
|
"engine2Running": "/engines/engine[1]/running",
|
2020-11-28 13:40:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
foreach (var name; keys(input)) {
|
|
|
|
emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Libraries", name, input[name]));
|
|
|
|
}
|
|
|
|
|
2021-01-21 12:56:22 +00:00
|
|
|
var hideCanvas = props.globals.getNode("/options/hide-canvas-outside");
|
2021-01-21 12:35:22 +00:00
|
|
|
var internal = props.globals.getNode("/sim/current-view/internal");
|
|
|
|
var toggleScreen = func() {
|
2021-01-21 12:56:22 +00:00
|
|
|
if (!internal.getValue() and hideCanvas.getValue()) {
|
2021-01-21 12:35:22 +00:00
|
|
|
canvas_pfd.PFD_update.stop();
|
|
|
|
canvas_nd.nd_update.stop();
|
|
|
|
canvas_dcdu.DCDU_update.stop();
|
|
|
|
canvas_mcdu.MCDU_update.stop();
|
|
|
|
} else {
|
|
|
|
canvas_pfd.rateApply();
|
|
|
|
canvas_nd.rateApply();
|
|
|
|
canvas_dcdu.rateApply();
|
|
|
|
canvas_mcdu.MCDU_update.start();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-01-21 12:56:22 +00:00
|
|
|
setlistener("/options/hide-canvas-outside", func() {
|
|
|
|
toggleScreen();
|
|
|
|
}, 0, 0);
|
|
|
|
|
2021-01-21 12:35:22 +00:00
|
|
|
setlistener("/sim/current-view/internal", func() {
|
|
|
|
toggleScreen();
|
|
|
|
}, 0, 0);
|
|
|
|
|
2021-01-19 17:30:25 +00:00
|
|
|
# TODO split EFIS altimeters
|
|
|
|
var newinhg = nil;
|
|
|
|
setlistener("/instrumentation/altimeter/setting-inhg", func() {
|
|
|
|
newinhg = getprop("/instrumentation/altimeter/setting-inhg");
|
|
|
|
setprop("/instrumentation/altimeter[1]/setting-inhg", newinhg);
|
|
|
|
setprop("/instrumentation/altimeter[2]/setting-inhg", newinhg);
|
|
|
|
setprop("/instrumentation/altimeter[3]/setting-inhg", newinhg);
|
|
|
|
setprop("/instrumentation/altimeter[4]/setting-inhg", newinhg);
|
|
|
|
setprop("/instrumentation/altimeter[5]/setting-inhg", newinhg);
|
|
|
|
}, 0, 0);
|
|
|
|
|
|
|
|
var newhpa = nil;
|
|
|
|
setlistener("/instrumentation/altimeter/setting-hpa", func() {
|
|
|
|
newhpa = getprop("/instrumentation/altimeter/setting-hpa");
|
|
|
|
setprop("/instrumentation/altimeter[1]/setting-hpa", newhpa);
|
|
|
|
setprop("/instrumentation/altimeter[2]/setting-hpa", newhpa);
|
|
|
|
setprop("/instrumentation/altimeter[3]/setting-hpa", newhpa);
|
|
|
|
setprop("/instrumentation/altimeter[4]/setting-hpa", newhpa);
|
|
|
|
setprop("/instrumentation/altimeter[5]/setting-hpa", newhpa);
|
|
|
|
}, 0, 0);
|
|
|
|
|
2020-05-12 02:40:59 +00:00
|
|
|
setprop("/systems/acconfig/libraries-loaded", 1);
|