From 5d779bfe78de2142c9a77d9d5a9a05bc8db31968 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 29 Jul 2021 20:48:10 +0100 Subject: [PATCH 1/6] Add clicking sounds to FCU pushbuttons --- Models/FlightDeck/a320.flightdeck.xml | 8 ++++++++ Nasal/FMGC/FCU.nas | 9 +++++++++ Nasal/Panels/efis.nas | 2 ++ 3 files changed, 19 insertions(+) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 15758241..d5ebe5fa 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -3437,6 +3437,10 @@ property-toggle modes/pfd/ILS1 + + script + + @@ -3472,6 +3476,10 @@ property-toggle modes/pfd/ILS2 + + script + + diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index 69196aa4..3d3d78b5 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -72,6 +72,7 @@ var FCUController = { me.FCU2.restore(); }, AP1: func() { + libraries.pushbutton(); if (me.FCUworking) { if (!fmgc.Output.ap1.getBoolValue() and fbw.FBW.apOff == 0) { fmgc.Input.ap1.setValue(1); @@ -83,6 +84,7 @@ var FCUController = { } }, AP2: func() { + libraries.pushbutton(); if (me.FCUworking) { if (!fmgc.Output.ap2.getBoolValue() and fbw.FBW.apOff == 0) { fmgc.Input.ap2.setValue(1); @@ -94,6 +96,7 @@ var FCUController = { } }, ATHR: func() { + libraries.pushbutton(); if (me.FCUworking) { if (!fmgc.Output.athr.getBoolValue() and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0) { fmgc.Input.athr.setValue(1); @@ -103,6 +106,7 @@ var FCUController = { } }, FD1: func() { + libraries.pushbutton(); if (me.FCUworking) { if (!fmgc.Output.fd1.getBoolValue()) { fmgc.Input.fd1.setValue(1); @@ -112,6 +116,7 @@ var FCUController = { } }, FD2: func() { + libraries.pushbutton(); if (me.FCUworking) { if (!fmgc.Output.fd2.getBoolValue()) { fmgc.Input.fd2.setValue(1); @@ -162,6 +167,7 @@ var FCUController = { } }, IASMach: func() { + libraries.pushbutton(); if (me.FCUworking) { if (fmgc.Input.ktsMach.getBoolValue()) { fmgc.Input.ktsMach.setBoolValue(0); @@ -297,6 +303,7 @@ var FCUController = { }, vertTemp: nil, LOCButton: func() { + libraries.pushbutton(); if (me.FCUworking) { me.vertTemp = fmgc.Output.vert.getValue(); if ((fmgc.Output.locArm.getBoolValue() or fmgc.Output.lat.getValue() == 2) and !fmgc.Output.apprArm.getBoolValue() and me.vertTemp != 2 and me.vertTemp != 6) { @@ -323,6 +330,7 @@ var FCUController = { } }, TRKFPA: func() { + libraries.pushbutton(); if (me.FCUworking) { fmgc.ITAF.toggleTrkFpa(); } @@ -440,6 +448,7 @@ var FCUController = { } }, APPRButton: func() { + libraries.pushbutton(); if (me.FCUworking) { me.vertTemp = fmgc.Output.vert.getValue(); if ((fmgc.Output.locArm.getBoolValue() or fmgc.Output.lat.getValue() == 2) and (fmgc.Output.apprArm.getBoolValue() or me.vertTemp == 2 or me.vertTemp == 6)) { diff --git a/Nasal/Panels/efis.nas b/Nasal/Panels/efis.nas index 1106bfad..48dfe096 100644 --- a/Nasal/Panels/efis.nas +++ b/Nasal/Panels/efis.nas @@ -94,6 +94,7 @@ var setNDRange = func(n, d) { } var cpt_efis_btns = func(i) { + libraries.pushbutton(); if (i == "cstr") { setEfisOptions(0, 0, 1, 0, 0, 0, 0); } else if (i == "wpt") { @@ -110,6 +111,7 @@ var cpt_efis_btns = func(i) { } var fo_efis_btns = func(i) { + libraries.pushbutton(); if (i == "cstr") { setEfisOptions(1, 0, 1, 0, 0, 0, 0); } else if (i == "wpt") { From eb07683aedcc29d8de62b516062c7b9aba98a25f Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 29 Jul 2021 20:49:38 +0100 Subject: [PATCH 2/6] Syntax error --- Models/FlightDeck/a320.flightdeck.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index d5ebe5fa..67d5ff14 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -3438,7 +3438,7 @@ modes/pfd/ILS1 - script + nasal @@ -3477,7 +3477,7 @@ modes/pfd/ILS2 - script + nasal From 5e07e24e0fece3be78806a011570cb979ac7fbf2 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 29 Jul 2021 20:54:14 +0100 Subject: [PATCH 3/6] It actually already has a sound ... remove it --- Models/FlightDeck/a320.flightdeck.xml | 108 ++++++++++++++++++++++---- Nasal/FMGC/FCU.nas | 9 --- Nasal/Panels/efis.nas | 2 - 3 files changed, 95 insertions(+), 24 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 67d5ff14..0626c6a8 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -3073,6 +3073,10 @@ 0 1 + + nasal + + @@ -3439,7 +3443,7 @@ nasal - + @@ -3478,7 +3482,7 @@ nasal - + @@ -3552,9 +3556,12 @@ } else { fcu.cpt_efis_btns("off"); } - setprop("sim/sounde/btn1", 1); + + nasal + + @@ -3594,9 +3601,12 @@ } else { fcu.fo_efis_btns("off"); } - setprop("sim/sounde/btn1", 1); + + nasal + + @@ -3636,9 +3646,12 @@ } else { fcu.cpt_efis_btns("off"); } - setprop("sim/sounde/btn1", 1); + + nasal + + @@ -3678,9 +3691,12 @@ } else { fcu.fo_efis_btns("off"); } - setprop("sim/sounde/btn1", 1); + + nasal + + @@ -3720,9 +3736,12 @@ } else { fcu.cpt_efis_btns("off"); } - setprop("sim/sounde/btn1", 1); + + nasal + + @@ -3762,9 +3781,12 @@ } else { fcu.fo_efis_btns("off"); } - setprop("sim/sounde/btn1", 1); + + nasal + + @@ -3804,9 +3826,12 @@ } else { fcu.cpt_efis_btns("off"); } - setprop("sim/sounde/btn1", 1); + + nasal + + @@ -3846,9 +3871,12 @@ } else { fcu.fo_efis_btns("off"); } - setprop("sim/sounde/btn1", 1); + + nasal + + @@ -3888,9 +3916,12 @@ } else { fcu.cpt_efis_btns("off"); } - setprop("sim/sounde/btn1", 1); + + nasal + + @@ -3930,9 +3961,12 @@ } else { fcu.fo_efis_btns("off"); } - setprop("sim/sounde/btn1", 1); + + nasal + + @@ -4119,6 +4153,10 @@ 1 -1 + + nasal + + @@ -4130,6 +4168,10 @@ 1 0 + + nasal + + @@ -4159,6 +4201,10 @@ 1 -1 + + nasal + + @@ -4170,6 +4216,10 @@ 1 0 + + nasal + + @@ -4199,6 +4249,10 @@ 1 -1 + + nasal + + @@ -4210,6 +4264,10 @@ 1 0 + + nasal + + @@ -4239,6 +4297,10 @@ 1 -1 + + nasal + + @@ -4250,6 +4312,10 @@ 1 0 + + nasal + + @@ -6469,6 +6535,10 @@ } + + nasal + + @@ -6503,6 +6573,10 @@ } + + nasal + + @@ -9064,10 +9138,14 @@ 1 2 + + nasal + + - + pick chrono_fo @@ -9081,6 +9159,10 @@ 1 2 + + nasal + + diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index 3d3d78b5..69196aa4 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -72,7 +72,6 @@ var FCUController = { me.FCU2.restore(); }, AP1: func() { - libraries.pushbutton(); if (me.FCUworking) { if (!fmgc.Output.ap1.getBoolValue() and fbw.FBW.apOff == 0) { fmgc.Input.ap1.setValue(1); @@ -84,7 +83,6 @@ var FCUController = { } }, AP2: func() { - libraries.pushbutton(); if (me.FCUworking) { if (!fmgc.Output.ap2.getBoolValue() and fbw.FBW.apOff == 0) { fmgc.Input.ap2.setValue(1); @@ -96,7 +94,6 @@ var FCUController = { } }, ATHR: func() { - libraries.pushbutton(); if (me.FCUworking) { if (!fmgc.Output.athr.getBoolValue() and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0) { fmgc.Input.athr.setValue(1); @@ -106,7 +103,6 @@ var FCUController = { } }, FD1: func() { - libraries.pushbutton(); if (me.FCUworking) { if (!fmgc.Output.fd1.getBoolValue()) { fmgc.Input.fd1.setValue(1); @@ -116,7 +112,6 @@ var FCUController = { } }, FD2: func() { - libraries.pushbutton(); if (me.FCUworking) { if (!fmgc.Output.fd2.getBoolValue()) { fmgc.Input.fd2.setValue(1); @@ -167,7 +162,6 @@ var FCUController = { } }, IASMach: func() { - libraries.pushbutton(); if (me.FCUworking) { if (fmgc.Input.ktsMach.getBoolValue()) { fmgc.Input.ktsMach.setBoolValue(0); @@ -303,7 +297,6 @@ var FCUController = { }, vertTemp: nil, LOCButton: func() { - libraries.pushbutton(); if (me.FCUworking) { me.vertTemp = fmgc.Output.vert.getValue(); if ((fmgc.Output.locArm.getBoolValue() or fmgc.Output.lat.getValue() == 2) and !fmgc.Output.apprArm.getBoolValue() and me.vertTemp != 2 and me.vertTemp != 6) { @@ -330,7 +323,6 @@ var FCUController = { } }, TRKFPA: func() { - libraries.pushbutton(); if (me.FCUworking) { fmgc.ITAF.toggleTrkFpa(); } @@ -448,7 +440,6 @@ var FCUController = { } }, APPRButton: func() { - libraries.pushbutton(); if (me.FCUworking) { me.vertTemp = fmgc.Output.vert.getValue(); if ((fmgc.Output.locArm.getBoolValue() or fmgc.Output.lat.getValue() == 2) and (fmgc.Output.apprArm.getBoolValue() or me.vertTemp == 2 or me.vertTemp == 6)) { diff --git a/Nasal/Panels/efis.nas b/Nasal/Panels/efis.nas index 48dfe096..1106bfad 100644 --- a/Nasal/Panels/efis.nas +++ b/Nasal/Panels/efis.nas @@ -94,7 +94,6 @@ var setNDRange = func(n, d) { } var cpt_efis_btns = func(i) { - libraries.pushbutton(); if (i == "cstr") { setEfisOptions(0, 0, 1, 0, 0, 0, 0); } else if (i == "wpt") { @@ -111,7 +110,6 @@ var cpt_efis_btns = func(i) { } var fo_efis_btns = func(i) { - libraries.pushbutton(); if (i == "cstr") { setEfisOptions(1, 0, 1, 0, 0, 0, 0); } else if (i == "wpt") { From 0b44b47a7d71d4f443d2d123d4f08975d90ce2b0 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 29 Jul 2021 23:40:38 +0100 Subject: [PATCH 4/6] Bugfix MCDU scratchpad / message queue --- Nasal/FMGC/mcdu-messages.nas | 3 ++- Nasal/MCDU/MCDU.nas | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index b3274ff5..f7643d6e 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -190,6 +190,7 @@ var MessageController = { TypeIIMessage.new("STEP NOW"),TypeIIMessage.new("TIME TO EXIT", "amb", 0),TypeIIMessage.new("V1/VR/V2 DISAGREE", "amb", 0), TypeIIMessage.new("TO SPEED TOO LOW", "amb", 0), TypeIIMessage.new("CHECK DEST DATA", "amb", 0), #p.533 + TypeIIMessage.new("GPS PRIMARY"),TypeIIMessage.new("GPS PRIMARY LOST", "amb", 0), ]), # to speed to low - new on a320, margin against vmcg / vs1g @@ -202,7 +203,7 @@ var MessageController = { }, getMsgByText: func(text, theVector) { foreach (var message; theVector) { - if (message.msgText = text) { + if (message.msgText == text) { return message; } } diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index d092eca9..5e130ad7 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -217,14 +217,14 @@ var lskbutton = func(btn, i) { setprop("/MCDU[" ~ i ~ "]/active", 1); settimer(func(){ pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); - mcdu_scratchpad.scratchpads[i].empty(); + mcdu_scratchpad.scratchpads[i].clear(); setprop("/MCDU[" ~ i ~ "]/active", 2); setprop("/MCDU[" ~ i ~ "]/active-system","fmgc"); }, 2); } else { pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); setprop("/MCDU[" ~ i ~ "]/active-system","fmgc"); - mcdu_scratchpad.scratchpads[i].empty(); + mcdu_scratchpad.scratchpads[i].clear(); } } } else if (page == "IRSINIT") { @@ -377,14 +377,14 @@ var lskbutton = func(btn, i) { setprop("/MCDU[" ~ i ~ "]/atsu-active", 1); settimer(func(){ pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-atsu-page")); - mcdu_scratchpad.scratchpads[i].empty(); + mcdu_scratchpad.scratchpads[i].clear(); setprop("/MCDU[" ~ i ~ "]/atsu-active", 2); setprop("/MCDU[" ~ i ~ "]/active-system","atsu"); }, 2); } else { pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-atsu-page")); setprop("/MCDU[" ~ i ~ "]/active-system","atsu"); - mcdu_scratchpad.scratchpads[i].empty(); + mcdu_scratchpad.scratchpads[i].clear(); } } } else if (page == "INITA") { From 5eaad7d98f82c309b9345b3f1ed68665ec74b520 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 30 Jul 2021 11:04:11 +0100 Subject: [PATCH 5/6] GPS PRIMARY LOST --- Models/Instruments/ND/canvas/style.nas | 16 ++++++++++------ Nasal/Systems/ADIRS/ADR.nas | 13 ++++++++++++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index a0dfa99b..e207a4a1 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -707,18 +707,22 @@ canvas.NDStyles["Airbus"] = { id: "nd_warn_memo", impl: { init: func(nd, symbol), - predicate: ALWAYS, - is_true: func(nd) nd.symbols.nd_warn_memo.hide(), - is_false: func(nd), + predicate: func(nd) { + !systems.ADIRS.Operating.aligned[0].getBoolValue() and !systems.ADIRS.Operating.aligned[1].getBoolValue() and !systems.ADIRS.Operating.aligned[2].getBoolValue() + }, + is_true: func(nd) nd.symbols.nd_warn_memo.show(), + is_false: func(nd) nd.symbols.nd_warn_memo.hide(), }, }, { id: "nd_warn_msgbox", impl: { init: func(nd, symbol), - predicate: ALWAYS, - is_true: func(nd) nd.symbols.nd_warn_msgbox.hide(), - is_false: func(nd), + predicate: func(nd) { + !systems.ADIRS.Operating.aligned[0].getBoolValue() and !systems.ADIRS.Operating.aligned[1].getBoolValue() and !systems.ADIRS.Operating.aligned[2].getBoolValue() + }, + is_true: func(nd) nd.symbols.nd_warn_msgbox.show(), + is_false: func(nd) nd.symbols.nd_warn_msgbox.hide(), }, }, { diff --git a/Nasal/Systems/ADIRS/ADR.nas b/Nasal/Systems/ADIRS/ADR.nas index 08d6d57d..1ce8ae44 100644 --- a/Nasal/Systems/ADIRS/ADR.nas +++ b/Nasal/Systems/ADIRS/ADR.nas @@ -110,7 +110,6 @@ var ADIRU = { } }, stopAlignNoAlign: func() { - print("Stopping alignment or setting unaligned state"); me.inAlign = 0; me.aligned = 0; ADIRSnodesND[me.num].setValue(0); @@ -324,6 +323,7 @@ var ADIRS = { } ), ], + _hasGPSPrimLost: 0, loop: func(notification) { if (me._init) { for (i = 0; i < _NUMADIRU; i = i + 1) { @@ -345,8 +345,19 @@ var ADIRS = { me.Operating.adr[i].setValue(0); } } + + if (!me.Operating.aligned[0].getBoolValue() and !me.Operating.aligned[1].getBoolValue() and !me.Operating.aligned[2].getBoolValue()) { + if (!me._hasGPSPrimLost) { + mcdu_scratchpad.messageQueues[0].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("GPS PRIMARY LOST")); + mcdu_scratchpad.messageQueues[1].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("GPS PRIMARY LOST")); + } + me._hasGPSPrimLost = 1; + } else { + me._hasGPSPrimLost = 0; + } } + # Update VFE foreach (var update_item; me.update_items) { update_item.update(notification); From 36b78c31023c27856a47d2eac7a712c472b07985 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 30 Jul 2021 12:30:34 +0100 Subject: [PATCH 6/6] GPS PRIMARY --- Models/Instruments/ND/canvas/ND.nas | 2 ++ Models/Instruments/ND/canvas/style.nas | 17 ++++++++++++++--- Nasal/FMGC/mcdu-messages.nas | 7 +++++++ Nasal/Systems/ADIRS/ADR.nas | 20 +++++++++++++++++--- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Models/Instruments/ND/canvas/ND.nas b/Models/Instruments/ND/canvas/ND.nas index 1b558f5c..ef0c3669 100644 --- a/Models/Instruments/ND/canvas/ND.nas +++ b/Models/Instruments/ND/canvas/ND.nas @@ -218,6 +218,7 @@ var canvas_ND_1 = { # here we make the ND: me.NDCpt = ND.new("/instrumentation/efis", myCockpit_switches, "Airbus"); me.NDCpt.attitude_heading_setting = -1; + me.NDCpt.number = 0; me.NDCpt.adirs_property = props.globals.getNode("/instrumentation/efis[0]/nd/ir-1",1); me.NDCpt.newMFD(canvas_group); me.NDCpt.change_phase = 0; @@ -243,6 +244,7 @@ var canvas_ND_2 = { myCockpit_switches["ADIRS"]= {path: "/nd/ir-2", value: 0, type: "BOOL"}; me.NDFo = ND.new("/instrumentation/efis[1]", myCockpit_switches, "Airbus"); me.NDFo.attitude_heading_setting = 1; + me.NDFo.number = 1; me.NDFo.adirs_property = props.globals.getNode("/instrumentation/efis[1]/nd/ir-2",1); me.NDFo.newMFD(canvas_group); me.NDFo.change_phase = 0; diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index e207a4a1..4e8205ef 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -708,9 +708,19 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd, symbol), predicate: func(nd) { - !systems.ADIRS.Operating.aligned[0].getBoolValue() and !systems.ADIRS.Operating.aligned[1].getBoolValue() and !systems.ADIRS.Operating.aligned[2].getBoolValue() + (!systems.ADIRS.Operating.aligned[0].getBoolValue() and !systems.ADIRS.Operating.aligned[1].getBoolValue() and !systems.ADIRS.Operating.aligned[2].getBoolValue()) + or (mcdu_scratchpad.scratchpads[nd.number].showTypeIIMsg and mcdu_scratchpad.scratchpads[nd.number].scratchpad == "GPS PRIMARY") + }, + is_true: func(nd) { + nd.symbols.nd_warn_memo.show(); + if (mcdu_scratchpad.scratchpads[nd.number].showTypeIIMsg and mcdu_scratchpad.scratchpads[nd.number].scratchpad == "GPS PRIMARY") { + nd.symbols.nd_warn_memo.setText("GPS PRIMARY"); + nd.symbols.nd_warn_memo.setColor(0.8078,0.8039,0.8078); + } else { + nd.symbols.nd_warn_memo.setText("GPS PRIMARY LOST"); + nd.symbols.nd_warn_memo.setColor(0.7333,0.3803,0); + } }, - is_true: func(nd) nd.symbols.nd_warn_memo.show(), is_false: func(nd) nd.symbols.nd_warn_memo.hide(), }, }, @@ -719,7 +729,8 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd, symbol), predicate: func(nd) { - !systems.ADIRS.Operating.aligned[0].getBoolValue() and !systems.ADIRS.Operating.aligned[1].getBoolValue() and !systems.ADIRS.Operating.aligned[2].getBoolValue() + (!systems.ADIRS.Operating.aligned[0].getBoolValue() and !systems.ADIRS.Operating.aligned[1].getBoolValue() and !systems.ADIRS.Operating.aligned[2].getBoolValue()) + or (mcdu_scratchpad.scratchpads[nd.number].showTypeIIMsg and mcdu_scratchpad.scratchpads[nd.number].scratchpad == "GPS PRIMARY") }, is_true: func(nd) nd.symbols.nd_warn_msgbox.show(), is_false: func(nd) nd.symbols.nd_warn_msgbox.hide(), diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index f7643d6e..4446ec8f 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -47,6 +47,13 @@ var MessageQueueController = { me.messages.pop(index); } }, + deleteWithText: func(text) { + foreach (var message; me.messages.vector) { + if (message.msgText == text) { + me.messages.remove(message); + } + } + }, clearQueue: func() { me.messages.clear(); }, diff --git a/Nasal/Systems/ADIRS/ADR.nas b/Nasal/Systems/ADIRS/ADR.nas index 1ce8ae44..7d29e6ef 100644 --- a/Nasal/Systems/ADIRS/ADR.nas +++ b/Nasal/Systems/ADIRS/ADR.nas @@ -153,7 +153,6 @@ var ADIRU = { if (me._gs > 5 or abs(me._pitch) > 5 or abs(me._roll) > 10) { me.stopAlignNoAlign(); me._excessMotion = 1; - print("Excessive motion, restarting"); me.update(); # update operative me.align(calcAlignTime(pts.Position.latitude.getValue())); } elsif (me.operative == 0) { @@ -324,6 +323,7 @@ var ADIRS = { ), ], _hasGPSPrimLost: 0, + _hasGPSPrim: 0, loop: func(notification) { if (me._init) { for (i = 0; i < _NUMADIRU; i = i + 1) { @@ -350,10 +350,24 @@ var ADIRS = { if (!me._hasGPSPrimLost) { mcdu_scratchpad.messageQueues[0].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("GPS PRIMARY LOST")); mcdu_scratchpad.messageQueues[1].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("GPS PRIMARY LOST")); + me._hasGPSPrimLost = 1; } - me._hasGPSPrimLost = 1; } else { - me._hasGPSPrimLost = 0; + if (me._hasGPSPrimLost) { + mcdu_scratchpad.messageQueues[0].deleteWithText("GPS PRIMARY LOST"); + mcdu_scratchpad.messageQueues[1].deleteWithText("GPS PRIMARY LOST"); + me._hasGPSPrimLost = 0; + } + } + + if (me.Operating.aligned[0].getBoolValue() or me.Operating.aligned[1].getBoolValue() or me.Operating.aligned[2].getBoolValue()) { + if (!me._hasGPSPrim) { + mcdu_scratchpad.messageQueues[0].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("GPS PRIMARY")); + mcdu_scratchpad.messageQueues[1].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("GPS PRIMARY")); + me._hasGPSPrim = 1; + } + } else { + me._hasGPSPrim = 0; } }