From fc25237eb23b9c23d45c131250d193c1d55720dc Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 1 Aug 2020 15:04:54 +0100 Subject: [PATCH] INITA linked in --- Models/Instruments/MCDU/MCDU.nas | 6 +++++- Nasal/FMGC/SimbriefParser.nas | 8 +++++--- Nasal/FMGC/mcdu-messages.nas | 2 +- Nasal/MCDU/INITA.nas | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 030d6b7d..b5f10629 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -1963,7 +1963,11 @@ var canvas_MCDU_base = { me["Simple_L2"].setText("----/----------"); me.showRight(-1, 1, 0, 0, 0, 0); me["Simple_R2S"].show(); - me["INITA_InitRequest"].show(); + if (!Simbrief.SimbriefParser.inhibit) { + me["INITA_InitRequest"].show(); + } else { + me["INITA_InitRequest"].hide(); + } } if (ADIRSMCDUBTN.getValue() != 1) { me["INITA_AlignIRS"].show(); diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 39455603..abb80fef 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -3,20 +3,22 @@ var SimbriefParser = { node: nil, + inhibit: 0, fetch: func(username, i) { + me.inhibit = 1; var stamp = systime(); http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml") .fail(func mcdu.mcdu_message(i, "SIMBRIEF FAILED")) - .done(func me.read(getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml")); + .done(func me.read(getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml"), 1); }, - read: func(xml) { + read: func(xml, i) { var data = io.readxml(xml); if (data != nil) { if (data.getChild("OFP") == nil) { print("XML file " ~ xml ~ " not a valid Simbrief file"); } else { me.node = data; - debug.dump(me.node.getChild("OFP").getChild("fetch").getChild("status")); + mcdu.mcdu_message(i, "AOC ACT F-PLN UPLINK"); } } else { print("Error reading " ~ xml); diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index fe39417f..85fbcda2 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -172,7 +172,7 @@ var MessageController = { TypeIMessage.new("TMPY F-PLN EXISTS", 1),TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"), TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),TypeIMessage.new("RWY/LS MISMATCH"), TypeIMessage.new("VHF3 VOICE MSG NOT GEN"),TypeIMessage.new("NO COMM MSG NOT GEN"),TypeIMessage.new("WX UPLINK"), - TypeIMessage.new("SIMBRIEF FAILED"),TypeIMessage.new("MISSING USERNAME"), + TypeIMessage.new("SIMBRIEF FAILED"),TypeIMessage.new("MISSING USERNAME"),TypeIMessage.new("AOC ACT F-PLN UPLINK"), ]), typeIIMessages: std.Vector.new([ TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"), diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index e1103c02..4dea8526 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -186,6 +186,7 @@ var initInputA = func(key, i) { } fmgc.flightPlanController.reset(2); fmgc.flightPlanController.init(); + Simbrief.SimbriefParser.inhibit = 0; mcdu_scratchpad.scratchpads[i].empty(); #} else if (scratchpad == "") { #fmgc.FMGCInternal.altSelected = 0;