From 82bf43608457e290a360bac8ee93b6c070f7a8ca Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 19 Jun 2021 01:46:57 +0100 Subject: [PATCH] Code Global Speed Protection mode reversion from THR CLB to SPEED on overspeed --- Nasal/ECAM/ECAM-controller.nas | 4 ++-- Nasal/ECAM/ECAM-logic.nas | 2 +- Nasal/FMGC/FCU.nas | 8 ++++---- Nasal/FMGC/FMGC-b.nas | 13 +++++++++++++ Nasal/Libraries/property-tree-setup.nas | 7 +++++++ Sounds/A320-common-sound.xml | 15 +++++++++++++++ 6 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Nasal/ECAM/ECAM-controller.nas b/Nasal/ECAM/ECAM-controller.nas index aedd52cf..d84b680d 100644 --- a/Nasal/ECAM/ECAM-controller.nas +++ b/Nasal/ECAM/ECAM-controller.nas @@ -14,7 +14,7 @@ var overflow = props.globals.initNode("/ECAM/warnings/overflow", 0, "BOOL"); var lights = [props.globals.initNode("/ECAM/warnings/master-warning-light", 0, "BOOL"), props.globals.initNode("/ECAM/warnings/master-caution-light", 0, "BOOL")]; -var aural = [props.globals.initNode("/sim/sound/warnings/crc", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/chime", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/cricket", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/retard", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/cchord", 0, "BOOL")]; +var aural = [props.globals.initNode("/sim/sound/warnings/crc", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/chime", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/cricket", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/retard", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/cchord", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/click", 0, "BOOL")]; var warningFlash = props.globals.initNode("/ECAM/warnings/master-warning-flash", 0, "BOOL"); var lineIndex = 0; @@ -223,7 +223,7 @@ var warning = { me.noRepeat = 1; }, sound: func() { - if (me.aural > 3) { return; } + if (me.aural == 9) { return; } if (me.active == 0 and me.wasActive == 1) { aural[me.aural].setBoolValue(0); me.wasActive = 0; diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index e387da41..670a67c9 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -66,7 +66,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(flap_not_zero); } - if (overspeed.clearFlag == 0 and (phaseVar3 == 1 or (phaseVar3 >= 5 and phaseVar3 <= 7)) and getprop("/systems/navigation/adr/output/overspeed")) { + if (overspeed.clearFlag == 0 and (phaseVar3 == 1 or (phaseVar3 >= 5 and phaseVar3 <= 7)) and pts.Systems.Navigation.ADR.Output.overspeed.getBoolValue()) { overspeed.active = 1; if (getprop("/systems/navigation/adr/computation/overspeed-vmo") or getprop("/systems/navigation/adr/computation/overspeed-mmo")) { overspeedVMO.active = 1; diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index 5ef43dfb..69196aa4 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -105,18 +105,18 @@ var FCUController = { FD1: func() { if (me.FCUworking) { if (!fmgc.Output.fd1.getBoolValue()) { - fd1Input.setValue(1); + fmgc.Input.fd1.setValue(1); } else { - fd1Input.setValue(0); + fmgc.Input.fd1.setValue(0); } } }, FD2: func() { if (me.FCUworking) { if (!fmgc.Output.fd2.getBoolValue()) { - fd2Input.setValue(1); + fmgc.Input.fd2.setValue(1); } else { - fd2Input.setValue(0); + fmgc.Input.fd2.setValue(0); } } }, diff --git a/Nasal/FMGC/FMGC-b.nas b/Nasal/FMGC/FMGC-b.nas index 1669b469..e30a4a72 100644 --- a/Nasal/FMGC/FMGC-b.nas +++ b/Nasal/FMGC/FMGC-b.nas @@ -1031,6 +1031,19 @@ setlistener("/it-autoflight/input/vert", func { } }); +# Mode Reversions +setlistener(pts.Systems.Navigation.ADR.Output.overspeed, func(v) { + if (v.getBoolValue() and !Output.ap1.getBoolValue() and !Output.ap2.getBoolValue() and Output.athr.getBoolValue() and Modes.PFD.FMA.pitchMode.getValue() == "OP CLB" and Modes.PFD.FMA.throttle.getValue() == "THR CLB") { + Input.fd1.setValue(0); + Input.fd2.setValue(0); + ecam.aural[5].setBoolValue(0); + settimer(func() { + ecam.aural[5].setBoolValue(1); + }, 0.15); + } +}, 0, 0); + + setlistener("/sim/signals/fdm-initialized", func { ITAF.init(); }); diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index ed05e695..d3d99167 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -278,6 +278,13 @@ var Sim = { }; var Systems = { + Navigation: { + ADR: { + Output: { + overspeed: props.globals.getNode("/systems/navigation/adr/output/overspeed"), + }, + }, + }, Thrust: { engOut: props.globals.getNode("/systems/thrust/eng-out"), state: [props.globals.getNode("/systems/thrust/state1"), props.globals.getNode("/systems/thrust/state2")], diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml index 40db7e4e..7514ae02 100644 --- a/Sounds/A320-common-sound.xml +++ b/Sounds/A320-common-sound.xml @@ -1913,6 +1913,21 @@ + + Chime + Aircraft/A320-family/Sounds/Cockpit/click.wav + once + avionics + + /sim/sound/warnings/click + + + /sim/current-view/internal + + 10 + 100 + + Chime Aircraft/A320-family/Sounds/Cockpit/chime.wav