diff --git a/Nasal/ECAM-controller.nas b/Nasal/ECAM-controller.nas index 62854e16..1da63d50 100644 --- a/Nasal/ECAM-controller.nas +++ b/Nasal/ECAM-controller.nas @@ -66,6 +66,7 @@ var msgs_priority_1 = std.Vector.new(); var msgs_priority_0 = std.Vector.new(); var msgs_memo = std.Vector.new(); var active_messages = std.Vector.new(); +var display_messages = std.Vector.new(); var num_lines = 6; var msg = nil; var spacer = nil; @@ -77,8 +78,8 @@ var messages_priority_3 = func { if (getprop("/controls/flight/flap-pos") > 2 and getprop("/position/gear-agl-ft") < 750 and getprop("/gear/gear[1]/position-norm") != 1 and getprop("/FMGC/status/phase") == 5) { msgs_priority_3.append("L/G GEAR NOT DOWN"); active_messages.append("L/G GEAR NOT DOWN"); - } else if (active_messages.contains("L/G GEAR NOT DOWN")) { - active_messages.remove("L/G GEAR NOT DOWN"); + } else if (display_messages.contains("L/G GEAR NOT DOWN")) { + display_messages.remove("L/G GEAR NOT DOWN"); } } var messages_priority_2 = func {} @@ -88,8 +89,8 @@ var messages_memo = func { if (getprop("controls/flight/speedbrake-arm") == 1) { msgs_memo.append("GND SPLRS ARMED"); active_messages.append("GND SPLRS ARMED"); - } else if (active_messages.contains("GND SPLRS ARMED")) { - active_messages.remove("GND SPLRS ARMED"); + } else if (display_messages.contains("GND SPLRS ARMED")) { + display_messages.remove("GND SPLRS ARMED"); } } @@ -119,13 +120,17 @@ var ECAM_controller = { forindex ( var i; active_messages.vector ) { var line = 1; if (getprop("/ECAM/msg/line" ~ line) == "") { - setprop("/ECAM/msg/line" ~ line, active_messages.vector[i]); + display_messages.append(active_messages.vector[i]); + active_messages.remove(active_messages.vector[i]); + setprop("/ECAM/msg/line" ~ line, display_messages.vector[i]); } else { - setprop("/ECAM/msg/line" ~ (line + 1), active_messages.vector[i]); + display_messages.append(active_messages.vector[i]); + active_messages.remove(active_messages.vector[i]); + setprop("/ECAM/msg/line" ~ (line + 1), display_messages.vector[i]); } } - if (active_messages.size() == 0) { + if (display_messages.size() == 0) { setprop("/ECAM/msg/line1", ""); setprop("/ECAM/msg/line2", ""); } diff --git a/Nasal/ECAM.nas b/Nasal/ECAM.nas index 6a03b542..a82551ff 100644 --- a/Nasal/ECAM.nas +++ b/Nasal/ECAM.nas @@ -80,7 +80,7 @@ var ECAM = { setprop("/ECAM/ldg-memo-enable", 0); } - if (ecam.active_messages.size() > 0) { + if (ecam.display_messages.size() > 0) { setprop("/ECAM/left-msg", "MSG"); } else if (getprop("/FMGC/status/phase") == 0 and stateL == 3 and stateR == 3 and getprop("/ECAM/engine-start-time") + 120 < getprop("/sim/time/elapsed-sec") and getprop("/ECAM/to-memo-enable") == 1 and wow == 1) { setprop("/ECAM/left-msg", "TO-MEMO"); diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index 02fd373e..b0f08cae 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -186,7 +186,6 @@ var systemsInit = func { libraries.CVR.start(); icing.icingInit(); lightsLoop.start(); - ecamLoop.start(); var autopilot = gui.Dialog.new("sim/gui/dialogs/autopilot/dialog", "Aircraft/IDG-A32X/Systems/autopilot-dlg.xml"); setprop("/it-autoflight/input/fd1", 1); setprop("/it-autoflight/input/fd2", 1); @@ -198,10 +197,6 @@ setlistener("/sim/signals/fdm-initialized", func { systemsInit(); }); -var ecamLoop = maketimer(0.5, func { - ecam.ECAM_controller.loop(); -}); - var systemsLoop = maketimer(0.1, func { systems.ELEC.loop(); systems.PNEU.loop(); @@ -209,6 +204,7 @@ var systemsLoop = maketimer(0.1, func { systems.FUEL.loop(); systems.ADIRS.loop(); libraries.ECAM.loop(); + ecam.ECAM_controller.loop(); fadec.fadecLoop(); if ((getprop("/controls/pneumatic/switches/groundair") or getprop("/controls/switches/cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or getprop("/controls/gear/brake-parking") == 0)) {