From b2971ede44c1aca20a108db2d9e505d7d69023e5 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sat, 12 Jan 2019 12:04:55 -0500 Subject: [PATCH] System: Master Warning light now flashes --- Models/FlightDeck/a320.flightdeck.xml | 2 +- Nasal/ECAM/ECAM-controller.nas | 37 ++++++++++++++++++++++----- Nasal/ECAM/ECAM-logic.nas | 5 +--- Nasal/ECAM/ECAM-messages.nas | 5 +--- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 004c2830..8311d277 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -5238,7 +5238,7 @@ 1 - ECAM/warnings/master-warning-light + ECAM/warnings/master-warning-flash 1 diff --git a/Nasal/ECAM/ECAM-controller.nas b/Nasal/ECAM/ECAM-controller.nas index ea4f61c2..2b1f7ae1 100644 --- a/Nasal/ECAM/ECAM-controller.nas +++ b/Nasal/ECAM/ECAM-controller.nas @@ -1,9 +1,6 @@ # A3XX Electronic Centralised Aircraft Monitoring System -# Jonathan Redpath (legoboyvdlp) -############################################## -# Copyright (c) Joshua Davidson (it0uchpods) # -############################################## +# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp) var num_lines = 6; var msg = nil; @@ -11,9 +8,12 @@ var spacer = nil; var line = nil; var right_line = nil; var wow = getprop("/gear/gear[1]/wow"); +var light = 0; +var flash = 0; setprop("/ECAM/show-left-msg", 1); setprop("/ECAM/show-right-msg", 1); setprop("/ECAM/warnings/master-warning-light", 0); +setprop("/ECAM/warnings/master-warning-flash", 0); setprop("/ECAM/warnings/master-caution-light", 0); setprop("/ECAM/warnings/overflow", 0); setprop("/ECAM/warnings/overflow-left", 0); @@ -221,8 +221,8 @@ var ECAM_controller = { }, }; -setlistener("/systems/electrical/bus/ac-ess", func { - if (getprop("/systems/electrical/bus/ac-ess") < 110) { +setlistener("/systems/electrical/bus/dc-ess", func { + if (getprop("/systems/electrical/bus/dc-ess") < 25) { ECAM_controller.reset(); } }, 0, 0); @@ -230,3 +230,28 @@ setlistener("/systems/electrical/bus/ac-ess", func { var ECAMloopTimer = maketimer(0.2, func { ECAM_controller.loop(); }); + +# Flash Master Warning Light +var warnTimer = maketimer(0.2, func { + flash = getprop("/ECAM/warnings/master-warning-flash"); + light = getprop("/ECAM/warnings/master-warning-light"); + if (!light) { + warnTimer.stop(); + setprop("/ECAM/warnings/master-warning-flash", 0); + } else if (flash != 1) { + setprop("/ECAM/warnings/master-warning-flash", 1); + } else { + setprop("/ECAM/warnings/master-warning-flash", 0); + } +}); + +setlistener("/ECAM/warnings/master-warning-light", func { + light = getprop("/ECAM/warnings/master-warning-light"); + if (light == 1) { + setprop("/ECAM/warnings/master-warning-flash", 0); + warnTimer.start(); + } else { + warnTimer.stop(); + setprop("/ECAM/warnings/master-warning-flash", 0); + } +}, 0, 0); diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 767cf96a..44cdcc94 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -1,9 +1,6 @@ # A3XX Electronic Centralised Aircraft Monitoring System -# Jonathan Redpath (legoboyvdlp) -############################################## -# Copyright (c) Joshua Davidson (it0uchpods) # -############################################## +# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp) var messages_priority_3 = func { if ((getprop("/position/gear-agl-ft") < 750 and getprop("/gear/gear[1]/position-norm") != 1 and (getprop("/ECAM/warning-phase") <= 3 and getprop("/ECAM/warning-phase") >= 5)) and ((((getprop("/engines/engine[0]/n1-actual") < 75.0 and getprop("/engines/engine[1]/n1-actual") < 75.0)) or ((getprop("/engines/engine[0]/n1-actual") < 77.0 and getprop("/controls/engines/engine[1]/cutoff-switch") == 0) or (getprop("/engines/engine[1]/n1-actual") < 77.0 and getprop("/controls/engines/engine[0]/cutoff-switch") == 0))) or getprop("/controls/flight/flap-pos") > 1)) { diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index 8a08f994..aed5bf2f 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -1,9 +1,6 @@ # A3XX Electronic Centralised Aircraft Monitoring System -# Jonathan Redpath (legoboyvdlp) -############################################## -# Copyright (c) Joshua Davidson (it0uchpods) # -############################################## +# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp) # messages stored in vectors