diff --git a/A320-main.xml b/A320-main.xml
index 1da62e2a..b02f0d69 100644
--- a/A320-main.xml
+++ b/A320-main.xml
@@ -4698,6 +4698,8 @@
Aircraft/A320-family/Nasal/Systems/tyresmoke.nas
+ Aircraft/A320-family/Nasal/ECAM/SystemDisplay.nas
+ Aircraft/A320-family/Nasal/ECAM/ECAM-nodes.nas
Aircraft/A320-family/Nasal/ECAM/ECAM-main.nas
Aircraft/A320-family/Nasal/ECAM/ECAM-controller.nas
Aircraft/A320-family/Nasal/ECAM/ECAM-logic.nas
diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml
index b4a19603..04759ab8 100644
--- a/Models/FlightDeck/a320.flightdeck.xml
+++ b/Models/FlightDeck/a320.flightdeck.xml
@@ -2167,7 +2167,7 @@
nasal
-
+
@@ -2186,7 +2186,7 @@
nasal
-
+
@@ -2205,7 +2205,7 @@
nasal
-
+
@@ -2224,7 +2224,7 @@
nasal
-
+
@@ -2243,7 +2243,7 @@
nasal
-
+
@@ -2262,7 +2262,7 @@
nasal
-
+
@@ -2281,7 +2281,7 @@
nasal
-
+
@@ -2300,7 +2300,7 @@
nasal
-
+
@@ -2319,7 +2319,7 @@
nasal
-
+
@@ -2338,7 +2338,7 @@
nasal
-
+
@@ -2357,7 +2357,7 @@
nasal
-
+
@@ -2376,7 +2376,7 @@
nasal
-
+
diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas
index 64eb0797..1c50b4f0 100644
--- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas
+++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas
@@ -297,7 +297,7 @@ var canvas_lowerECAM_base = {
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide();
lowerECAM_cond.update();
- } else if (page == "crz") {
+ } else if (page == "cruise") {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
diff --git a/Models/Instruments/ND/canvas/res/airbusND.svg b/Models/Instruments/ND/canvas/res/airbusND.svg
index c93d3d05..cfa7496d 100644
--- a/Models/Instruments/ND/canvas/res/airbusND.svg
+++ b/Models/Instruments/ND/canvas/res/airbusND.svg
@@ -1,19 +1,19 @@
+ id="nd_msg_change"
+ inkscape:label="#text3401">RANGE CHANGE
diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas
index 1d21aae5..35c318cd 100644
--- a/Models/Instruments/ND/canvas/style.nas
+++ b/Models/Instruments/ND/canvas/style.nas
@@ -1094,6 +1094,16 @@ canvas.NDStyles["Airbus"] = {
is_false: func(nd) nd.symbols.planArcs.hide(),
}, # of planArcs.impl
}, # of planArcs
+ {
+ id:"rangeRingPlan",
+ impl: {
+ init: func(nd,symbol),
+ predicate: func(nd) (((nd.in_mode("toggle_display_mode", ["PLAN"])) or ((nd.get_switch("toggle_display_mode") == "MAP") and (nd.get_switch("toggle_centered"))))
+ and (pts.Instrumentation.TCAS.Inputs.mode.getValue() >= 2) and (nd.rangeNm() <= 20) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))),
+ is_true: func(nd) nd.symbols.rangeRingPlan.show(),
+ is_false: func(nd) nd.symbols.rangeRingPlan.hide(),
+ }, # of rangeRingPlan.impl
+ }, # of rangeRingPlan
{
id:"rangeArcs",
impl: {
@@ -1104,6 +1114,16 @@ canvas.NDStyles["Airbus"] = {
is_false: func(nd) nd.symbols.rangeArcs.hide(),
}, # of rangeArcs.impl
}, # of rangeArcs
+ {
+ id:"rangeRingMap",
+ impl: {
+ init: func(nd,symbol),
+ predicate: func(nd) ((nd.get_switch("toggle_display_mode") == "MAP") and (!nd.get_switch("toggle_centered"))
+ and (pts.Instrumentation.TCAS.Inputs.mode.getValue() >= 2) and (nd.rangeNm() <= 20) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))),
+ is_true: func(nd) nd.symbols.rangeRingMap.show(),
+ is_false: func(nd) nd.symbols.rangeRingMap.hide(),
+ }, # of rangeRingMap.impl
+ }, # of rangeRingMap
{
id:"rangePln1",
impl: {
diff --git a/Nasal/ECAM/ECAM-controller.nas b/Nasal/ECAM/ECAM-controller.nas
index d84b680d..8645f29c 100644
--- a/Nasal/ECAM/ECAM-controller.nas
+++ b/Nasal/ECAM/ECAM-controller.nas
@@ -1,5 +1,5 @@
# A3XX Electronic Centralised Aircraft Monitoring System
-# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp)
+# Copyright (c) 2021 Jonathan Redpath (legoboyvdlp)
var lines = [props.globals.getNode("ECAM/msg/line1", 1), props.globals.getNode("ECAM/msg/line2", 1), props.globals.getNode("ECAM/msg/line3", 1), props.globals.getNode("ECAM/msg/line4", 1), props.globals.getNode("ECAM/msg/line5", 1), props.globals.getNode("ECAM/msg/line6", 1), props.globals.getNode("ECAM/msg/line7", 1), props.globals.getNode("ECAM/msg/line8", 1)];
var linesCol = [props.globals.getNode("ECAM/msg/linec1", 1), props.globals.getNode("ECAM/msg/linec2", 1), props.globals.getNode("ECAM/msg/linec3", 1), props.globals.getNode("ECAM/msg/linec4", 1), props.globals.getNode("ECAM/msg/linec5", 1), props.globals.getNode("ECAM/msg/linec6", 1), props.globals.getNode("ECAM/msg/linec7", 1), props.globals.getNode("ECAM/msg/linec8", 1)];
@@ -29,145 +29,6 @@ var counterClear = 0;
var noMainMsg = 0;
var storeFirstWarning = nil;
-var warningNodes = {
- Logic: {
- altitudeAlert: props.globals.initNode("/ECAM/warnings/altitude-alert/c-chord"),
- altitudeAlertSteady: props.globals.initNode("/ECAM/warnings/altitude-alert/altitude-alert-steady"),
- altitudeAlertFlash: props.globals.initNode("/ECAM/warnings/altitude-alert/altitude-alert-flash"),
- crossbleedFault: props.globals.initNode("/ECAM/warnings/logic/crossbleed-fault"),
- crossbleedWai: props.globals.initNode("/ECAM/warnings/logic/crossbleed-wai"),
- bleed1LoTempUnsuc: props.globals.initNode("/ECAM/warnings/logic/bleed-1-lo-temp-unsucc"),
- bleed1LoTempXbleed: props.globals.initNode("/ECAM/warnings/logic/bleed-1-lo-temp-xbleed"),
- bleed1LoTempBleed: props.globals.initNode("/ECAM/warnings/logic/bleed-1-lo-temp-bleed"),
- bleed1LoTempPack: props.globals.initNode("/ECAM/warnings/logic/bleed-1-lo-temp-pack"),
- bleed1WaiAvail: props.globals.initNode("/ECAM/warnings/logic/bleed-1-wai-avail"),
- bleed2LoTempUnsuc: props.globals.initNode("/ECAM/warnings/logic/bleed-2-lo-temp-unsucc"),
- bleed2LoTempXbleed: props.globals.initNode("/ECAM/warnings/logic/bleed-2-lo-temp-xbleed"),
- bleed2LoTempBleed: props.globals.initNode("/ECAM/warnings/logic/bleed-2-lo-temp-bleed"),
- bleed2LoTempPack: props.globals.initNode("/ECAM/warnings/logic/bleed-2-lo-temp-pack"),
- bleed2WaiAvail: props.globals.initNode("/ECAM/warnings/logic/bleed-2-wai-avail"),
- waiSysfault: props.globals.initNode("/ECAM/warnings/logic/wing-anti-ice-sys-fault"),
- waiLclosed: props.globals.initNode("/ECAM/warnings/flipflop/wing-anti-ice-left-closed"),
- waiRclosed: props.globals.initNode("/ECAM/warnings/flipflop/wing-anti-ice-right-closed"),
- procWaiShutdown: props.globals.initNode("/ECAM/warnings/logic/proc-wai-shutdown-output"),
- waiGndFlight: props.globals.initNode("/ECAM/warnings/logic/wing-anti-ice-gnd-fault"),
- pack12Fault: props.globals.initNode("/ECAM/warnings/logic/pack-1-2-fault"),
- pack1ResetPb: props.globals.initNode("/ECAM/warnings/logic/reset-pack-1-switch-cmd"),
- pack2ResetPb: props.globals.initNode("/ECAM/warnings/logic/reset-pack-2-switch-cmd"),
- cabinFans: props.globals.initNode("/ECAM/warnings/logic/cabin-fans-fault"),
- rtlu1Fault: props.globals.initNode("/ECAM/warnings/logic/rud-trav-lim-sys-1-fault"),
- rtlu2Fault: props.globals.initNode("/ECAM/warnings/logic/rud-trav-lim-sys-2-fault"),
- rtlu12Fault: props.globals.initNode("/ECAM/warnings/logic/rud-trav-lim-sys-fault"),
- fac12Fault: props.globals.initNode("/ECAM/warnings/logic/fac-12-fault"),
- fac1Fault: props.globals.initNode("/ECAM/warnings/logic/fac-1-fault"),
- fac2Fault: props.globals.initNode("/ECAM/warnings/logic/fac-2-fault"),
- stallWarn: props.globals.initNode("/ECAM/warnings/logic/stall/stall-warn-on"),
- yawDamper12Fault: props.globals.initNode("/ECAM/warnings/logic/yaw-damper-12-fault"),
- gearNotDown1: props.globals.initNode("/ECAM/warnings/fctl/gear-not-down-not-cancellable"),
- gearNotDown2: props.globals.initNode("/ECAM/warnings/fctl/gear-not-down-cancellable"),
- gearNotDownLocked: props.globals.initNode("/ECAM/warnings/fctl/gear-not-down-locked"),
- gearNotDownLockedFlipflop: props.globals.initNode("/ECAM/warnings/fctl/gear-not-downlocked-output"),
- blueGreen: props.globals.initNode("/ECAM/warnings/hyd/blue-green-failure"),
- blueGreenFuel: props.globals.initNode("/ECAM/warnings/hyd/blue-green-fuel-consumpt"),
- blueYellow: props.globals.initNode("/ECAM/warnings/hyd/blue-yellow-failure"),
- blueYellowFuel: props.globals.initNode("/ECAM/warnings/hyd/blue-yellow-fuel-consumpt"),
- greenYellow: props.globals.initNode("/ECAM/warnings/hyd/green-yellow-failure"),
- greenYellowFuel: props.globals.initNode("/ECAM/warnings/hyd/green-yellow-fuel-consumpt"),
- leftElevFail: props.globals.initNode("/ECAM/warnings/fctl/leftElevFault"),
- rightElevFail: props.globals.initNode("/ECAM/warnings/fctl/rightElevFault"),
- flapNotZero: props.globals.initNode("/ECAM/warnings/fctl/flaps-not-zero"),
- slatsConfig: props.globals.initNode("/ECAM/warnings/fctl/slats-config-output"),
- flapsConfig: props.globals.initNode("/ECAM/warnings/fctl/flaps-config-output"),
- spdBrkConfig: props.globals.initNode("/ECAM/warnings/fctl/spd-brk-config-output"),
- pitchTrimConfig: props.globals.initNode("/ECAM/warnings/fctl/pitch-trim-config-output"),
- rudTrimConfig: props.globals.initNode("/ECAM/warnings/fctl/rudder-trim-config-output"),
- parkBrkConfig: props.globals.initNode("/ECAM/warnings/fctl/park-brk-config-output"),
- slatsConfig2: props.globals.initNode("/ECAM/warnings/fctl/slats-config-range"),
- flapsConfig2: props.globals.initNode("/ECAM/warnings/fctl/flaps-config-range"),
- spdBrkConfig2: props.globals.initNode("/ECAM/warnings/fctl/spd-brk-config-range"),
- pitchTrimConfig2: props.globals.initNode("/ECAM/warnings/fctl/pitch-trim-config-range"),
- rudTrimConfig2: props.globals.initNode("/ECAM/warnings/fctl/rudder-trim-config-range"),
- dcEssFuelConsumptionIncreased: props.globals.initNode("/ECAM/warnings/logic/dc-ess-fuel-consumption-increased"),
- dcEssFMSPredictions: props.globals.initNode("/ECAM/warnings/logic/dc-ess-fms-predictions-unreliable"),
- dc2FuelConsumptionIncreased: props.globals.initNode("/ECAM/warnings/logic/dc-2-fuel-consumption-increased"),
- dc2FMSPredictions: props.globals.initNode("/ECAM/warnings/logic/dc-2-fms-predictions-unreliable"),
- thrLeversNotSet: props.globals.initNode("/ECAM/warnings/logic/eng/thr-lever-not-set"),
- revSet: props.globals.initNode("/ECAM/warnings/logic/eng/reverse-set"),
- eng1Fail: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-fail"),
- eng2Fail: props.globals.initNode("/ECAM/warnings/logic/eng/eng-2-fail"),
- phase5Trans: props.globals.initNode("/ECAM/warnings/logic/eng/phase-5-output"),
- eng1Shutdown: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-shutdown"),
- eng2Shutdown: props.globals.initNode("/ECAM/warnings/logic/eng/eng-2-shutdown"),
- acEssBusAltn: props.globals.initNode("/ECAM/warnings/logic/ac-ess-bus-altn-feed"),
- gen1Off: props.globals.initNode("/ECAM/warnings/logic/elec/gen-1-off"),
- gen2Off: props.globals.initNode("/ECAM/warnings/logic/elec/gen-2-off"),
- spdBrkOut: props.globals.initNode("/ECAM/warnings/fctl/spd-brk-still-out"),
- },
- Timers: {
- apuFaultOutput: props.globals.initNode("/ECAM/warnings/timer/apu-fault-output"),
- bleed1Fault: props.globals.initNode("/ECAM/warnings/timer/bleed-1-fault"),
- bleed1FaultOutput: props.globals.initNode("/ECAM/warnings/timer/bleed-1-fault-output"),
- bleed2Fault: props.globals.initNode("/ECAM/warnings/timer/bleed-2-fault"),
- bleed2FaultOutput: props.globals.initNode("/ECAM/warnings/timer/bleed-2-fault-output"),
- bleed1NotShutOutput: props.globals.initNode("/ECAM/warnings/timer/prv-1-not-shut-output"),
- bleed2NotShutOutput: props.globals.initNode("/ECAM/warnings/timer/prv-2-not-shut-output"),
- bleed1And2LoTemp: props.globals.initNode("/ECAM/warnings/timer/bleed-1-and-2-low-temp"),
- bleed1And2LoTempOutput: props.globals.initNode("/ECAM/warnings/timer/bleed-1-and-2-low-temp-output"),
- bleed1Off60Output: props.globals.initNode("/ECAM/warnings/logic/bleed-1-off-60-output"),
- bleed1Off5Output: props.globals.initNode("/ECAM/warnings/logic/bleed-1-off-5-output"),
- bleed2Off60Output: props.globals.initNode("/ECAM/warnings/logic/bleed-2-off-60-output"),
- bleed2Off5Output: props.globals.initNode("/ECAM/warnings/logic/bleed-2-off-5-output"),
- eng1AiceNotClsd: props.globals.initNode("/ECAM/warnings/timer/eng-aice-1-open-output"),
- eng2AiceNotClsd: props.globals.initNode("/ECAM/warnings/timer/eng-aice-2-open-output"),
- eng1AiceNotOpen: props.globals.initNode("/ECAM/warnings/timer/eng-aice-1-closed-output"),
- eng2AiceNotOpen: props.globals.initNode("/ECAM/warnings/timer/eng-aice-2-closed-output"),
- LRElevFault: props.globals.initNode("/ECAM/warnings/fctl/lrElevFault-output"),
- altnLaw: props.globals.initNode("/ECAM/warnings/fctl/altn-law-output"),
- directLaw: props.globals.initNode("/ECAM/warnings/fctl/direct-law-output"),
- waiLhiPr: props.globals.initNode("/ECAM/warnings/timer/wing-hi-pr-left"),
- waiRhiPr: props.globals.initNode("/ECAM/warnings/timer/wing-hi-pr-right"),
- pack1Fault: props.globals.initNode("/ECAM/warnings/timer/pack-1-fault-2"),
- pack2Fault: props.globals.initNode("/ECAM/warnings/timer/pack-2-fault-2"),
- pack1Off: props.globals.initNode("/ECAM/warnings/timer/pack-1-off"),
- pack2Off: props.globals.initNode("/ECAM/warnings/timer/pack-2-off"),
- trimAirFault: props.globals.initNode("/ECAM/warnings/timer/trim-air-fault"),
- yawDamper1Fault: props.globals.initNode("/ECAM/warnings/timer/yaw-damper-1-fault"),
- yawDamper2Fault: props.globals.initNode("/ECAM/warnings/timer/yaw-damper-2-fault"),
- navTerrFault: props.globals.initNode("/ECAM/warnings/timer/nav-gpws-terr-fault"),
- leftElevFail: props.globals.initNode("/ECAM/warnings/fctl/leftElevFault-output"),
- rightElevFail: props.globals.initNode("/ECAM/warnings/fctl/rightElevFault-output"),
- staticInverter: props.globals.initNode("/systems/electrical/some-electric-thingie/static-inverter-timer"),
- dcEmerConfig: props.globals.initNode("/ECAM/warnings/logic/dc-emer-config-output"),
- dc12Fault: props.globals.initNode("/ECAM/warnings/logic/dc-1-2-output"),
- dcEssFault: props.globals.initNode("/ECAM/warnings/logic/dc-ess-output"),
- dc1Fault: props.globals.initNode("/ECAM/warnings/logic/dc-1-output"),
- dc2Fault: props.globals.initNode("/ECAM/warnings/logic/dc-2-output"),
- dcBatFault: props.globals.initNode("/ECAM/warnings/logic/dc-bat-output"),
- ac1Fault: props.globals.initNode("/ECAM/warnings/logic/ac-1-output"),
- ac2Fault: props.globals.initNode("/ECAM/warnings/logic/ac-2-output"),
- acEssFault: props.globals.initNode("/ECAM/warnings/logic/ac-ess-output"),
- dcEssShed: props.globals.initNode("/ECAM/warnings/logic/dc-ess-shed-output"),
- acEssShed: props.globals.initNode("/ECAM/warnings/logic/ac-ess-shed-output"),
- centerPumpsOff: props.globals.initNode("/ECAM/warnings/fuel/center-pumps-off-output"),
- lowLevelBoth: props.globals.initNode("/ECAM/warnings/fuel/lo-level-l-r-output"),
- },
- Flipflops: {
- apuGenFault: props.globals.initNode("/ECAM/warnings/flipflop/apu-gen-fault"),
- apuGenFaultOnOff: props.globals.initNode("/ECAM/warnings/flipflop/apu-gen-fault-on-off"),
- bleed1LowTemp: props.globals.initNode("/ECAM/warnings/logic/bleed-1-low-temp-flipflop-output"),
- bleed2LowTemp: props.globals.initNode("/ECAM/warnings/logic/bleed-2-low-temp-flipflop-output"),
- gen1Fault: props.globals.initNode("/ECAM/warnings/flipflop/gen-1-fault"),
- gen2Fault: props.globals.initNode("/ECAM/warnings/flipflop/gen-2-fault"),
- gen1FaultOnOff: props.globals.initNode("/ECAM/warnings/flipflop/gen-1-fault-on-off"),
- gen2FaultOnOff: props.globals.initNode("/ECAM/warnings/flipflop/gen-2-fault-on-off"),
- pack1Ovht: props.globals.initNode("/ECAM/warnings/flipflop/pack-1-ovht"),
- pack2Ovht: props.globals.initNode("/ECAM/warnings/flipflop/pack-2-ovht"),
- parkBrk: props.globals.initNode("/ECAM/warnings/config/park-brk/park-brk-output"),
- eng1ThrLvrAbvIdle: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-thr-lvr-abv-idle"),
- eng2ThrLvrAbvIdle: props.globals.initNode("/ECAM/warnings/logic/eng/eng-2-thr-lvr-abv-idle"),
- },
-};
-
var warning = {
new: func(msg,colour = "g",aural = 9,light = 9,isMainMsg = 0,lastSubmsg = 0, sdPage = "nil", isMemo = 0) {
var t = {parents:[warning]};
@@ -243,7 +104,7 @@ var warning = {
},
callPage: func() {
if (me.sdPage == "nil" or me.hasCalled == 1) { return; }
- ecam.SystemDisplay.failCall(me.sdPage);
+ ecam.SystemDisplayController.failureCall(me.sdPage);
me.hasCalled = 1;
}
};
@@ -352,6 +213,7 @@ var ECAM_controller = {
if (counter < 9) {
w.write();
counter += 1;
+ w.callPage();
}
w.warnlight();
w.sound();
@@ -477,9 +339,14 @@ var ECAM_controller = {
}
}
- if (statusFlag == 1 and lines[0].getValue() == "") {
- ecam.SystemDisplay.manCall("sts");
+ if (!hasCleared and statusFlag) {
statusFlag = 0;
+ ecam.SystemDisplayController.manCall("statusPage");
+ return;
+ }
+
+ if (!hasCleared and !statusFlag) {
+ SystemDisplayController.manCall("CLR");
}
},
recall: func() {
diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas
index e29aabe2..43774174 100644
--- a/Nasal/ECAM/ECAM-logic.nas
+++ b/Nasal/ECAM/ECAM-logic.nas
@@ -1,6 +1,5 @@
# A3XX Electronic Centralised Aircraft Monitoring System
-
-# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp)
+# Copyright (c) 2021 Jonathan Redpath (legoboyvdlp)
# props.nas:
@@ -211,19 +210,19 @@ var messages_priority_3 = func {
}
# ENG FIRE
- if ((eng1FireFlAgent2.clearFlag == 0 and systems.eng1FireWarn.getValue() == 1 and phaseVar3 >= 5 and phaseVar3 <= 7) or (eng1FireGnEvac.clearFlag == 0 and systems.eng1FireWarn.getValue() == 1 and (phaseVar3 < 5 or phaseVar3 > 7))) {
+ if ((eng1Fire.clearFlag == 0 and systems.eng1FireWarn.getValue() == 1 and phaseVar3 >= 5 and phaseVar3 <= 7) or (eng1FireGnEvac.clearFlag == 0 and systems.eng1FireWarn.getValue() == 1 and (phaseVar3 < 5 or phaseVar3 > 7))) {
eng1Fire.active = 1;
} else {
ECAM_controller.warningReset(eng1Fire);
}
- if ((eng2FireFlAgent2.clearFlag == 0 and systems.eng2FireWarn.getValue() == 1 and phaseVar3 >= 5 and phaseVar3 <= 7) or (eng2FireGnEvac.clearFlag == 0 and systems.eng2FireWarn.getValue() == 1 and (phaseVar3 < 5 or phaseVar3 > 7))) {
+ if ((eng2Fire.clearFlag == 0 and systems.eng2FireWarn.getValue() == 1 and phaseVar3 >= 5 and phaseVar3 <= 7) or (eng2FireGnEvac.clearFlag == 0 and systems.eng2FireWarn.getValue() == 1 and (phaseVar3 < 5 or phaseVar3 > 7))) {
eng2Fire.active = 1;
} else {
ECAM_controller.warningReset(eng2Fire);
}
- if (apuFireMaster.clearFlag == 0 and systems.apuFireWarn.getValue() == 1) {
+ if (apuFire.clearFlag == 0 and systems.apuFireWarn.getValue() == 1) {
apuFire.active = 1;
} else {
ECAM_controller.warningReset(apuFire);
@@ -551,13 +550,13 @@ var messages_priority_3 = func {
apuFireAgentTimer.msg = " -AGENT AFT " ~ systems.apuAgentTimer.getValue() ~ " S...DISCH";
}
- if (apuFireAgent.clearFlag == 0 and systems.APUNodes.Controls.fire.getValue() and !systems.extinguisherBottles.vector[5].lightProp.getValue() and systems.apuAgentTimer.getValue() != 0) {
+ if (apuFireAgent.clearFlag == 0 and systems.APUNodes.Controls.fire.getValue() and !systems.extinguisherBottles.vector[4].lightProp.getValue() and systems.apuAgentTimer.getValue() != 0) {
apuFireAgentTimer.active = 1;
} else {
ECAM_controller.warningReset(apuFireAgentTimer);
}
- if (apuFireAgent.clearFlag == 0 and systems.APUNodes.Controls.fire.getValue() and !systems.extinguisherBottles.vector[5].lightProp.getValue() and systems.apuAgentTimer.getValue() == 0) {
+ if (apuFireAgent.clearFlag == 0 and systems.APUNodes.Controls.fire.getValue() and !systems.extinguisherBottles.vector[4].lightProp.getValue() and systems.apuAgentTimer.getValue() == 0) {
apuFireAgent.active = 1;
} else {
ECAM_controller.warningReset(apuFireAgent);
diff --git a/Nasal/ECAM/ECAM-main.nas b/Nasal/ECAM/ECAM-main.nas
index 7c3217a0..b1b619fe 100644
--- a/Nasal/ECAM/ECAM-main.nas
+++ b/Nasal/ECAM/ECAM-main.nas
@@ -5,9 +5,6 @@
var ap_active = 0;
var athr_active = 0;
-var engModeSel = 0;
-var APUMaster = 0;
-var APURPM = 0;
var apOffTime = props.globals.initNode("/ECAM/warnings/ap-off-time", 0, "INT");
var athrOffTime = props.globals.initNode("/ECAM/warnings/athr-off-time", 0, "INT");
var engStrtTimeSw = props.globals.initNode("/ECAM/engine-start-time-switch", 0, "BOOL");
@@ -28,6 +25,7 @@ var ECAM = {
engStrtTime.setValue(0);
apWarnNode.setValue(0);
athrWarnNode.setValue(0);
+ SystemDisplayController.init();
me.reset();
},
update_items: [
@@ -71,13 +69,12 @@ var ECAM = {
},
reset: func() {
for (var i = 0; i <= 8; i = i + 1) {
- setprop("ECAM/msg/line" ~ i, "");
- setprop("ECAM/rightmsg/line" ~ i, "");
- setprop("ECAM/msg/linec" ~ i, "w");
- setprop("ECAM/rightmsg/linec" ~ i, "w");
+ setprop("/ECAM/msg/line" ~ i, "");
+ setprop("/ECAM/rightmsg/line" ~ i, "");
+ setprop("/ECAM/msg/linec" ~ i, "w");
+ setprop("/ECAM/rightmsg/linec" ~ i, "w");
}
- page.setValue("door");
me.lights.apu.setValue(0);
me.lights.bleed.setValue(0);
me.lights.cond.setValue(0);
@@ -124,143 +121,19 @@ var ECAM = {
update_item.update(notification);
}
- SystemDisplay.update(notification);
-
- if (me._cachePage != SystemDisplay.page) {
- me.updateSDPage(SystemDisplay.page);
+ if (me._cachePage != SystemDisplayController.displayedPage.name) {
+ me.updateSDPage(SystemDisplayController.displayedPage.name);
}
},
updateSDPage: func(newPage) {
me._cachePage = newPage;
page.setValue(newPage);
},
- clrLight: func() {
- me.lights.clr.setValue(1);
- },
-};
-
-var SystemDisplay = {
- page: "",
-
- manShownPage: 0,
- failShownPage: 0,
- APU10sec: 9,
- eng10sec: 9,
- fctl20sc: 9,
- _apuTime: 0,
- _engTime: 0,
- _fctlTime: 0,
-
- failCall: func(page) {
- if (me.manShownPage) {
- me.manShownPage = 0;
- ECAMControlPanel.lightOff(me.page);
- }
- ECAMControlPanel.lightOn(page);
- me.page = page;
- me.failShownPage = 1;
- },
- manCall: func(page) {
- ECAMControlPanel.lightOff(me.page);
- ECAMControlPanel.lightOn(page);
- me.page = page;
- me.manShownPage = 1;
- },
- autoCall: func(page) {
- if (me.manShownPage or me.failShownPage) { return; }
- if (me.page != page) {
- me.page = page;
- }
- },
- update: func(notification) {
- APUMaster = systems.APUNodes.Controls.master.getValue();
- APURPM = pts.APU.rpm.getValue();
- engModeSel = pts.Controls.Engines.startSw.getValue();
-
- if (APUMaster == 1 and me.APU10sec != 1) {
- me.autoCall("apu");
- me.fctl20sec = 0;
-
- if (me.APU10sec == 9 and APURPM >= 95.0) {
- me.APU10sec = 0;
- me._apuTime = notification.elapsedTime;
- }
-
- if (me.APU10sec != 9 and notification.elapsedTime > me._apuTime + 10) {
- me.APU10sec = 1;
- }
- } elsif (engModeSel == 0 or engModeSel == 2 or (engModeSel == 1 and me.eng10sec == 0)) {
- me.autoCall("eng");
- me.fctl20sec = 0;
-
- if (me.eng10sec == 9 and engModeSel == 1) {
- me.eng10sec = 0;
- me._engTime = notification.elapsedTime;
- }
-
- if (me.eng10sec != 9 and notification.elapsedTime > me._engTime + 10) {
- me.eng10sec = 1;
- }
- } else {
- # Reset variables
- if (APUMaster == 0) {
- me.APU10sec = 9;
- }
- me.eng10sec = 9;
-
- # Phase logic
- if (notification.FWCPhase == 1) {
- me.autoCall("door");
- me.fctl20sec = 9;
- } elsif (notification.FWCPhase == 2) {
- if (notification.aileronFBW >= 0.15 or notification.elevatorFBW >= 0.15 and me.fctl20sec == 9) {
- me.autoCall("fctl");
-
- if (me.fctl20sec == 9) {
- me.fctl20sec = 0;
- me._fctlTime = notification.elapsedTime;
- }
-
- if (me.fctl20sec != 9 and notification.elapsedTime > me._fctlTime + 20) {
- me.fctl20sec = 1;
- }
- } elsif (me.fctl20sec == 0) {
- if (me.fctl20sec != 9 and notification.elapsedTime > me._fctlTime + 20) {
- me.fctl20sec = 1;
- }
- } else {
- me.autoCall("wheel");
- me.fctl20sec = 9;
- }
- } elsif (notification.FWCPhase >= 3 and notification.FWCPhase <= 5) {
- me.autoCall("eng");
- me.fctl20sec = 9;
- } elsif (notification.FWCPhase == 6) {
- if (notification.gearLever and notification.agl <= 16000) {
- me.autoCall("wheel");
- } else {
- me.autoCall("crz");
- }
- me.fctl20sec = 9;
- } elsif (notification.FWCPhase >= 7 and notification.FWCPhase <= 9) {
- me.autoCall("wheel");
- me.fctl20sec = 9;
- } elsif (notification.FWCPhase == 10) {
- me.autoCall("door");
- me.fctl20sec = 9;
- }
- }
- },
};
var ECAMControlPanel = {
sysPageBtn: func(page) {
- if (SystemDisplay.page != page) {
- SystemDisplay.manCall(page);
- } else {
- me.lightOff(SystemDisplay.page);
- SystemDisplay.manShownPage = 0;
- }
+ SystemDisplayController.manCall(page);
},
rclBtn: func() {
ecam.ECAM_controller.recall();
@@ -278,22 +151,12 @@ var ECAMControlPanel = {
return;
}
- if (SystemDisplay.manShownPage) {
- me.lightOff(SystemDisplay.page);
- SystemDisplay.manShownPage = 0;
- return;
- }
-
- if (SystemDisplay.failShownPage) {
- me.lightOff(SystemDisplay.page);
- SystemDisplay.failShownPage = 0;
- return;
- }
-
ecam.ECAM_controller.clear();
},
stsBtn: func() {
- SystemDisplay.manCall("sts");
+ if (SystemDisplayController.displayedPage.name != "statusPage") {
+ SystemDisplayController.manCall("statusPage");
+ }
},
allBtn: func() {
# todo
@@ -305,11 +168,11 @@ var ECAMControlPanel = {
# todo
},
lightOff: func(pageLightOff) {
- if (pageLightOff == "crz") { return; }
+ if (pageLightOff == "cruise") { return; }
ECAM.lights[pageLightOff].setBoolValue(0);
},
lightOn: func(pageLightOn) {
- if (pageLightOn == "crz") { return; }
+ if (pageLightOn == "cruise") { return; }
ECAM.lights[pageLightOn].setBoolValue(1);
},
};
diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas
index a0d2c854..e36d11bb 100644
--- a/Nasal/ECAM/ECAM-messages.nas
+++ b/Nasal/ECAM/ECAM-messages.nas
@@ -1,6 +1,5 @@
# A3XX Electronic Centralised Aircraft Monitoring System
-
-# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp)
+# Copyright (c) 2021 Jonathan Redpath (legoboyvdlp)
# messages stored in vectors
@@ -101,7 +100,7 @@ var warnings = std.Vector.new([
var ADR123FaultPROC = warning.new(msg: " -ALL ADR OFF PROC.APPLY", colour: "c"),
# APU FIRE
- var apuFire = warning.new(msg: "APU FIRE ", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "apu"),
+ var apuFire = warning.new(msg: "APU FIRE ", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "apuPage"),
var apuFirePB = warning.new(msg: " -APU FIRE P/B......PUSH", colour: "c"),
var apuFireAgentTimer = warning.new(msg: " -AGENT AFT 10 S...DISCH", colour: "c"),
var apuFireAgent = warning.new(msg: " -AGENT............DISCH", colour: "c"),
diff --git a/Nasal/ECAM/ECAM-nodes.nas b/Nasal/ECAM/ECAM-nodes.nas
new file mode 100644
index 00000000..21b38d32
--- /dev/null
+++ b/Nasal/ECAM/ECAM-nodes.nas
@@ -0,0 +1,212 @@
+# A3XX Electronic Centralised Aircraft Monitoring System
+# Copyright (c) 2021 Jonathan Redpath (legoboyvdlp)
+
+var FWC = {
+ Btn: {
+ clr: props.globals.initNode("/ECAM/buttons/clear-btn", 0, "BOOL"),
+ recall: props.globals.initNode("/ECAM/buttons/recall-btn", 0, "BOOL"),
+ recallStsNormal: props.globals.initNode("/ECAM/buttons/recall-status-normal", 0, "BOOL"),
+ recallStsNormalOutput: props.globals.initNode("/ECAM/buttons/recall-status-normal-output", 0, "BOOL"),
+ },
+ Monostable: {
+ phase1: props.globals.initNode("/ECAM/phases/monostable/phase-1-300", 0, "BOOL"),
+ phase5: props.globals.initNode("/ECAM/phases/monostable/phase-5", 0, "BOOL"),
+ phase5Temp: 0,
+ phase7: props.globals.initNode("/ECAM/phases/monostable/phase-7", 0, "BOOL"),
+ phase7Temp: 0,
+ phase9: props.globals.initNode("/ECAM/phases/monostable/phase-9", 0, "BOOL"),
+ phase1Output: props.globals.initNode("/ECAM/phases/monostable/phase-1-300-output"),
+ phase1OutputTemp: 0,
+ phase5Output: props.globals.initNode("/ECAM/phases/monostable/phase-5-output"),
+ phase5OutputTemp: 0,
+ phase7Output: props.globals.initNode("/ECAM/phases/monostable/phase-7-output"),
+ phase7OutputTemp: 0,
+ phase9Output: props.globals.initNode("/ECAM/phases/monostable/phase-9-output"),
+ toPowerOutput: props.globals.getNode("/ECAM/phases/monostable/to-power-set-output"),
+ m80kt: props.globals.getNode("/ECAM/phases/monostable-80kt"),
+ altAlert1: props.globals.initNode("/ECAM/altitude-alert-monostable-set", 0, "BOOL"),
+ altAlert1Output: props.globals.initNode("/ECAM/altitude-alert-monostable-output"),
+ altAlert2: props.globals.initNode("/ECAM/flipflop/altitude-alert-rs-set", 0, "BOOL"),
+ },
+ Flipflop: {
+ phase2Set: props.globals.initNode("/ECAM/phases/flipflop/phase-2-set", 0, "BOOL"),
+ phase2Reset: props.globals.initNode("/ECAM/phases/flipflop/phase-2-reset", 0, "BOOL"),
+ phase2Output: props.globals.initNode("/ECAM/phases/flipflop/phase-2-output", 0, "BOOL"),
+ phase2OutputTemp: 0,
+ phase10Set: props.globals.initNode("/ECAM/phases/flipflop/phase-10-set", 0, "BOOL"),
+ phase10Reset: props.globals.initNode("/ECAM/phases/flipflop/phase-10-reset", 0, "BOOL"),
+ phase10Output: props.globals.initNode("/ECAM/phases/flipflop/phase-10-output", 0, "BOOL"),
+ recallSet: props.globals.initNode("/ECAM/flipflop/recall-set", 0, "BOOL"),
+ recallReset: props.globals.initNode("/ECAM/flipflop/recall-reset", 0, "BOOL"),
+ recallOutput: props.globals.initNode("/ECAM/flipflop/recall-output", 0, "BOOL"),
+ recallOutputTemp: 0,
+ },
+ Logic: {
+ gnd: props.globals.getNode("/ECAM/logic/ground-calc-immediate"),
+ IRSinAlign: props.globals.initNode("/ECAM/irs-in-align", 0, "BOOL"),
+ feet1500: props.globals.getNode("/ECAM/phases/phase-calculation/altitude-ge-1500"),
+ feet800: props.globals.getNode("/ECAM/phases/phase-calculation/altitude-ge-800"),
+ },
+ Timer: {
+ eng1idle: props.globals.getNode("/ECAM/phases/timer/eng1idle"),
+ eng2idle: props.globals.getNode("/ECAM/phases/timer/eng2idle"),
+ eng1or2: props.globals.getNode("/ECAM/phases/phase-calculation/one-engine-running"),
+ toInhibit: props.globals.initNode("/ECAM/phases/timer/to-inhibit", 0, "INT"),
+ ldgInhibit: props.globals.initNode("/ECAM/phases/timer/ldg-inhibit", 0, "INT"),
+ eng1idleOutput: props.globals.getNode("/ECAM/phases/timer/eng1idle-output"),
+ eng2idleOutput: props.globals.getNode("/ECAM/phases/timer/eng2idle-output"),
+ eng1and2Off: props.globals.getNode("/ECAM/phases/phase-calculation/engines-1-2-not-running"),
+ eng1and2OffTemp: 0,
+ eng1or2Output: props.globals.getNode("/ECAM/phases/phase-calculation/engine-1-or-2-running"),
+ eng1or2OutputTemp: 0,
+ toInhibitOutput: props.globals.getNode("/ECAM/phases/timer/to-inhibit-output"),
+ ldgInhibitOutput: props.globals.getNode("/ECAM/phases/timer/ldg-inhibit-output"),
+ gnd: props.globals.getNode("/ECAM/timer/ground-calc"), # ZGND
+ gnd2Sec: props.globals.getNode("/ECAM/phases/monostable/gnd-output"),
+ gnd2SecHalf: props.globals.getNode("/ECAM/phases/monostable/gnd-output-2"), # hack to prevent getting confused between phase 5 / 6
+ },
+ speed80: props.globals.initNode("/ECAM/phases/speed-gt-80", 0, "BOOL"),
+ speed80Temp: 0,
+ toPower: props.globals.getNode("/ECAM/phases/phase-calculation/takeoff-power"),
+ toPowerTemp: 0,
+ altChg: props.globals.getNode("/it-autoflight/input/alt-is-changing", 1),
+};
+
+var warningNodes = {
+ Logic: {
+ altitudeAlert: props.globals.initNode("/ECAM/warnings/altitude-alert/c-chord"),
+ altitudeAlertSteady: props.globals.initNode("/ECAM/warnings/altitude-alert/altitude-alert-steady"),
+ altitudeAlertFlash: props.globals.initNode("/ECAM/warnings/altitude-alert/altitude-alert-flash"),
+ crossbleedFault: props.globals.initNode("/ECAM/warnings/logic/crossbleed-fault"),
+ crossbleedWai: props.globals.initNode("/ECAM/warnings/logic/crossbleed-wai"),
+ bleed1LoTempUnsuc: props.globals.initNode("/ECAM/warnings/logic/bleed-1-lo-temp-unsucc"),
+ bleed1LoTempXbleed: props.globals.initNode("/ECAM/warnings/logic/bleed-1-lo-temp-xbleed"),
+ bleed1LoTempBleed: props.globals.initNode("/ECAM/warnings/logic/bleed-1-lo-temp-bleed"),
+ bleed1LoTempPack: props.globals.initNode("/ECAM/warnings/logic/bleed-1-lo-temp-pack"),
+ bleed1WaiAvail: props.globals.initNode("/ECAM/warnings/logic/bleed-1-wai-avail"),
+ bleed2LoTempUnsuc: props.globals.initNode("/ECAM/warnings/logic/bleed-2-lo-temp-unsucc"),
+ bleed2LoTempXbleed: props.globals.initNode("/ECAM/warnings/logic/bleed-2-lo-temp-xbleed"),
+ bleed2LoTempBleed: props.globals.initNode("/ECAM/warnings/logic/bleed-2-lo-temp-bleed"),
+ bleed2LoTempPack: props.globals.initNode("/ECAM/warnings/logic/bleed-2-lo-temp-pack"),
+ bleed2WaiAvail: props.globals.initNode("/ECAM/warnings/logic/bleed-2-wai-avail"),
+ waiSysfault: props.globals.initNode("/ECAM/warnings/logic/wing-anti-ice-sys-fault"),
+ waiLclosed: props.globals.initNode("/ECAM/warnings/flipflop/wing-anti-ice-left-closed"),
+ waiRclosed: props.globals.initNode("/ECAM/warnings/flipflop/wing-anti-ice-right-closed"),
+ procWaiShutdown: props.globals.initNode("/ECAM/warnings/logic/proc-wai-shutdown-output"),
+ waiGndFlight: props.globals.initNode("/ECAM/warnings/logic/wing-anti-ice-gnd-fault"),
+ pack12Fault: props.globals.initNode("/ECAM/warnings/logic/pack-1-2-fault"),
+ pack1ResetPb: props.globals.initNode("/ECAM/warnings/logic/reset-pack-1-switch-cmd"),
+ pack2ResetPb: props.globals.initNode("/ECAM/warnings/logic/reset-pack-2-switch-cmd"),
+ cabinFans: props.globals.initNode("/ECAM/warnings/logic/cabin-fans-fault"),
+ rtlu1Fault: props.globals.initNode("/ECAM/warnings/logic/rud-trav-lim-sys-1-fault"),
+ rtlu2Fault: props.globals.initNode("/ECAM/warnings/logic/rud-trav-lim-sys-2-fault"),
+ rtlu12Fault: props.globals.initNode("/ECAM/warnings/logic/rud-trav-lim-sys-fault"),
+ fac12Fault: props.globals.initNode("/ECAM/warnings/logic/fac-12-fault"),
+ fac1Fault: props.globals.initNode("/ECAM/warnings/logic/fac-1-fault"),
+ fac2Fault: props.globals.initNode("/ECAM/warnings/logic/fac-2-fault"),
+ stallWarn: props.globals.initNode("/ECAM/warnings/logic/stall/stall-warn-on"),
+ yawDamper12Fault: props.globals.initNode("/ECAM/warnings/logic/yaw-damper-12-fault"),
+ gearNotDown1: props.globals.initNode("/ECAM/warnings/fctl/gear-not-down-not-cancellable"),
+ gearNotDown2: props.globals.initNode("/ECAM/warnings/fctl/gear-not-down-cancellable"),
+ gearNotDownLocked: props.globals.initNode("/ECAM/warnings/fctl/gear-not-down-locked"),
+ gearNotDownLockedFlipflop: props.globals.initNode("/ECAM/warnings/fctl/gear-not-downlocked-output"),
+ blueGreen: props.globals.initNode("/ECAM/warnings/hyd/blue-green-failure"),
+ blueGreenFuel: props.globals.initNode("/ECAM/warnings/hyd/blue-green-fuel-consumpt"),
+ blueYellow: props.globals.initNode("/ECAM/warnings/hyd/blue-yellow-failure"),
+ blueYellowFuel: props.globals.initNode("/ECAM/warnings/hyd/blue-yellow-fuel-consumpt"),
+ greenYellow: props.globals.initNode("/ECAM/warnings/hyd/green-yellow-failure"),
+ greenYellowFuel: props.globals.initNode("/ECAM/warnings/hyd/green-yellow-fuel-consumpt"),
+ leftElevFail: props.globals.initNode("/ECAM/warnings/fctl/leftElevFault"),
+ rightElevFail: props.globals.initNode("/ECAM/warnings/fctl/rightElevFault"),
+ flapNotZero: props.globals.initNode("/ECAM/warnings/fctl/flaps-not-zero"),
+ slatsConfig: props.globals.initNode("/ECAM/warnings/fctl/slats-config-output"),
+ flapsConfig: props.globals.initNode("/ECAM/warnings/fctl/flaps-config-output"),
+ spdBrkConfig: props.globals.initNode("/ECAM/warnings/fctl/spd-brk-config-output"),
+ pitchTrimConfig: props.globals.initNode("/ECAM/warnings/fctl/pitch-trim-config-output"),
+ rudTrimConfig: props.globals.initNode("/ECAM/warnings/fctl/rudder-trim-config-output"),
+ parkBrkConfig: props.globals.initNode("/ECAM/warnings/fctl/park-brk-config-output"),
+ slatsConfig2: props.globals.initNode("/ECAM/warnings/fctl/slats-config-range"),
+ flapsConfig2: props.globals.initNode("/ECAM/warnings/fctl/flaps-config-range"),
+ spdBrkConfig2: props.globals.initNode("/ECAM/warnings/fctl/spd-brk-config-range"),
+ pitchTrimConfig2: props.globals.initNode("/ECAM/warnings/fctl/pitch-trim-config-range"),
+ rudTrimConfig2: props.globals.initNode("/ECAM/warnings/fctl/rudder-trim-config-range"),
+ dcEssFuelConsumptionIncreased: props.globals.initNode("/ECAM/warnings/logic/dc-ess-fuel-consumption-increased"),
+ dcEssFMSPredictions: props.globals.initNode("/ECAM/warnings/logic/dc-ess-fms-predictions-unreliable"),
+ dc2FuelConsumptionIncreased: props.globals.initNode("/ECAM/warnings/logic/dc-2-fuel-consumption-increased"),
+ dc2FMSPredictions: props.globals.initNode("/ECAM/warnings/logic/dc-2-fms-predictions-unreliable"),
+ thrLeversNotSet: props.globals.initNode("/ECAM/warnings/logic/eng/thr-lever-not-set"),
+ revSet: props.globals.initNode("/ECAM/warnings/logic/eng/reverse-set"),
+ eng1Fail: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-fail"),
+ eng2Fail: props.globals.initNode("/ECAM/warnings/logic/eng/eng-2-fail"),
+ phase5Trans: props.globals.initNode("/ECAM/warnings/logic/eng/phase-5-output"),
+ eng1Shutdown: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-shutdown"),
+ eng2Shutdown: props.globals.initNode("/ECAM/warnings/logic/eng/eng-2-shutdown"),
+ acEssBusAltn: props.globals.initNode("/ECAM/warnings/logic/ac-ess-bus-altn-feed"),
+ gen1Off: props.globals.initNode("/ECAM/warnings/logic/elec/gen-1-off"),
+ gen2Off: props.globals.initNode("/ECAM/warnings/logic/elec/gen-2-off"),
+ spdBrkOut: props.globals.initNode("/ECAM/warnings/fctl/spd-brk-still-out"),
+ },
+ Timers: {
+ apuFaultOutput: props.globals.initNode("/ECAM/warnings/timer/apu-fault-output"),
+ bleed1Fault: props.globals.initNode("/ECAM/warnings/timer/bleed-1-fault"),
+ bleed1FaultOutput: props.globals.initNode("/ECAM/warnings/timer/bleed-1-fault-output"),
+ bleed2Fault: props.globals.initNode("/ECAM/warnings/timer/bleed-2-fault"),
+ bleed2FaultOutput: props.globals.initNode("/ECAM/warnings/timer/bleed-2-fault-output"),
+ bleed1NotShutOutput: props.globals.initNode("/ECAM/warnings/timer/prv-1-not-shut-output"),
+ bleed2NotShutOutput: props.globals.initNode("/ECAM/warnings/timer/prv-2-not-shut-output"),
+ bleed1And2LoTemp: props.globals.initNode("/ECAM/warnings/timer/bleed-1-and-2-low-temp"),
+ bleed1And2LoTempOutput: props.globals.initNode("/ECAM/warnings/timer/bleed-1-and-2-low-temp-output"),
+ bleed1Off60Output: props.globals.initNode("/ECAM/warnings/logic/bleed-1-off-60-output"),
+ bleed1Off5Output: props.globals.initNode("/ECAM/warnings/logic/bleed-1-off-5-output"),
+ bleed2Off60Output: props.globals.initNode("/ECAM/warnings/logic/bleed-2-off-60-output"),
+ bleed2Off5Output: props.globals.initNode("/ECAM/warnings/logic/bleed-2-off-5-output"),
+ eng1AiceNotClsd: props.globals.initNode("/ECAM/warnings/timer/eng-aice-1-open-output"),
+ eng2AiceNotClsd: props.globals.initNode("/ECAM/warnings/timer/eng-aice-2-open-output"),
+ eng1AiceNotOpen: props.globals.initNode("/ECAM/warnings/timer/eng-aice-1-closed-output"),
+ eng2AiceNotOpen: props.globals.initNode("/ECAM/warnings/timer/eng-aice-2-closed-output"),
+ LRElevFault: props.globals.initNode("/ECAM/warnings/fctl/lrElevFault-output"),
+ altnLaw: props.globals.initNode("/ECAM/warnings/fctl/altn-law-output"),
+ directLaw: props.globals.initNode("/ECAM/warnings/fctl/direct-law-output"),
+ waiLhiPr: props.globals.initNode("/ECAM/warnings/timer/wing-hi-pr-left"),
+ waiRhiPr: props.globals.initNode("/ECAM/warnings/timer/wing-hi-pr-right"),
+ pack1Fault: props.globals.initNode("/ECAM/warnings/timer/pack-1-fault-2"),
+ pack2Fault: props.globals.initNode("/ECAM/warnings/timer/pack-2-fault-2"),
+ pack1Off: props.globals.initNode("/ECAM/warnings/timer/pack-1-off"),
+ pack2Off: props.globals.initNode("/ECAM/warnings/timer/pack-2-off"),
+ trimAirFault: props.globals.initNode("/ECAM/warnings/timer/trim-air-fault"),
+ yawDamper1Fault: props.globals.initNode("/ECAM/warnings/timer/yaw-damper-1-fault"),
+ yawDamper2Fault: props.globals.initNode("/ECAM/warnings/timer/yaw-damper-2-fault"),
+ navTerrFault: props.globals.initNode("/ECAM/warnings/timer/nav-gpws-terr-fault"),
+ leftElevFail: props.globals.initNode("/ECAM/warnings/fctl/leftElevFault-output"),
+ rightElevFail: props.globals.initNode("/ECAM/warnings/fctl/rightElevFault-output"),
+ staticInverter: props.globals.initNode("/systems/electrical/some-electric-thingie/static-inverter-timer"),
+ dcEmerConfig: props.globals.initNode("/ECAM/warnings/logic/dc-emer-config-output"),
+ dc12Fault: props.globals.initNode("/ECAM/warnings/logic/dc-1-2-output"),
+ dcEssFault: props.globals.initNode("/ECAM/warnings/logic/dc-ess-output"),
+ dc1Fault: props.globals.initNode("/ECAM/warnings/logic/dc-1-output"),
+ dc2Fault: props.globals.initNode("/ECAM/warnings/logic/dc-2-output"),
+ dcBatFault: props.globals.initNode("/ECAM/warnings/logic/dc-bat-output"),
+ ac1Fault: props.globals.initNode("/ECAM/warnings/logic/ac-1-output"),
+ ac2Fault: props.globals.initNode("/ECAM/warnings/logic/ac-2-output"),
+ acEssFault: props.globals.initNode("/ECAM/warnings/logic/ac-ess-output"),
+ dcEssShed: props.globals.initNode("/ECAM/warnings/logic/dc-ess-shed-output"),
+ acEssShed: props.globals.initNode("/ECAM/warnings/logic/ac-ess-shed-output"),
+ centerPumpsOff: props.globals.initNode("/ECAM/warnings/fuel/center-pumps-off-output"),
+ lowLevelBoth: props.globals.initNode("/ECAM/warnings/fuel/lo-level-l-r-output"),
+ },
+ Flipflops: {
+ apuGenFault: props.globals.initNode("/ECAM/warnings/flipflop/apu-gen-fault"),
+ apuGenFaultOnOff: props.globals.initNode("/ECAM/warnings/flipflop/apu-gen-fault-on-off"),
+ bleed1LowTemp: props.globals.initNode("/ECAM/warnings/logic/bleed-1-low-temp-flipflop-output"),
+ bleed2LowTemp: props.globals.initNode("/ECAM/warnings/logic/bleed-2-low-temp-flipflop-output"),
+ gen1Fault: props.globals.initNode("/ECAM/warnings/flipflop/gen-1-fault"),
+ gen2Fault: props.globals.initNode("/ECAM/warnings/flipflop/gen-2-fault"),
+ gen1FaultOnOff: props.globals.initNode("/ECAM/warnings/flipflop/gen-1-fault-on-off"),
+ gen2FaultOnOff: props.globals.initNode("/ECAM/warnings/flipflop/gen-2-fault-on-off"),
+ pack1Ovht: props.globals.initNode("/ECAM/warnings/flipflop/pack-1-ovht"),
+ pack2Ovht: props.globals.initNode("/ECAM/warnings/flipflop/pack-2-ovht"),
+ parkBrk: props.globals.initNode("/ECAM/warnings/config/park-brk/park-brk-output"),
+ eng1ThrLvrAbvIdle: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-thr-lvr-abv-idle"),
+ eng2ThrLvrAbvIdle: props.globals.initNode("/ECAM/warnings/logic/eng/eng-2-thr-lvr-abv-idle"),
+ },
+};
\ No newline at end of file
diff --git a/Nasal/ECAM/ECAM-phases.nas b/Nasal/ECAM/ECAM-phases.nas
index edccc4c4..6b959355 100644
--- a/Nasal/ECAM/ECAM-phases.nas
+++ b/Nasal/ECAM/ECAM-phases.nas
@@ -1,76 +1,7 @@
# A3XX FWC Phases
+# Copyright (c) 2021 Jonathan Redpath (legoboyvdlp)
-# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp)
-
-var myPhase = nil;
-var eng = nil;
-var eng1epr = nil;
-var eng2epr = nil;
-var eng1n1 = nil;
-var eng2n1 = nil;
-var master1 = nil;
-var master2 = nil;
-var gear_agl_cur = nil;
-
-var FWC = {
- Btn: {
- clr: props.globals.initNode("/ECAM/buttons/clear-btn", 0, "BOOL"),
- recall: props.globals.initNode("/ECAM/buttons/recall-btn", 0, "BOOL"),
- recallStsNormal: props.globals.initNode("/ECAM/buttons/recall-status-normal", 0, "BOOL"),
- recallStsNormalOutput: props.globals.initNode("/ECAM/buttons/recall-status-normal-output", 0, "BOOL"),
- },
- Monostable: {
- phase1: props.globals.initNode("/ECAM/phases/monostable/phase-1-300", 0, "BOOL"),
- phase5: props.globals.initNode("/ECAM/phases/monostable/phase-5", 0, "BOOL"),
- phase7: props.globals.initNode("/ECAM/phases/monostable/phase-7", 0, "BOOL"),
- phase9: props.globals.initNode("/ECAM/phases/monostable/phase-9", 0, "BOOL"),
- phase1Output: props.globals.initNode("/ECAM/phases/monostable/phase-1-300-output"),
- phase5Output: props.globals.initNode("/ECAM/phases/monostable/phase-5-output"),
- phase7Output: props.globals.initNode("/ECAM/phases/monostable/phase-7-output"),
- phase9Output: props.globals.initNode("/ECAM/phases/monostable/phase-9-output"),
- toPowerOutput: props.globals.getNode("/ECAM/phases/monostable/to-power-set-output"),
- m80kt: props.globals.getNode("/ECAM/phases/monostable-80kt"),
- altAlert1: props.globals.initNode("/ECAM/altitude-alert-monostable-set", 0, "BOOL"),
- altAlert1Output: props.globals.initNode("/ECAM/altitude-alert-monostable-output"),
- altAlert2: props.globals.initNode("/ECAM/flipflop/altitude-alert-rs-set", 0, "BOOL"),
- },
- Flipflop: {
- phase2Set: props.globals.initNode("/ECAM/phases/flipflop/phase-2-set", 0, "BOOL"),
- phase2Reset: props.globals.initNode("/ECAM/phases/flipflop/phase-2-reset", 0, "BOOL"),
- phase2Output: props.globals.initNode("/ECAM/phases/flipflop/phase-2-output", 0, "BOOL"),
- phase10Set: props.globals.initNode("/ECAM/phases/flipflop/phase-10-set", 0, "BOOL"),
- phase10Reset: props.globals.initNode("/ECAM/phases/flipflop/phase-10-reset", 0, "BOOL"),
- phase10Output: props.globals.initNode("/ECAM/phases/flipflop/phase-10-output", 0, "BOOL"),
- recallSet: props.globals.initNode("/ECAM/flipflop/recall-set", 0, "BOOL"),
- recallReset: props.globals.initNode("/ECAM/flipflop/recall-reset", 0, "BOOL"),
- recallOutput: props.globals.initNode("/ECAM/flipflop/recall-output", 0, "BOOL"),
- },
- Logic: {
- gnd: props.globals.getNode("/ECAM/logic/ground-calc-immediate"),
- IRSinAlign: props.globals.initNode("/ECAM/irs-in-align", 0, "BOOL"),
- feet1500: props.globals.getNode("/ECAM/phases/phase-calculation/altitude-ge-1500"),
- feet800: props.globals.getNode("/ECAM/phases/phase-calculation/altitude-ge-800"),
- },
- Timer: {
- eng1idle: props.globals.getNode("/ECAM/phases/timer/eng1idle"),
- eng2idle: props.globals.getNode("/ECAM/phases/timer/eng2idle"),
- eng1or2: props.globals.getNode("/ECAM/phases/phase-calculation/one-engine-running"),
- toInhibit: props.globals.initNode("/ECAM/phases/timer/to-inhibit", 0, "INT"),
- ldgInhibit: props.globals.initNode("/ECAM/phases/timer/ldg-inhibit", 0, "INT"),
- eng1idleOutput: props.globals.getNode("/ECAM/phases/timer/eng1idle-output"),
- eng2idleOutput: props.globals.getNode("/ECAM/phases/timer/eng2idle-output"),
- eng1and2Off: props.globals.getNode("/ECAM/phases/phase-calculation/engines-1-2-not-running"),
- eng1or2Output: props.globals.getNode("/ECAM/phases/phase-calculation/engine-1-or-2-running"),
- toInhibitOutput: props.globals.getNode("/ECAM/phases/timer/to-inhibit-output"),
- ldgInhibitOutput: props.globals.getNode("/ECAM/phases/timer/ldg-inhibit-output"),
- gnd: props.globals.getNode("/ECAM/timer/ground-calc"), # ZGND
- gnd2Sec: props.globals.getNode("/ECAM/phases/monostable/gnd-output"),
- gnd2SecHalf: props.globals.getNode("/ECAM/phases/monostable/gnd-output-2"), # hack to prevent getting confused between phase 5 / 6
- },
- speed80: props.globals.initNode("/ECAM/phases/speed-gt-80", 0, "BOOL"),
- toPower: props.globals.getNode("/ECAM/phases/phase-calculation/takeoff-power"),
- altChg: props.globals.getNode("/it-autoflight/input/alt-is-changing", 1),
-};
+var currentPhase = nil;
var gnd = nil;
var gndTimer = nil;
@@ -79,124 +10,77 @@ var phaseLoop = func() {
if ((systems.ELEC.Bus.acEss.getValue() < 110 and systems.ELEC.Bus.ac2.getValue() < 110) or pts.Acconfig.running.getBoolValue()) { return; }
if (pts.Sim.Replay.replayActive.getBoolValue()) { return; }
- myPhase = pts.ECAM.fwcWarningPhase.getValue();
- eng = pts.Options.eng.getValue();
- eng1epr = pts.Engines.Engine.eprActual[0].getValue();
- eng2epr = pts.Engines.Engine.eprActual[1].getValue();
- eng1n1 = pts.Engines.Engine.n1Actual[0].getValue();
- eng2n1 = pts.Engines.Engine.n1Actual[1].getValue();
- master1 = pts.Controls.Engines.Engine.cutoffSw[0].getBoolValue();
- master2 = pts.Controls.Engines.Engine.cutoffSw[1].getBoolValue();
+ currentPhase = pts.ECAM.fwcWarningPhase.getValue();
gnd = FWC.Logic.gnd.getBoolValue();
gndTimer = FWC.Timer.gnd.getValue();
- FWC.Flipflop.recallReset.setValue(0);
+
+ if (FWC.Flipflop.recallReset.getValue() != 0) {
+ FWC.Flipflop.recallReset.setValue(0);
+ }
- # Various things
+ FWC.toPowerTemp = FWC.toPower.getBoolValue();
+ FWC.Timer.eng1and2OffTemp = FWC.Timer.eng1and2Off.getValue();
+ FWC.Timer.eng1or2OutputTemp = FWC.Timer.eng1or2Output.getBoolValue();
+ FWC.speed80Temp = FWC.speed80.getBoolValue();
- if (myPhase == 9) {
- FWC.Monostable.phase9.setBoolValue(1);
- } else {
- FWC.Monostable.phase9.setBoolValue(0);
- }
+ FWC.Monostable.phase1OutputTemp = FWC.Monostable.phase1Output.getBoolValue();
+ FWC.Flipflop.phase2OutputTemp = FWC.Flipflop.phase2Output.getBoolValue();
+ FWC.Monostable.phase5Temp = FWC.Monostable.phase5.getBoolValue();
+ FWC.Monostable.phase5OutputTemp = FWC.Monostable.phase5Output.getBoolValue();
+ FWC.Monostable.phase7Temp = FWC.Monostable.phase7.getBoolValue();
+ FWC.Monostable.phase7OutputTemp = FWC.Monostable.phase7Output.getBoolValue();
- # Phase 1 / 10 flipflop
- if (myPhase == 9) {
- FWC.Flipflop.phase10Set.setBoolValue(1);
- } else {
- FWC.Flipflop.phase10Set.setBoolValue(0);
- }
-
- if (gndTimer == 1 and pts.Controls.Engines.Engine.firePb[0].getBoolValue()) {
- FWC.Flipflop.phase10Reset.setBoolValue(1);
- } else {
- FWC.Flipflop.phase10Reset.setBoolValue(0);
- }
-
- if ((gnd and FWC.Timer.eng1and2Off.getValue() and myPhase == 9) and FWC.Flipflop.phase10Output.getBoolValue()) {
- FWC.Monostable.phase1.setBoolValue(1); # true for 300 sec then false
- } else {
- FWC.Monostable.phase1.setBoolValue(0);
- }
-
- # Phase 2 flipflop
- if (myPhase == 3 or myPhase == 8) {
- FWC.Flipflop.phase2Set.setBoolValue(1);
- } else {
- FWC.Flipflop.phase2Set.setBoolValue(0);
- }
-
- if (!FWC.Monostable.m80kt.getBoolValue() and myPhase != 9 and ((!FWC.Monostable.phase9Output.getBoolValue() and gndTimer == 1) or (!FWC.Monostable.toPowerOutput.getBoolValue() and gndTimer == 1))) {
- FWC.Flipflop.phase2Reset.setBoolValue(1);
- } else {
- FWC.Flipflop.phase2Reset.setBoolValue(0);
- }
-
- gear_agl_cur = pts.Position.gearAglFt.getValue();
-
- # Phase 5 monostable
- if (FWC.toPower.getBoolValue() and (!FWC.Logic.feet1500.getBoolValue() and !gnd and FWC.Timer.gnd2Sec.getValue() != 1)) {
- FWC.Monostable.phase5.setBoolValue(1);
- } else {
- FWC.Monostable.phase5.setBoolValue(0);
- }
-
- # Phase 7 monostable
- if (!FWC.toPower.getBoolValue() and !FWC.Logic.feet1500.getBoolValue() and !FWC.Logic.feet800.getBoolValue() and !gnd and FWC.Timer.gnd2Sec.getValue() != 1) {
- FWC.Monostable.phase7.setBoolValue(1);
- } else {
- FWC.Monostable.phase7.setBoolValue(0);
- }
-
- # Actual Phases
- if ((gnd and FWC.Timer.eng1and2Off.getValue() and myPhase != 9) and !FWC.Monostable.phase1Output.getBoolValue()) {
+ # Set Phases
+ if ((gnd and FWC.Timer.eng1and2OffTemp and currentPhase != 9) and !FWC.Monostable.phase1OutputTemp) {
setPhase(1);
}
- if (FWC.Timer.eng1or2Output.getBoolValue() and (gnd and !FWC.toPower.getBoolValue() and !FWC.speed80.getBoolValue()) and !FWC.Flipflop.phase2Output.getBoolValue()) {
+ if (FWC.Timer.eng1or2OutputTemp and (gnd and !FWC.toPowerTemp and !FWC.speed80Temp) and !FWC.Flipflop.phase2OutputTemp) {
setPhase(2);
}
- if (FWC.Timer.eng1or2Output.getBoolValue() and (gndTimer == 1 and FWC.toPower.getBoolValue()) and !FWC.speed80.getBoolValue()) {
+ if (FWC.Timer.eng1or2OutputTemp and (gndTimer == 1 and FWC.toPowerTemp) and !FWC.speed80Temp) {
setPhase(3);
}
- if ((gndTimer == 1 and FWC.toPower.getBoolValue()) and FWC.speed80.getBoolValue()) {
+ if ((gndTimer == 1 and FWC.toPowerTemp) and FWC.speed80Temp) {
setPhase(4);
}
- if (FWC.Monostable.phase5.getBoolValue() and FWC.Monostable.phase5Output.getBoolValue()) {
+ if (FWC.Monostable.phase5Temp and FWC.Monostable.phase5OutputTemp) {
setPhase(5);
}
- if (!gnd and FWC.Timer.gnd2SecHalf.getValue() != 1 and (!FWC.Monostable.phase5.getBoolValue() or !FWC.Monostable.phase5Output.getBoolValue()) and (!FWC.Monostable.phase7.getBoolValue() or !FWC.Monostable.phase7Output.getBoolValue())) {
+ if (!gnd and FWC.Timer.gnd2SecHalf.getValue() != 1 and (!FWC.Monostable.phase5Temp or !FWC.Monostable.phase5OutputTemp) and (!FWC.Monostable.phase7Temp or !FWC.Monostable.phase7OutputTemp)) {
setPhase(6);
}
- if ((FWC.Monostable.phase7.getBoolValue() and FWC.Monostable.phase7Output.getBoolValue()) and myPhase != 8) {
+ if ((FWC.Monostable.phase7Temp and FWC.Monostable.phase7OutputTemp) and currentPhase != 8) {
setPhase(7);
}
- if (!FWC.toPower.getBoolValue() and FWC.speed80.getBoolValue() and (gnd or FWC.Timer.gnd2Sec.getValue == 1)) {
+ if (!FWC.toPowerTemp and FWC.speed80Temp and (gnd or FWC.Timer.gnd2Sec.getValue() == 1)) {
setPhase(8);
}
- if (FWC.Flipflop.phase2Output.getBoolValue() and (gnd and !FWC.toPower.getBoolValue() and !FWC.speed80.getBoolValue()) and FWC.Timer.eng1or2.getBoolValue()) {
+ if (FWC.Flipflop.phase2OutputTemp and (gnd and !FWC.toPowerTemp and !FWC.speed80Temp) and FWC.Timer.eng1or2.getBoolValue()) {
setPhase(9);
}
- if ((gnd and FWC.Timer.eng1and2Off.getValue() and myPhase == 9) and FWC.Monostable.phase1Output.getBoolValue()) {
+ if ((gnd and FWC.Timer.eng1and2OffTemp and currentPhase == 9) and FWC.Monostable.phase1OutputTemp) {
setPhase(10);
}
# FWC Inhibiting
- myPhase = pts.ECAM.fwcWarningPhase.getValue();
- if (myPhase >= 3 and myPhase <= 5 and !FWC.Flipflop.recallOutput.getValue()) {
+ currentPhase = pts.ECAM.fwcWarningPhase.getValue();
+ FWC.Flipflop.recallOutputTemp = FWC.Flipflop.recallOutput.getValue();
+ if (currentPhase >= 3 and currentPhase <= 5 and !FWC.Flipflop.recallOutputTemp) {
FWC.Timer.toInhibit.setValue(1);
} else {
FWC.Timer.toInhibit.setValue(0);
}
- if (myPhase == 7 or myPhase == 8 and !FWC.Flipflop.recallOutput.getValue()) {
+ if (currentPhase == 7 or currentPhase == 8 and !FWC.Flipflop.recallOutputTemp) {
FWC.Timer.ldgInhibit.setValue(1);
} else {
FWC.Timer.ldgInhibit.setValue(0);
@@ -215,7 +99,3 @@ var setPhase = func(newPhase) {
setlistener("/ECAM/buttons/recall-btn", func() {
FWC.Flipflop.recallSet.setValue(FWC.Btn.recall.getBoolValue());
}, 0, 0);
-
-var clrBtn = func(btn) {
- FWC.Btn.clr.setValue(btn);
-}
diff --git a/Nasal/ECAM/SystemDisplay.nas b/Nasal/ECAM/SystemDisplay.nas
new file mode 100644
index 00000000..7fa71d20
--- /dev/null
+++ b/Nasal/ECAM/SystemDisplay.nas
@@ -0,0 +1,335 @@
+# A3XX System Display Controller
+# Copyright (c) 2021 Jonathan Redpath (legoboyvdlp)
+
+var Page = {
+ new: func(name) {
+ var page = {parents:[Page]};
+ page.name = name;
+ return page;
+ },
+};
+
+var SystemDisplayController = {
+ PageList: {
+ apuPage: Page.new("apu"),
+ bleedPage: Page.new("bleed"),
+ cabPressPage: Page.new("press"),
+ condPage: Page.new("cond"),
+ cruisePage: Page.new("cruise"),
+ doorPage: Page.new("door"),
+ enginePage: Page.new("eng"),
+ elecPage: Page.new("elec"),
+ fctlPage: Page.new("fctl"),
+ fuelPage: Page.new("fuel"),
+ hydraulicPage: Page.new("hyd"),
+ statusPage: Page.new("sts"),
+ wheelPage: Page.new("wheel"),
+ },
+ displayedPage: nil,
+ lastDisplayedPage: nil,
+ lastMode: nil,
+ mode: 0, # 0 = man, 1 = warning, 2 = advisory (not used yet), 3 = auto
+ tempFWCPhase: nil,
+ tempElapsedTime: nil,
+ tempEngineModeSel: nil,
+ init: func() {
+ me.displayedPage = me.PageList.doorPage;
+ ECAMTimer.start();
+ },
+ autoCallLoop: func() {
+ me.tempFWCPhase = pts.ECAM.fwcWarningPhase.getValue();
+
+ if (me.Display.APU) {
+ me.displayedPage = me.PageList.apuPage;
+ } else if (me.Display.Engine) {
+ me.displayedPage = me.PageList.enginePage;
+ } else if (me.tempFWCPhase == 1) {
+ if (me.Display.Elec) {
+ me.displayedPage = me.PageList.elecPage;
+ } else {
+ me.displayedPage = me.PageList.doorPage;
+ }
+ } else if (me.tempFWCPhase == 2) {
+ if (me.Display.Elec) {
+ me.displayedPage = me.PageList.elecPage;
+ } else if (me.Display.FCTL) {
+ me.displayedPage = me.PageList.fctlPage;
+ } else {
+ me.displayedPage = me.PageList.wheelPage;
+ }
+ } else if (me.tempFWCPhase == 3 or me.tempFWCPhase == 4 or me.tempFWCPhase == 5) {
+ me.displayedPage = me.PageList.enginePage;
+ } else if (me.tempFWCPhase == 6) {
+ if (pts.Controls.Gear.gearDown.getValue() and me.altitudeBelow16000) {
+ me.displayedPage = me.PageList.wheelPage;
+ } else if (me.Display.Cruise) {
+ me.displayedPage = me.PageList.cruisePage;
+ } else {
+ me.displayedPage = me.PageList.enginePage;
+ }
+ } else if (me.tempFWCPhase == 7) {
+ me.displayedPage = me.PageList.wheelPage;
+ } else if (me.tempFWCPhase == 8 or me.tempFWCPhase == 9) {
+ if (me.Display.Elec) {
+ me.displayedPage = me.PageList.elecPage;
+ } else {
+ me.displayedPage = me.PageList.wheelPage;
+ }
+ } else if (me.tempFWCPhase == 10) {
+ if (me.Display.Elec) {
+ me.displayedPage = me.PageList.elecPage;
+ } else {
+ me.displayedPage = me.PageList.doorPage;
+ }
+ }
+ },
+ Timers: {
+ APUTimeOn: 0,
+ APUTime: 0,
+ CruiseTime: 0,
+ CruiseTimeOn: 0,
+ EngineTime: 0,
+ EngineTimeStart: 0,
+ EngineTimeOn: 0,
+ FCTLTimeStart: 0,
+ FCTLTimeOn: 0,
+ FCTLTime: 0,
+ },
+ Display: {
+ APU: 0,
+ Cruise: 0,
+ Elec: 0,
+ Engine: 0,
+ FCTL: 0,
+ },
+ altitudeBelow16000: 0,
+ update: func() {
+ me.tempElapsedTime = pts.Sim.Time.elapsedSec.getValue();
+
+ me.altitude = pts.Position.altitudeFt.getValue();
+ if (me.altitude < 16000) {
+ if (!me.altitudeBelow16000) {
+ me.altitudeBelow16000 = 1;
+ me.autoCallLoop();
+ }
+ } else {
+ if (me.altitudeBelow16000) {
+ me.altitudeBelow16000 = 0;
+ me.autoCallLoop();
+ }
+ }
+
+ if (systems.ELEC.Switch.emerGenTest.getValue()) {
+ if (!me.Display.Elec) {
+ me.Display.Elec = 1;
+ me.autoCallLoop();
+ }
+ } else {
+ if (me.Display.Elec) {
+ me.Display.Elec = 0;
+ me.autoCallLoop();
+ }
+ }
+
+ if (systems.APUNodes.Controls.master.getValue()) {
+ if (pts.APU.rpm.getValue() > 95 and !me.Timers.APUTimeOn) {
+ me.Timers.APUTimeOn = 1;
+ me.Timers.APUTime = me.tempElapsedTime;
+ }
+
+ if ((me.Timers.APUTimeOn and (me.tempElapsedTime - me.Timers.APUTime) < 10) or !me.Timers.APUTimeOn) {
+ if (!me.Display.APU) {
+ me.Display.APU = 1;
+ me.autoCallLoop();
+ }
+ } else {
+ if (me.Display.APU) {
+ me.Display.APU = 0;
+ me.autoCallLoop();
+ }
+ }
+ } else {
+ me.Timers.APUTimeOn = 0;
+ me.Timers.APUTime = 0;
+ if (me.Display.APU) {
+ me.Display.APU = 0;
+ me.autoCallLoop();
+ }
+ }
+
+ if (abs(pts.Controls.Flight.aileron.getValue()) > 0.05 or abs(pts.Controls.Flight.elevator.getValue()) > 0.05 or abs(pts.Controls.Flight.rudder.getValue()) > 0.50) {
+ me.Timers.FCTLTimeStart = 1;
+ if (!me.Display.FCTL) {
+ me.Display.FCTL = 1;
+ me.autoCallLoop();
+ }
+ me.autoCallLoop();
+ } else {
+ if (!me.Timers.FCTLTimeOn and me.Timers.FCTLTimeStart) {
+ me.Timers.FCTLTimeOn = 1;
+ me.Timers.FCTLTimeStart = 0;
+ me.Timers.FCTLTime = me.tempElapsedTime;
+ } else if (me.Timers.FCTLTimeOn) {
+ if ((me.tempElapsedTime - me.Timers.FCTLTime) < 20) {
+ if (!me.Display.FCTL) {
+ me.Display.FCTL = 1;
+ me.autoCallLoop();
+ }
+ } else {
+ me.Timers.FCTLTimeOn = 0;
+ me.Timers.FCTLTime = 0;
+ }
+ } else {
+ if (me.Display.FCTL) {
+ me.Display.FCTL = 0;
+ me.autoCallLoop();
+ }
+ me.Timers.FCTLTime = 0;
+ }
+ }
+
+ me.tempFWCPhase = pts.ECAM.fwcWarningPhase.getValue();
+ if (me.tempFWCPhase == 6) {
+ if (!ecam.FWC.toPower.getValue() and pts.Controls.Flight.flapsPos.getValue() == 0) {
+ if (!me.Display.Cruise) {
+ me.Display.Cruise = 1;
+ me.autoCallLoop();
+ }
+ } else if (!me.Display.Cruise) {
+ if (!me.Timers.CruiseTimeOn) {
+ me.Timers.CruiseTimeOn = 1;
+ me.Timers.CruiseTime = me.tempElapsedTime;
+ } else {
+ if ((me.tempElapsedTime - me.Timers.CruiseTime) > 60) {
+ if (!me.Display.Cruise) {
+ me.Display.Cruise = 1;
+ me.autoCallLoop();
+ }
+ }
+ }
+ }
+ } else {
+ me.Timers.CruiseTime = 0;
+ me.Timers.CruiseTimeOn = 0;
+ if (me.Display.Cruise) {
+ me.Display.Cruise = 0;
+ me.autoCallLoop();
+ }
+ }
+
+ me.tempEngineModeSel = pts.Controls.Engines.startSw.getValue();
+ if (me.tempEngineModeSel == 0 or me.tempEngineModeSel == 2) {
+ if (!me.Display.Engine) {
+ me.Display.Engine = 1;
+ me.autoCallLoop();
+ }
+
+ if (me.tempEngineModeSel == 2) {
+ me.Timers.EngineTimeStart = 1;
+ }
+ } else {
+ if (me.Timers.EngineTimeStart and !me.Timers.EngineTimeOn) {
+ me.Timers.EngineTimeOn = 1;
+ me.Timers.EngineTime = me.tempElapsedTime;
+ }
+
+ if (me.Timers.EngineTimeOn) {
+ if ((me.tempElapsedTime - me.Timers.EngineTime) < 10) {
+ if (!me.Display.Engine) {
+ me.Display.Engine = 1;
+ me.autoCallLoop();
+ }
+ } else {
+ me.Timers.EngineTimeStart = 0;
+ me.Timers.EngineTimeOn = 0;
+ me.Timers.EngineTime = 0;
+ if (me.Display.Engine) {
+ me.Display.Engine = 0;
+ me.autoCallLoop();
+ }
+ }
+ } else {
+ if (me.Display.Engine) {
+ me.Display.Engine = 0;
+ me.autoCallLoop();
+ }
+ }
+ }
+ },
+ autoCall: func() {
+ me.mode = 3;
+ me.autoCallLoop();
+ },
+ failureCall: func(newPage) {
+ if (contains(me.PageList, newPage)) {
+ ECAMControlPanel.lightOff(me.displayedPage.name);
+ me.lastDisplayedPage = me.displayedPage;
+ me.displayedPage = me.PageList[newPage];
+ me.lastMode = me.mode;
+ me.mode = 1;
+ ECAMControlPanel.lightOn(me.displayedPage.name);
+ } else {
+ debug.dump("Attempted to set page to unknown page", newPage);
+ }
+ },
+ manCall: func(newPage) {
+ if (contains(me.PageList, newPage)) {
+ if (me.displayedPage == me.PageList[newPage] and me.mode != 3) {
+ ECAMControlPanel.lightOff(me.displayedPage.name);
+ me.displayedPage = me.autoCall();
+ } else {
+ ECAMControlPanel.lightOff(me.displayedPage.name);
+ if (me.mode == 1) {
+ me.lastDisplayedPage = me.displayedPage;
+ me.lastMode = me.mode;
+ }
+ me.displayedPage = me.PageList[newPage];
+ me.mode = 0;
+ ECAMControlPanel.lightOn(me.displayedPage.name);
+ }
+ } elsif (newPage == "CLR") {
+ if (me.mode == 1) {
+ if (me.lastMode == 0) {
+ ECAMControlPanel.lightOff(me.displayedPage.name);
+ me.displayedPage = me.lastDisplayedPage;
+ ECAMControlPanel.lightOn(me.displayedPage.name);
+ me.lastDisplayedPage = nil;
+ me.mode = 0;
+ } else {
+ ECAMControlPanel.lightOff(me.displayedPage.name);
+ me.displayedPage = me.autoCall();
+ }
+ } elsif (me.mode == 0) {
+ if (me.lastMode == 1) {
+ ECAMControlPanel.lightOff(me.displayedPage.name);
+ me.displayedPage = me.lastDisplayedPage;
+ ECAMControlPanel.lightOn(me.displayedPage.name);
+ me.lastDisplayedPage = nil;
+ me.mode = 1;
+ } else {
+ ECAMControlPanel.lightOff(me.displayedPage.name);
+ me.displayedPage = me.autoCall();
+ }
+ }
+ } else {
+ debug.dump("Attempted to set page to unknown page", newPage);
+ }
+ },
+};
+
+setlistener("/ECAM/warning-phase", func() {
+ if (SystemDisplayController.mode == 3) {
+ SystemDisplayController.autoCall();
+ }
+}, 0, 0);
+
+setlistener("/controls/gear/gear-down", func() {
+ if (SystemDisplayController.mode == 3) {
+ SystemDisplayController.autoCall();
+ }
+}, 0, 0);
+
+
+var ECAMTimer = maketimer(1, func() {
+ SystemDisplayController.update();
+});
\ No newline at end of file
diff --git a/Nasal/Effects/light-manager.nas b/Nasal/Effects/light-manager.nas
index 3eae4361..f577a195 100644
--- a/Nasal/Effects/light-manager.nas
+++ b/Nasal/Effects/light-manager.nas
@@ -2,407 +2,254 @@
# in east/north/up coordinates the renderer uses
# Thanks to BAWV12 / Thorsten
-
-var als_on = props.globals.getNode("/sim/rendering/shaders/skydome");
+var als_on = props.globals.getNode("");
var alt_agl = props.globals.getNode("position/gear-agl-ft");
var cur_alt = 0;
-var light_manager = {
+var Light = {
+ new: func(n) {
+ var light = {parents: [Light]};
+ light.isOn = 0;
+
+ light.Pos = {
+ x: 0,
+ y: 0,
+ z: 0,
+ };
+
+ light.Color = {
+ r: 0,
+ g: 0,
+ b: 0,
+ };
+
+ light.colorr = props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[" ~ n ~ "]", 1);
+ light.colorg = props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[" ~ n ~ "]", 1);
+ light.colorb = props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[" ~ n ~ "]", 1);
+ light.dir = props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/dir[" ~ n ~ "]", 1);
+ light.size = props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/size[" ~ n ~ "]", 1);
+ light.posx = props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[" ~ n ~ "]", 1);
+ light.posy = props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[" ~ n ~ "]", 1);
+ light.posz = props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[" ~ n ~ "]", 1);
+
+ if (n <= 1) {
+ light.stretch = props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/stretch[" ~ n ~ "]", 1);
+ }
+ return light;
+ },
+ setColor: func(r,g,b) {
+ me.Color.r = r;
+ me.Color.g = g;
+ me.Color.b = b;
+ },
+ setDir: func(dir) {
+ me.dir.setValue(dir);
+ },
+ setSize: func(size) {
+ me.size.setValue(size);
+ },
+ setStretch: func(stretch) {
+ me.stretch.setValue(stretch);
+ },
+ setPos: func(x,y,z) {
+ me.Pos.x = x;
+ me.Pos.y = y;
+ me.Pos.z = z;
+ },
+ on: func() {
+ if (me.isOn) { return; }
+ me.colorr.setValue(me.Color.r);
+ me.colorg.setValue(me.Color.g);
+ me.colorb.setValue(me.Color.b);
+ me.isOn = 1;
+ },
+ off: func() {
+ if (!me.isOn) { return; }
+ me.colorr.setValue(0);
+ me.colorg.setValue(0);
+ me.colorb.setValue(0);
+ me.isOn = 0;
+ },
+};
- run: 0,
-
+var lightManager = {
lat_to_m: 110952.0,
lon_to_m: 0.0,
-
- light1_xpos: 0.0,
- light1_ypos: 0.0,
- light1_zpos: 0.0,
- light1_r: 0.0,
- light1_g: 0.0,
- light1_b: 0.0,
- light1_size: 0.0,
- light1_stretch: 0.0,
- light1_is_on: 0,
-
- light2_xpos: 0.0,
- light2_ypos: 0.0,
- light2_zpos: 0.0,
- light2_r: 0.0,
- light2_g: 0.0,
- light2_b: 0.0,
- light2_size: 0.0,
- light2_stretch: 0.0,
- light2_is_on: 0,
- light3_xpos: 0.0,
- light3_ypos: 0.0,
- light3_zpos: 0.0,
- light3_r: 0.0,
- light3_g: 0.0,
- light3_b: 0.0,
- light3_size: 0.0,
- light3_stretch: 0.0,
- light3_is_on: 0,
-
- light4_xpos: 0.0,
- light4_ypos: 0.0,
- light4_zpos: 0.0,
- light4_r: 0.0,
- light4_g: 0.0,
- light4_b: 0.0,
- light4_size: 0.0,
- light4_stretch: 0.0,
- light4_is_on: 0,
-
- light5_xpos: 0.0,
- light5_ypos: 0.0,
- light5_zpos: 0.0,
- light5_r: 0.0,
- light5_g: 0.0,
- light5_b: 0.0,
- light5_size: 0.0,
- light5_stretch: 0.0,
- light5_is_on: 0,
-
- flcpt: 0,
- prev_view : 1,
-
- nd_ref_light1_x: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m", 1),
- nd_ref_light1_y: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m", 1),
- nd_ref_light1_z: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m", 1),
- nd_ref_light1_dir: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/dir", 1),
-
- nd_ref_light2_x: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[1]", 1),
- nd_ref_light2_y: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[1]", 1),
- nd_ref_light2_z: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[1]", 1),
- nd_ref_light2_dir: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/dir[1]", 1),
-
- nd_ref_light3_x: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[2]", 1),
- nd_ref_light3_y: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[2]", 1),
- nd_ref_light3_z: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[2]", 1),
- nd_ref_light3_dir: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/dir[2]", 1),
-
- nd_ref_light4_x: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[3]", 1),
- nd_ref_light4_y: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[3]", 1),
- nd_ref_light4_z: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[3]", 1),
- nd_ref_light4_dir: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/dir[3]", 1),
-
- nd_ref_light5_x: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[4]", 1),
- nd_ref_light5_y: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[4]", 1),
- nd_ref_light5_z: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[4]", 1),
- nd_ref_light5_dir: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/dir[4]", 1),
-
- init: func {
- # define your lights here
-
- # lights ########
- # offsets to aircraft center
-
- me.light1_xpos = 100.0;
- me.light1_ypos = 0.0;
- me.light1_zpos = 2.0;
-
- me.light2_xpos = 60.0;
- me.light2_ypos = 0.0;
- me.light2_zpos = 2.0;
-
- me.light3_xpos = 1.86;
- me.light3_ypos = 16.66;
- me.light3_zpos = 2.0;
-
- me.light4_xpos = 1.86;
- me.light4_ypos = -16.66;
- me.light3_zpos = 2.0;
-
- me.light5_xpos = -19.8;
- me.light5_ypos = 0.0;
- me.light3_zpos = 2.0;
-
-
- # color values
- me.light1_r = 0.7;
- me.light1_g = 0.7;
- me.light1_b = 0.7;
- me.light2_r = 0.6;
- me.light2_g = 0.6;
- me.light2_b = 0.6;
- me.light3_r = 0.6;
- me.light3_g = 0.0;
- me.light3_b = 0.0;
- me.light4_r = 0.0;
- me.light4_g = 0.6;
- me.light4_b = 0.0;
- me.light5_r = 0.6;
- me.light5_g = 0.6;
- me.light5_b = 0.6;
-
- # spot size
- me.light1_size = 12;
- me.light1_stretch = 6;
- me.light2_size = 6;
- me.light2_stretch = 6;
- me.light3_size = 6;
- me.light4_size = 6;
- me.light5_size = 6;
-
-
- setprop("/sim/rendering/als-secondary-lights/flash-radius", 13);
-
- #me.start();
+ Lights: {
+ light1: Light.new(0),
+ light2: Light.new(1),
+ light3: Light.new(2),
+ light4: Light.new(3),
+ light5: Light.new(4),
},
-
- start: func {
+
+ init: func() {
+ setprop("/sim/rendering/als-secondary-lights/flash-radius", 13);
setprop("/sim/rendering/als-secondary-lights/num-lightspots", 5);
-
- setprop("/sim/rendering/als-secondary-lights/lightspot/size", me.light1_size);
- setprop("/sim/rendering/als-secondary-lights/lightspot/size[1]", me.light2_size);
- setprop("/sim/rendering/als-secondary-lights/lightspot/size[2]", me.light3_size);
- setprop("/sim/rendering/als-secondary-lights/lightspot/size[3]", me.light4_size);
- setprop("/sim/rendering/als-secondary-lights/lightspot/size[4]", me.light5_size);
-
- setprop("/sim/rendering/als-secondary-lights/lightspot/stretch", me.light1_stretch);
- setprop("/sim/rendering/als-secondary-lights/lightspot/stretch[1]", me.light2_stretch);
-
- me.run = 1;
+
+ me.Lights.light1.setPos(100,0,2);
+ me.Lights.light2.setPos(60,0,2);
+ me.Lights.light3.setPos(-2,18,2);
+ me.Lights.light4.setPos(-2,-18,2);
+ me.Lights.light5.setPos(-25,0,2);
+
+ me.Lights.light1.setColor(0.7,0.7,0.7);
+ me.Lights.light2.setColor(0.7,0.7,0.7);
+ me.Lights.light3.setColor(0.4,0.0,0.0);
+ me.Lights.light4.setColor(0.0,0.4,0.0);
+ me.Lights.light5.setColor(0.4,0.4,0.4);
+
+ me.Lights.light1.setSize(12);
+ me.Lights.light2.setSize(6);
+ me.Lights.light3.setSize(4);
+ me.Lights.light4.setSize(4);
+ me.Lights.light5.setSize(5);
+
+ me.Lights.light1.setStretch(6);
+ me.Lights.light2.setStretch(6);
+>>>>>>> dev
me.update();
},
-
- stop: func {
- me.run = 0;
+ apos: 0,
+ curAlt: 0,
+ ELEC: [0, 0],
+ ll1: 0,
+ ll2: 0,
+ ll3: 0,
+ nav: 0,
+ run: 0,
+ vpos: 0,
+ Pos: {
+ alt: 0,
+ heading: 0,
+ headingSine: 0,
+ headingCosine: 0,
+ lat: 0,
+ lon: 0,
},
-
- update: func {
- if (me.run == 0) {
+ update: func() {
+ if (!me.run) {
+ settimer ( func me.update(), 0.00);
return;
}
- cur_alt = alt_agl.getValue();
- if (als_on.getValue() == 1 and alt_agl.getValue() < 100.0) {
- ll1 = getprop("/controls/lighting/landing-lights[1]");
- ll2 = getprop("/controls/lighting/landing-lights[2]");
- ll3 = getprop("/sim/model/lights/nose-lights");
- nav = getprop("/sim/model/lights/nav-lights");
-
- var apos = geo.aircraft_position();
- var vpos = geo.viewer_position();
-
- me.lon_to_m = math.cos(apos.lat()*math.pi/180.0) * me.lat_to_m;
-
- var heading = getprop("orientation/heading-deg") * math.pi/180.0;
-
- var lat = apos.lat();
- var lon = apos.lon();
- var alt = apos.alt();
-
- var sh = math.sin(heading);
- var ch = math.cos(heading);
-
- if ((ll1 == 1 and systems.ELEC.Bus.ac1.getValue() != 0) and (ll2 == 1 and systems.ELEC.Bus.ac2.getValue() != 0)) {
- me.light1_ypos = 0.0;
- me.light1_setSize(16);
- me.light1_on();
- } else if (ll1 == 1 and systems.ELEC.Bus.ac1.getValue() != 0) {
- me.light1_ypos = 3.0;
- me.light1_setSize(12);
- me.light1_on();
- } else if (ll2 == 1 and systems.ELEC.Bus.ac2.getValue() != 0) {
- me.light1_ypos = -3.0;
- me.light1_setSize(12);
- me.light1_on();
- } else {
- me.light1_off();
- }
-
- if (ll3 != 0) {
- me.light2_on();
- } else {
- me.light2_off();
- }
-
- if (ll3 == 1) {
- me.light2_setSize(8);
- me.light2_xpos = 65.0;
- } else {
- me.light2_setSize(6);
- me.light2_xpos = 60.0;
- }
-
- if (nav == 1) {
- me.light3_on();
- me.light4_on();
- me.light5_on();
- } else {
- me.light3_off();
- me.light4_off();
- me.light5_off();
- }
-
-
- # light 1 position
- var proj_x = cur_alt;
- var proj_z = cur_alt/10.0;
-
- apos.set_lat(lat + ((me.light1_xpos + proj_x) * ch + me.light1_ypos * sh) / me.lat_to_m);
- apos.set_lon(lon + ((me.light1_xpos + proj_x)* sh - me.light1_ypos * ch) / me.lon_to_m);
-
- delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
- delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
- var delta_z = apos.alt()- proj_z - vpos.alt();
-
- me.nd_ref_light1_x.setValue(delta_x);
- me.nd_ref_light1_y.setValue(delta_y);
- me.nd_ref_light1_z.setValue(delta_z);
- me.nd_ref_light1_dir.setValue(heading);
-
-
-
- # light 2 position
-
- apos.set_lat(lat + (me.light2_xpos * ch + me.light2_ypos * sh) / me.lat_to_m);
- apos.set_lon(lon + (me.light2_xpos * sh - me.light2_ypos * ch) / me.lon_to_m);
-
- delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
- delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
- delta_z = apos.alt() - vpos.alt();
-
- me.nd_ref_light2_x.setValue(delta_x);
- me.nd_ref_light2_y.setValue(delta_y);
- me.nd_ref_light2_z.setValue(delta_z);
- me.nd_ref_light2_dir.setValue(heading);
-
-
- # light 3 position
-
- apos.set_lat(lat + (me.light3_xpos * ch + me.light3_ypos * sh) / me.lat_to_m);
- apos.set_lon(lon + (me.light3_xpos * sh - me.light3_ypos * ch) / me.lon_to_m);
-
- delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
- delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
- delta_z = apos.alt() - vpos.alt();
-
- me.nd_ref_light3_x.setValue(delta_x);
- me.nd_ref_light3_y.setValue(delta_y);
- me.nd_ref_light3_z.setValue(delta_z);
- me.nd_ref_light3_dir.setValue(heading);
-
-
- # light 4 position
-
- apos.set_lat(lat + (me.light4_xpos * ch + me.light4_ypos * sh) / me.lat_to_m);
- apos.set_lon(lon + (me.light4_xpos * sh - me.light4_ypos * ch) / me.lon_to_m);
-
- delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
- delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
- delta_z = apos.alt() - vpos.alt();
-
- me.nd_ref_light4_x.setValue(delta_x);
- me.nd_ref_light4_y.setValue(delta_y);
- me.nd_ref_light4_z.setValue(delta_z);
- me.nd_ref_light4_dir.setValue(heading);
-
- # light 5 position
-
- apos.set_lat(lat + (me.light5_xpos * ch + me.light5_ypos * sh) / me.lat_to_m);
- apos.set_lon(lon + (me.light5_xpos * sh - me.light5_ypos * ch) / me.lon_to_m);
-
- delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
- delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
- delta_z = apos.alt() - vpos.alt();
-
- me.nd_ref_light5_x.setValue(delta_x);
- me.nd_ref_light5_y.setValue(delta_y);
- me.nd_ref_light5_z.setValue(delta_z);
- me.nd_ref_light5_dir.setValue(heading);
+ me.curAlt = pts.Position.gearAglFt.getValue();
+ if (me.curAlt > 100) {
+ settimer ( func me.update(), 1);
+ return;
}
+ me.ll1 = pts.Controls.Lighting.landingLights[1].getValue();
+ me.ll2 = pts.Controls.Lighting.landingLights[2].getValue();
+ me.ll3 = pts.Sim.Model.Lights.noseLights.getValue();
+ me.nav = pts.Sim.Model.Lights.navLights.getValue();
+
+ me.apos = geo.aircraft_position();
+ me.vpos = geo.viewer_position();
+
+
+ me.Pos.lat = me.apos.lat();
+ me.Pos.lon = me.apos.lon();
+ me.Pos.alt = me.apos.alt();
+ me.Pos.heading = pts.Orientation.heading.getValue() * D2R;
+ me.Pos.headingSine = math.sin(me.Pos.heading);
+ me.Pos.headingCosine = math.cos(me.Pos.heading);
+ me.lon_to_m = math.cos(me.Pos.lat*D2R) * me.lat_to_m;
+
+ me.ELEC[0] = systems.ELEC.Bus.ac1.getValue();
+ me.ELEC[1] = systems.ELEC.Bus.ac2.getValue();
+
+ if ((me.ll1 == 1 and me.ELEC[0] >= 110) and (me.ll2 == 1 and me.ELEC[1] >= 110)) {
+ me.Lights.light1.setPos(100,0,2);
+ me.Lights.light1.setSize(16);
+ me.Lights.light1.on();
+ } else if (me.ll1 == 1 and me.ELEC[0] >= 110) {
+ me.Lights.light1.setPos(100,3,2);
+ me.Lights.light1.setSize(12);
+ me.Lights.light1.on();
+ } else if (me.ll2 == 1 and me.ELEC[1] >= 110) {
+ me.Lights.light1.setPos(100,-3,2);
+ me.Lights.light1.setSize(12);
+ me.Lights.light1.on();
+ } else {
+ me.Lights.light1.off();
+ }
+
+ if (me.ll3 != 0) {
+ me.Lights.light2.on();
+ } else {
+ me.Lights.light2.off();
+ }
+
+ if (me.ll3 == 1) {
+ me.Lights.light2.setSize(8);
+ me.Lights.light2.setPos(65,0,2);
+ } else {
+ me.Lights.light2.setSize(6);
+ me.Lights.light2.setPos(60,0,2);
+ }
+
+ if (me.nav == 1) {
+ me.Lights.light3.on();
+ me.Lights.light4.on();
+ me.Lights.light5.on();
+ } else {
+ me.Lights.light3.off();
+ me.Lights.light4.off();
+ me.Lights.light5.off();
+ }
+
+
+ # light 1 position
+ me.apos.set_lat(me.Pos.lat + ((me.Lights.light1.Pos.x + me.curAlt) * me.Pos.headingCosine + me.Lights.light1.Pos.y * me.Pos.headingSine) / me.lat_to_m);
+ me.apos.set_lon(me.Pos.lon + ((me.Lights.light1.Pos.x + me.curAlt) * me.Pos.headingSine - me.Lights.light1.Pos.y * me.Pos.headingCosine) / me.lon_to_m);
+
+ me.Lights.light1.posx.setValue((me.apos.lat() - me.vpos.lat()) * me.lat_to_m);
+ me.Lights.light1.posy.setValue(-(me.apos.lon() - me.vpos.lon()) * me.lon_to_m);
+ me.Lights.light1.posz.setValue(me.apos.alt()- (me.curAlt / 10) - me.vpos.alt());
+ me.Lights.light1.dir.setValue(me.Pos.heading);
+
+ # light 2 position
+ me.apos.set_lat(me.Pos.lat + ((me.Lights.light2.Pos.x + me.curAlt) * me.Pos.headingCosine + me.Lights.light2.Pos.y * me.Pos.headingSine) / me.lat_to_m);
+ me.apos.set_lon(me.Pos.lon + ((me.Lights.light2.Pos.x + me.curAlt) * me.Pos.headingSine - me.Lights.light2.Pos.y * me.Pos.headingCosine) / me.lon_to_m);
+
+ me.Lights.light2.posx.setValue((me.apos.lat() - me.vpos.lat()) * me.lat_to_m);
+ me.Lights.light2.posy.setValue(-(me.apos.lon() - me.vpos.lon()) * me.lon_to_m);
+ me.Lights.light2.posz.setValue(me.apos.alt()- (me.curAlt / 10) - me.vpos.alt());
+ me.Lights.light2.dir.setValue(me.Pos.heading);
+
+ # light 3 position
+ me.apos.set_lat(me.Pos.lat + ((me.Lights.light3.Pos.x + me.curAlt) * me.Pos.headingCosine + me.Lights.light3.Pos.y * me.Pos.headingSine) / me.lat_to_m);
+ me.apos.set_lon(me.Pos.lon + ((me.Lights.light3.Pos.x + me.curAlt) * me.Pos.headingSine - me.Lights.light3.Pos.y * me.Pos.headingCosine) / me.lon_to_m);
+
+ me.Lights.light3.posx.setValue((me.apos.lat() - me.vpos.lat()) * me.lat_to_m);
+ me.Lights.light3.posy.setValue(-(me.apos.lon() - me.vpos.lon()) * me.lon_to_m);
+ me.Lights.light3.posz.setValue(me.apos.alt()- (me.curAlt / 10) - me.vpos.alt());
+ me.Lights.light3.dir.setValue(me.Pos.heading);
+
+ # light 4 position
+ me.apos.set_lat(me.Pos.lat + ((me.Lights.light4.Pos.x + me.curAlt) * me.Pos.headingCosine + me.Lights.light4.Pos.y * me.Pos.headingSine) / me.lat_to_m);
+ me.apos.set_lon(me.Pos.lon + ((me.Lights.light4.Pos.x + me.curAlt) * me.Pos.headingSine - me.Lights.light4.Pos.y * me.Pos.headingCosine) / me.lon_to_m);
+
+ me.Lights.light4.posx.setValue((me.apos.lat() - me.vpos.lat()) * me.lat_to_m);
+ me.Lights.light4.posy.setValue(-(me.apos.lon() - me.vpos.lon()) * me.lon_to_m);
+ me.Lights.light4.posz.setValue(me.apos.alt()- (me.curAlt / 10) - me.vpos.alt());
+ me.Lights.light4.dir.setValue(me.Pos.heading);
+
+ # light 5 position
+ me.apos.set_lat(me.Pos.lat + ((me.Lights.light5.Pos.x + me.curAlt) * me.Pos.headingCosine + me.Lights.light5.Pos.y * me.Pos.headingSine) / me.lat_to_m);
+ me.apos.set_lon(me.Pos.lon + ((me.Lights.light5.Pos.x + me.curAlt) * me.Pos.headingSine - me.Lights.light5.Pos.y * me.Pos.headingCosine) / me.lon_to_m);
+
+ me.Lights.light5.posx.setValue((me.apos.lat() - me.vpos.lat()) * me.lat_to_m);
+ me.Lights.light5.posy.setValue(-(me.apos.lon() - me.vpos.lon()) * me.lon_to_m);
+ me.Lights.light5.posz.setValue(me.apos.alt()- (me.curAlt / 10) - me.vpos.alt());
+ me.Lights.light5.dir.setValue(me.Pos.heading);
+
settimer ( func me.update(), 0.00);
},
+};
- light1_on : func {
- if (me.light1_is_on == 1) {return;}
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r", me.light1_r);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g", me.light1_g);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b", me.light1_b);
- me.light1_is_on = 1;
- },
-
- light1_off : func {
- if (me.light1_is_on == 0) {return;}
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r", 0.0);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g", 0.0);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b", 0.0);
- me.light1_is_on = 0;
- },
-
- light1_setSize : func(size) {
- setprop("/sim/rendering/als-secondary-lights/lightspot/size[0]", size);
- },
-
- light2_on : func {
- if (me.light2_is_on == 1) {return;}
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[1]", me.light2_r);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[1]", me.light2_g);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[1]", me.light2_b);
- me.light2_is_on = 1;
- },
-
- light2_off : func {
- if (me.light2_is_on == 0) {return;}
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[1]", 0.0);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[1]", 0.0);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[1]", 0.0);
- me.light2_is_on = 0;
- },
-
- light2_setSize : func(size) {
- setprop("/sim/rendering/als-secondary-lights/lightspot/size[1]", size);
- },
-
- light3_on : func {
- if (me.light3_is_on == 1) {return;}
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[2]", me.light3_r);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[2]", me.light3_g);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[2]", me.light3_b);
- me.light3_is_on = 1;
- },
-
- light3_off : func {
- if (me.light3_is_on == 0) {return;}
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[2]", 0.0);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[2]", 0.0);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[2]", 0.0);
- me.light3_is_on = 0;
- },
-
- light4_on : func {
- if (me.light4_is_on == 1) {return;}
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[3]", me.light4_r);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[3]", me.light4_g);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[3]", me.light4_b);
- me.light4_is_on = 1;
- },
-
- light4_off : func {
- if (me.light4_is_on == 0) {return;}
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[3]", 0.0);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[3]", 0.0);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[3]", 0.0);
- me.light4_is_on = 0;
- },
-
- light5_on : func {
- if (me.light5_is_on == 1) {return;}
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[4]", me.light5_r);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[4]", me.light5_g);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[4]", me.light5_b);
- me.light5_is_on = 1;
- },
-
- light5_off : func {
- if (me.light5_is_on == 0) {return;}
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[4]", 0.0);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[4]", 0.0);
- setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[4]", 0.0);
- me.light5_is_on = 0;
- },
-};
\ No newline at end of file
+setlistener(pts.Sim.Rendering.Shaders.skydome, func(v) {
+ lightManager.run = v.getValue() ? 1 : 0;
+}, 1, 0);
\ No newline at end of file
diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas
index 8cf163dc..01ceae0f 100644
--- a/Nasal/Libraries/libraries.nas
+++ b/Nasal/Libraries/libraries.nas
@@ -84,7 +84,7 @@ var A320Libraries = nil;
var systemsInit = func() {
systemsInitialized = 0;
fbw.FBW.init();
- effects.light_manager.init();
+ effects.lightManager.init();
systems.ELEC.init();
systems.PNEU.init();
systems.HYD.init();
diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas
index bfb0588d..d9ab95fa 100644
--- a/Nasal/Libraries/property-tree-setup.nas
+++ b/Nasal/Libraries/property-tree-setup.nas
@@ -46,6 +46,7 @@ var Controls = {
aileron: props.globals.getNode("/controls/flight/aileron"),
aileronDrivesTiller: props.globals.getNode("/controls/flight/aileron-drives-tiller"),
autoCoordination: props.globals.getNode("/controls/flight/auto-coordination"),
+ elevator: props.globals.getNode("/controls/flight/elevator"),
elevatorTrim: props.globals.getNode("/controls/flight/elevator-trim"),
flaps: props.globals.getNode("/controls/flight/flaps"),
flapsTemp: 0,
@@ -53,6 +54,7 @@ var Controls = {
flapsPos: props.globals.getNode("/controls/flight/flaps-pos"),
speedbrake: props.globals.getNode("/controls/flight/speedbrake"),
speedbrakeArm: props.globals.getNode("/controls/flight/speedbrake-arm"),
+ rudder: props.globals.getNode("/controls/flight/rudder"),
rudderTrim: props.globals.getNode("/controls/flight/rudder-trim"),
},
Gear: {
@@ -61,6 +63,9 @@ var Controls = {
parkingBrake: props.globals.getNode("/controls/gear/brake-parking"),
chocks: props.globals.getNode("/services/chocks/enable"),
},
+ Lighting: {
+ landingLights: [props.globals.getNode("/controls/lighting/landing-lights[0]"),props.globals.getNode("/controls/lighting/landing-lights[1]"),props.globals.getNode("/controls/lighting/landing-lights[2]")],
+ },
Switches: {
annunTest: props.globals.getNode("/controls/switches/annun-test"),
},
@@ -228,12 +233,14 @@ var Options = {
};
var Orientation = {
+ heading: props.globals.getNode("/orientation/heading-deg"),
pitch: props.globals.getNode("/orientation/pitch-deg"),
roll: props.globals.getNode("/orientation/roll-deg"),
yaw: props.globals.getNode("/orientation/yaw-deg"),
};
var Position = {
+ altitudeFt: props.globals.getNode("/position/altitude-ft"),
gearAglFt: props.globals.getNode("/position/gear-agl-ft"),
latitude: props.globals.getNode("/position/latitude-deg"),
longitude: props.globals.getNode("/position/longitude-deg"),
@@ -264,6 +271,12 @@ var Sim = {
engine: [props.globals.getNode("/sim/input/selected/engine[0]", 1),props.globals.getNode("/sim/input/selected/engine[1]", 1)],
}
},
+ Model: {
+ Lights: {
+ navLights: props.globals.getNode("/sim/model/lights/nav-lights"),
+ noseLights: props.globals.getNode("/sim/model/lights/nose-lights"),
+ },
+ },
Multiplay: {
online: props.globals.getNode("/sim/multiplay/online"),
},
@@ -272,6 +285,9 @@ var Sim = {
Headshake: {
enabled: props.globals.getNode("/sim/rendering/headshake/enabled"),
},
+ Shaders: {
+ skydome: props.globals.getNode("/sim/rendering/shaders/skydome"),
+ },
},
replayState: props.globals.getNode("/sim/freeze/replay-state"),
Replay: {
diff --git a/Systems/a320-apu.xml b/Systems/a320-apu.xml
index 775d148a..f7f10382 100644
--- a/Systems/a320-apu.xml
+++ b/Systems/a320-apu.xml
@@ -183,6 +183,7 @@
+
diff --git a/Systems/a320-fwc-phases.xml b/Systems/a320-fwc-phases.xml
index 345bb017..58e178df 100644
--- a/Systems/a320-fwc-phases.xml
+++ b/Systems/a320-fwc-phases.xml
@@ -19,10 +19,10 @@
0.03333333333
-
+
/ECAM/phases/monostable/phase-1-300
- 0.00333333333
- 120
+ 0.00333333333
+ 120
@@ -95,8 +95,8 @@
-
- /ECAM/phases/monostable/phase-1-300-output ne 1
+
+ /ECAM/phases/monostable/phase-1-300-timer ne 0
/ECAM/phases/monostable/phase-1-300 eq 1
@@ -229,6 +229,27 @@
+
+
+
+
+ /ECAM/phases/phase-calculation/takeoff-power eq 1
+ /ECAM/phases/phase-calculation/altitude-ge-1500 eq 0
+ /ECAM/logic/ground-calc-immediate eq 0
+ /ECAM/phases/monostable/gnd-output ne 1
+
+
+
+
+
+
+ /ECAM/phases/phase-calculation/takeoff-power eq 0
+ /ECAM/phases/phase-calculation/altitude-ge-1500 eq 0
+ /ECAM/phases/phase-calculation/altitude-ge-800 eq 0
+ /ECAM/logic/ground-calc-immediate eq 0
+ /ECAM/phases/monostable/gnd-output ne 1
+
+
@@ -237,6 +258,60 @@
+
+
+
+ /ECAM/warning-phase eq 9
+
+
+
+
+
+
+ /ECAM/warning-phase eq 9
+
+
+
+
+
+
+ /ECAM/timer/ground-calc eq 1
+ /controls/engines/engine[0]/fire-btn eq 1
+
+
+
+
+
+
+ /ECAM/phases/phase-calculation/engines-1-2-not-running eq 1
+ /ECAM/logic/ground-calc-immediate eq 1
+ /ECAM/warning-phase eq 9
+ /ECAM/phases/flipflop/phase-10-output eq 1
+
+
+
+
+
+
+ /ECAM/warning-phase eq 3
+ /ECAM/warning-phase eq 8
+
+
+
+
+
+
+ /ECAM/phases/monostable-80kt eq 0
+ /ECAM/warning-phase ne 9
+ /ECAM/timer/ground-calc eq 1
+
+ /ECAM/phases/monostable/phase-9-output eq 0
+ /ECAM/phases/monostable/to-power-set-output eq 0
+
+
+
+
+