From 3ea6a4c3cee9b90a34e6a2bf3ff72160ce899de0 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 19 Mar 2019 18:19:50 +0000 Subject: [PATCH] Finish thrust lock, fix sounds --- Models/FlightDeck/a320.flightdeck.xml | 4 --- Nasal/ECAM/ECAM-controller.nas | 21 ++++++++------- Nasal/ECAM/ECAM-logic.nas | 7 ----- Nasal/buttons.nas | 39 ++++++++++++++++++++++++--- Sounds/A320-common-sound.xml | 17 ------------ 5 files changed, 47 insertions(+), 41 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index d3995d15..53e9ce98 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -5029,10 +5029,6 @@ if (getprop("/it-autoflight/output/athr-warning") == 1) { setprop("/it-autoflight/output/athr-warning", 0); } - - # if (getprop("/sim/sound/warnings/chime") == 1) { - # setprop("/sim/sound/warnings/chime", 0); - #} diff --git a/Nasal/ECAM/ECAM-controller.nas b/Nasal/ECAM/ECAM-controller.nas index fcd83f0f..d027cc3e 100644 --- a/Nasal/ECAM/ECAM-controller.nas +++ b/Nasal/ECAM/ECAM-controller.nas @@ -68,14 +68,17 @@ var warning = { me.noRepeat = 1; }, sound: func() { - if (me.aural > 1 or me.noRepeat2 == 1 or me.active == 0) {return;} - warning.cycleSound(me.aural); - me.noRepeat2 = 1; - }, - cycleSound: func(type) { - aural[type].setBoolValue(0); - aural[type].setBoolValue(1); - } + if (me.aural > 1 or me.noRepeat2 == 1 or me.active == 0) {return;} + me.noRepeat2 = 1; + if (aural[me.aural].getBoolValue()) { + aural[me.aural].setBoolValue(0); + settimer(func() { + aural[me.aural].setBoolValue(1); + }, 0.15); + } else { + aural[me.aural].setBoolValue(1); + } + }, }; var memo = { @@ -267,7 +270,7 @@ setlistener("/systems/electrical/bus/dc-ess", func { } }, 0, 0); -var ECAMloopTimer = maketimer(0.2, func { +var ECAMloopTimer = maketimer(0.15, func { ECAM_controller.loop(); }); diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 06260089..1e8d8f25 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -19,7 +19,6 @@ var wowNode = props.globals.getNode("/fdm/jsbsim/position/wow", 1); # local variables var phaseVar = nil; var dualFailFACActive = 1; -var flash = 0; var messages_priority_3 = func { phaseVar = phaseNode.getValue(); @@ -229,12 +228,6 @@ var messages_priority_3 = func { ECAM_controller.warningReset(athr_lock_1); } - if (getprop("/systems/thrust/thr-locked-alert") == 1) { - flash = 1; - } else { - flash = 0; - } - if ((athr_offw.clearFlag == 0) and athrWarn.getValue() == 2 and phaseVar != 4 and phaseVar != 8 and phaseVar != 10) { athr_offw.active = 1; athr_offw_1.active = 1; diff --git a/Nasal/buttons.nas b/Nasal/buttons.nas index e7ad05b1..e530ac0f 100644 --- a/Nasal/buttons.nas +++ b/Nasal/buttons.nas @@ -643,10 +643,22 @@ var lockThr = func() { var checkLockThr = func() { if (getprop("/systems/thrust/thr-lock-time") + 5 > getprop("/sim/time/elapsed-sec")) { return; } - if (getprop("/systems/thrust/thr-locked") == 0) { + if (fmgc.Output.athr.getBoolValue()) { + lockTimer.stop(); + setprop("/systems/thrust/thr-locked", 0); setprop("/systems/thrust/thr-locked-alert", 0); setprop("/systems/thrust/thr-lock-time", 0); + setprop("/systems/thrust/thr-locked-flash", 0); + return; + } + + if (getprop("/systems/thrust/thr-locked") == 0) { lockTimer.stop(); + setprop("/systems/thrust/thr-locked", 0); + setprop("/systems/thrust/thr-locked-alert", 0); + setprop("/systems/thrust/thr-lock-time", 0); + setprop("/systems/thrust/thr-locked-flash", 0); + return; } state1 = getprop("/systems/thrust/state1"); @@ -662,13 +674,32 @@ var checkLockThr = func() { } var checkLockThr2 = func() { + if (fmgc.Output.athr.getBoolValue()) { + lockTimer2.stop(); + setprop("/systems/thrust/thr-locked", 0); + setprop("/systems/thrust/thr-locked-alert", 0); + setprop("/systems/thrust/thr-lock-time", 0); + setprop("/systems/thrust/thr-locked-flash", 0); + return; + } + + if (getprop("/systems/thrust/thr-locked") == 0) { + lockTimer2.stop(); + setprop("/systems/thrust/thr-locked", 0); + setprop("/systems/thrust/thr-locked-alert", 0); + setprop("/systems/thrust/thr-lock-time", 0); + setprop("/systems/thrust/thr-locked-flash", 0); + return; + } + if (getprop("/systems/thrust/thr-lock-time") + 5 < getprop("/sim/time/elapsed-sec")) { setprop("/systems/thrust/thr-locked-flash", 0); settimer(func() { setprop("/systems/thrust/thr-locked-flash", 1); setprop("/systems/thrust/thr-lock-time", getprop("/sim/time/elapsed-sec")); ecam.athr_lock.noRepeat = 0; - }, 0.15); + ecam.athr_lock.noRepeat2 = 0; + }, 0.2); } state1 = getprop("/systems/thrust/state1"); @@ -682,5 +713,5 @@ var checkLockThr2 = func() { } -var lockTimer = maketimer(0.02, checkLockThr); -var lockTimer2 = maketimer(0.02, checkLockThr2); \ No newline at end of file +var lockTimer = maketimer(0.1, checkLockThr); +var lockTimer2 = maketimer(0.1, checkLockThr2); \ No newline at end of file diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml index 99d398d0..0daf103f 100644 --- a/Sounds/A320-common-sound.xml +++ b/Sounds/A320-common-sound.xml @@ -870,23 +870,6 @@ - - athroff - Aircraft/IDG-A32X/Sounds/Cockpit/chime.wav - - - - /it-autoflight/output/athr - 0 - - /it-autoflight/sound/athrsound - - - - 40.0 - - - gear0 in-transit