From a7662135465f28dbd406ffe9393e178e0d098069 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 19 Nov 2018 16:55:15 +0000 Subject: [PATCH] Major improvements to right memos, ready for first merge --- Nasal/ECAM-controller.nas | 6 +++--- Nasal/ECAM-logic.nas | 32 ++++++++++++++++++++++++++++++++ Nasal/ECAM.nas | 12 +++++++----- Nasal/FMGC-b.nas | 2 +- Nasal/icing.nas | 8 ++++---- 5 files changed, 47 insertions(+), 13 deletions(-) diff --git a/Nasal/ECAM-controller.nas b/Nasal/ECAM-controller.nas index 665ade67..16117b1d 100644 --- a/Nasal/ECAM-controller.nas +++ b/Nasal/ECAM-controller.nas @@ -130,7 +130,7 @@ var memos = std.Vector.new([ var rat = memo.new(msg: "RAT OUT", active: 0, colour: "g"), var emer_gen = memo.new(msg: "EMER GEN", active: 0, colour: "g"), var ram_air = memo.new(msg: "RAM AIR ON", active: 0, colour: "g"), - var nw_strg_disc = memo.new(msg: "NW STRG DISC", active: 0, colour: "g"), # Not yet implemented + var nw_strg_disc = memo.new(msg: "NW STRG DISC", active: 0, colour: "g"), var ignition = memo.new(msg: "IGNITION", active: 0, colour: "g"), var cabin_ready = memo.new(msg: "CABIN READY", active: 0, colour: "g"), # Not yet implemented var pred_ws_off = memo.new(msg: "PRED W/S OFF", active: 0, colour: "g"), # Not yet implemented @@ -151,7 +151,7 @@ var memos = std.Vector.new([ var brk_fan = memo.new(msg: "BRK FAN", active: 0, colour: "g"), # Not yet implemented var audio3_xfrd = memo.new(msg: "AUDIO 3 XFRD", active: 0, colour: "g"), # Not yet implemented var switchg_pnl = memo.new(msg: "SWITCHG PNL", active: 0, colour: "g"), # Not yet implemented - var gpws_flap3 = memo.new(msg: "GPWS FLAP 3", active: 0, colour: "g"), # Not yet implemented + var gpws_flap3 = memo.new(msg: "GPWS FLAP 3", active: 0, colour: "g"), var hf_data_ovrd = memo.new(msg: "HF DATA OVRD", active: 0, colour: "g"), # Not yet implemented var hf_voice = memo.new(msg: "HF VOICE", active: 0, colour: "g"), # Not yet implemented var acars_stby = memo.new(msg: "ACARS STBY", active: 0, colour: "g"), # Not yet implemented @@ -161,7 +161,7 @@ var memos = std.Vector.new([ var auto_brk_max = memo.new(msg: "AUTO BRK MAX", active: 0, colour: "g"), var auto_brk_off = memo.new(msg: "AUTO BRK OFF", active: 0, colour: "g"), # Not yet implemented var man_ldg_elev = memo.new(msg: "MAN LDG ELEV", active: 0, colour: "g"), # Not yet implemented - var ctr_tk_feedg = memo.new(msg: "CTR TK FEEDG", active: 0, colour: "g"), # Not yet implemented + var ctr_tk_feedg = memo.new(msg: "CTR TK FEEDG", active: 0, colour: "g"), var fuelx = memo.new(msg: "FUEL X FEED", active: 0, colour: "g") ]); diff --git a/Nasal/ECAM-logic.nas b/Nasal/ECAM-logic.nas index d22f19fa..98b4ecc5 100644 --- a/Nasal/ECAM-logic.nas +++ b/Nasal/ECAM-logic.nas @@ -143,6 +143,7 @@ var messages_right_memo = func { } else { athr_off.active = 0; } + if ((getprop("/ECAM/warning-phase") >= 2 and getprop("/ECAM/warning-phase") <= 7) and getprop("controls/flight/speedbrake") != 0) { spd_brk.active = 1; } else { @@ -184,6 +185,18 @@ var messages_right_memo = func { rat.colour = "g"; } + if (getprop("/sim/model/pushback/enabled") == 1) { + nw_strg_disc.active = 1; + } else { + nw_strg_disc.active = 0; + } + + if (getprop("/engines/engine[0]/state") == 3 or getprop("/engines/engine[1]/state") == 3) { + nw_strg_disc.colour = "a"; + } else { + nw_strg_disc.colour = "g"; + } + if (getprop("/controls/electrical/switches/emer-gen") == 1 and getprop("/controls/hydraulic/rat-deployed") == 1 and !wow) { emer_gen.active = 1; } else { @@ -201,6 +214,12 @@ var messages_right_memo = func { } else { ignition.active = 0; } + + if (getprop("/controls/pneumatic/switches/bleedapu") == 1 and getprop("/systems/apu/rpm") >= 95) { + apu_bleed.active = 1; + } else { + apu_bleed.active = 0; + } if (apu_bleed.active == 0 and getprop("/systems/apu/rpm") >= 95) { apu_avail.active = 1; @@ -225,6 +244,7 @@ var messages_right_memo = func { } else { wing_aice.active = 0; } + if (getprop("/instrumentation/comm[2]/frequencies/selected-mhz") != 0 and (getprop("/ECAM/warning-phase") == 1 or getprop("/ECAM/warning-phase") == 2 or getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") == 9 or getprop("/ECAM/warning-phase") == 10)) { vhf3_voice.active = 1; } else { @@ -259,4 +279,16 @@ var messages_right_memo = func { } else { fuelx.colour = "g"; } + + if (getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override") == 1) { # todo: emer elec + gpws_flap3.active = 1; + } else { + gpws_flap3.active = 0; + } + + if (getprop("/ECAM/warning-phase") >= 2 and getprop("/ECAM/warning-phase") <= 9 and getprop("/systems/fuel/only-use-ctr-tank") == 1 and getprop("/systems/electrical/bus/ac1") >= 115 and getprop("/systems/electrical/bus/ac2") >= 115) { + ctr_tk_feedg.active = 1; + } else { + ctr_tk_feedg.active = 0; + } } \ No newline at end of file diff --git a/Nasal/ECAM.nas b/Nasal/ECAM.nas index cbaaf425..e20d6092 100644 --- a/Nasal/ECAM.nas +++ b/Nasal/ECAM.nas @@ -195,15 +195,15 @@ var ECAM = { } # AP / ATHR warnings - if (ap1_active == 1 and (getprop("/ECAM/ap1-off-time") + 9 < getprop("/sim/time/elapsed-sec"))) { + if (ap1_active == 1 and getprop("/it-autoflight/input/ap1") == 0 and (getprop("/ECAM/ap1-off-time") + 9 < getprop("/sim/time/elapsed-sec"))) { ap1_active = 0; } - if (ap2_active == 1 and (getprop("/ECAM/ap2-off-time") + 9 < getprop("/sim/time/elapsed-sec"))) { + if (ap2_active == 1 and getprop("/it-autoflight/input/ap2") == 0 and (getprop("/ECAM/ap2-off-time") + 9 < getprop("/sim/time/elapsed-sec"))) { ap2_active = 0; } - if (athr_active == 1 and (getprop("/ECAM/athr-off-time") + 9 < getprop("/sim/time/elapsed-sec"))) { + if (athr_active == 1 and getprop("/it-autoflight/input/athr") == 0 and (getprop("/ECAM/athr-off-time") + 9 < getprop("/sim/time/elapsed-sec"))) { athr_active = 0; } @@ -452,7 +452,9 @@ setlistener("/it-autoflight/input/ap2", func { setlistener("/it-autoflight/input/athr", func { if (getprop("/it-autoflight/input/athr") == 0) { - athr_active = 1; - setprop("/ECAM/athr-off-time", getprop("/sim/time/elapsed-sec")); + if (getprop("/position/gear-agl-ft") > 50) { + athr_active = 1; + setprop("/ECAM/athr-off-time", getprop("/sim/time/elapsed-sec")); + } } }, 0, 0); \ No newline at end of file diff --git a/Nasal/FMGC-b.nas b/Nasal/FMGC-b.nas index 467d698d..f3077ebf 100644 --- a/Nasal/FMGC-b.nas +++ b/Nasal/FMGC-b.nas @@ -170,7 +170,7 @@ setlistener("/it-autoflight/input/athr", func { var atmas = getprop("/it-autoflight/input/athr"); if (atmas == 0) { setprop("/it-autoflight/output/athr", 0); - if (getprop("/it-autoflight/sound/enableathrsound") == 1 and getprop("/it-autoflight/output/athr") == 0) { + if (getprop("/it-autoflight/sound/enableathrsound") == 1 and getprop("/it-autoflight/output/athr") == 0 and getprop("/position/gear-agl-ft") > 50) { setprop("/it-autoflight/sound/athrsound", 1); setprop("/it-autoflight/sound/enableathrsound", 0); } diff --git a/Nasal/icing.nas b/Nasal/icing.nas index 05ac8df4..63859fd0 100644 --- a/Nasal/icing.nas +++ b/Nasal/icing.nas @@ -235,10 +235,10 @@ var icingModel = func { } } - if ((getprop("/systems/electrical/bus/dc1") == 0 or getprop("/systems/electrical/bus/dc2") == 0) and getprop("/fdm/jsbsim/position/wow") == 0) { - setprop("/controls/switches/leng", 1); - setprop("/controls/switches/reng", 1); - } + # if ((getprop("/systems/electrical/bus/dc1") == 0 or getprop("/systems/electrical/bus/dc2") == 0) and getprop("/fdm/jsbsim/position/wow") == 0) { + # setprop("/controls/switches/leng", 1); + # setprop("/controls/switches/reng", 1); + # } if (getprop("/systems/electrical/bus/dc-ess-shed") == 0) { setprop("/controls/switches/wing", 0);