From 5eaad7d98f82c309b9345b3f1ed68665ec74b520 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 30 Jul 2021 11:04:11 +0100 Subject: [PATCH] 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);