diff --git a/Nasal/ECAM-controller.nas b/Nasal/ECAM-controller.nas index 2b0141a4..fed32959 100644 --- a/Nasal/ECAM-controller.nas +++ b/Nasal/ECAM-controller.nas @@ -54,62 +54,116 @@ # PHASE: /FMGC/status/phase # DISPLAY: 1 - EWD 2 - MEMO 3 - STATUS +var ewd = props.globals.initNode("/instrumentation/ewd"); +var ewd_msg_three = ewd.initNode("msg/priority_3"," ","STRING"); +var ewd_msg_two = ewd.initNode("msg/priority_2"," ","STRING"); +var ewd_msg_one = ewd.initNode("msg/priority_1"," ","STRING"); +var ewd_msg_zero = ewd.initNode("msg/priority_0"," ","STRING"); +var ewd_msg_memo = ewd.initNode("msg/memo"," ","STRING"); +var msgs_priority_3 = []; +var msgs_priority_2 = []; +var msgs_priority_1 = []; +var msgs_priority_0 = []; +var msgs_memo = []; +var active_messages = []; +var num_lines = 6; +var msg = nil; +var spacer = nil; +var line = nil; -var message = { - name: "", - text: "", - priority: 0, - logic_prop: "", - color: "", - display: "", - new: func(name,text,priority,logic_prop,color,display) { - var l = {parents:[message]}; - - l.name = name; - l.text = text; - l.priority = priority; - l.logic_prop = logic_prop; - l.color = color; - l.display = display; - - return l; +# messages logic and added to arrays + +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) { + append(msgs_priority_3,"L/G GEAR NOT DOWN"); + append(active_messages,"L/G GEAR NOT DOWN"); } -}; +} +var messages_priority_2 = func {} +var messages_priority_1 = func {} +var messages_priority_0 = func {} +var messages_memo = func { + if (getprop("controls/flight/speedbrake-arm") == 1) { + append(msgs_memo,"GND SPLRS ARMED"); + append(active_messages,"GND SPLRS ARMED"); + } +} -var messages = nil; +# messages sent to property tree +var update_ewd = func(msgs_priority_3,msgs_priority_2,msgs_priority_1,msgs_priority_0,msgs_memo) { + msg = ""; + spacer = ""; + line = 0; + for(var i=0; i 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"); } else if (getprop("/ECAM/ldg-memo-enable") == 1) { setprop("/ECAM/left-msg", "LDG-MEMO"); diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index 471f5fa0..b0f08cae 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -186,7 +186,6 @@ var systemsInit = func { libraries.CVR.start(); icing.icingInit(); lightsLoop.start(); - ecam.ECAM_system.init(); 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); @@ -205,7 +204,7 @@ var systemsLoop = maketimer(0.1, func { systems.FUEL.loop(); systems.ADIRS.loop(); libraries.ECAM.loop(); - ecam.ECAM_system.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)) {