From 131562d2be6986fadc823df11e6c1f9f94d1fa1e Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 27 Dec 2021 13:36:18 +0000 Subject: [PATCH 1/5] Add tune VOR by ident --- Nasal/FMGC/FMGC.nas | 1 + Nasal/MCDU/RADNAV.nas | 158 +++++++++++++++++++++++++++++++++--------- 2 files changed, 128 insertions(+), 31 deletions(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index f23d9af3..7ca79fe1 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -525,6 +525,7 @@ var updateFuel = func { ############################ # Flight Phase and Various # ############################ +# TODO - if no ID is found, should trigger a NOT IN DATA BASE message var freqnav0 = nil; var nav0 = func { freqnav0 = sprintf("%.2f", pts.Instrumentation.Nav.Frequencies.selectedMhz[0].getValue()); diff --git a/Nasal/MCDU/RADNAV.nas b/Nasal/MCDU/RADNAV.nas index f772799c..3b1f7275 100644 --- a/Nasal/MCDU/RADNAV.nas +++ b/Nasal/MCDU/RADNAV.nas @@ -4,6 +4,46 @@ var radNavScratchpad = nil; var radNavScratchpadSize = nil; +var parseFrequencyVOR = func(scratchpad, i, num) { + if (size(scratchpad) == 3 or size(scratchpad) == 5 or size(scratchpad) == 6) { + if (scratchpad >= 108.00 and scratchpad <= 111.95) { + if (scratchpad == 108.10 or scratchpad == 108.15 or scratchpad == 108.30 or scratchpad == 108.35 or scratchpad == 108.50 or scratchpad == 108.55 or scratchpad == 108.70 or scratchpad == 108.75 or scratchpad == 108.90 or scratchpad == 108.95 + or scratchpad == 109.10 or scratchpad == 109.15 or scratchpad == 109.30 or scratchpad == 109.35 or scratchpad == 109.50 or scratchpad == 109.55 or scratchpad == 109.70 or scratchpad == 109.75 or scratchpad == 109.90 or scratchpad == 109.95 + or scratchpad == 110.10 or scratchpad == 110.15 or scratchpad == 110.30 or scratchpad == 110.35 or scratchpad == 110.50 or scratchpad == 110.55 or scratchpad == 110.70 or scratchpad == 110.75 or scratchpad == 110.90 or scratchpad == 110.95 + or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) { + return 3; + } else { + pts.Instrumentation.Nav.Frequencies.selectedMhz[num].setValue(scratchpad); + return 4; + } + } else if (scratchpad >= 112.00 and scratchpad <= 117.95) { + pts.Instrumentation.Nav.Frequencies.selectedMhz[num].setValue(scratchpad); + return 4; + } else { + return 2; + } + } else { + return 1; + } +} + +var searchResult = nil; +var parseIdentVOR = func(scratchpad, i, num) { + # TODO - duplicate names + if (size(scratchpad) == 3) { + searchResult = findNavaidsByID(scratchpad); + if (size(searchResult) != 0) { + pts.Instrumentation.Nav.Frequencies.selectedMhz[num].setValue(searchResult[0].frequency / 100); + return 3; + } else { + return 2; + } + } else { + return 1; + } +}; + +var returny = nil; var radnavInput = func(key, i) { radNavScratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; radNavScratchpadSize = size(radNavScratchpad); @@ -13,27 +53,55 @@ var radnavInput = func(key, i) { fmgc.FMGCInternal.VOR1.freqSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { - if (radNavScratchpadSize == 3 or radNavScratchpadSize == 5 or radNavScratchpadSize == 6) { - if (radNavScratchpad >= 108.00 and radNavScratchpad <= 111.95) { - if (radNavScratchpad == 108.10 or radNavScratchpad == 108.15 or radNavScratchpad == 108.30 or radNavScratchpad == 108.35 or radNavScratchpad == 108.50 or radNavScratchpad == 108.55 or radNavScratchpad == 108.70 or radNavScratchpad == 108.75 or radNavScratchpad == 108.90 or radNavScratchpad == 108.95 - or radNavScratchpad == 109.10 or radNavScratchpad == 109.15 or radNavScratchpad == 109.30 or radNavScratchpad == 109.35 or radNavScratchpad == 109.50 or radNavScratchpad == 109.55 or radNavScratchpad == 109.70 or radNavScratchpad == 109.75 or radNavScratchpad == 109.90 or radNavScratchpad == 109.95 - or radNavScratchpad == 110.10 or radNavScratchpad == 110.15 or radNavScratchpad == 110.30 or radNavScratchpad == 110.35 or radNavScratchpad == 110.50 or radNavScratchpad == 110.55 or radNavScratchpad == 110.70 or radNavScratchpad == 110.75 or radNavScratchpad == 110.90 or radNavScratchpad == 110.95 - or radNavScratchpad == 111.10 or radNavScratchpad == 111.15 or radNavScratchpad == 111.30 or radNavScratchpad == 111.35 or radNavScratchpad == 111.50 or radNavScratchpad == 111.55 or radNavScratchpad == 111.70 or radNavScratchpad == 111.75 or radNavScratchpad == 111.90 or radNavScratchpad == 111.95) { - mcdu_message(i, "NOT ALLOWED"); + if (size(split("/", radNavScratchpad)) == 2) { + if (size(split("/", radNavScratchpad)[0]) != 0) { + mcdu_message(i, "FORMAT ERROR"); + return; + } else { + radNavScratchpad = split("/", radNavScratchpad)[1]; + if (num(radNavScratchpad) != radNavScratchpad) { + mcdu_message(i, "FORMAT ERROR"); } else { - pts.Instrumentation.Nav.Frequencies.selectedMhz[2].setValue(radNavScratchpad); + returny = parseFrequencyVOR(radNavScratchpad, i, 2); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.VOR1.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } + } + } else if (size(split("/", radNavScratchpad)) == 1) { + if (num(radNavScratchpad) == radNavScratchpad) { + returny = parseFrequencyVOR(radNavScratchpad, i, 2); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.VOR1.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } else if (isstr(radNavScratchpad)) { + returny = parseIdentVOR(radNavScratchpad, i, 2); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + # TODO - NEW NAVAID page + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (returny == 3) { fmgc.FMGCInternal.VOR1.freqSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } - } else if (radNavScratchpad >= 112.00 and radNavScratchpad <= 117.95) { - pts.Instrumentation.Nav.Frequencies.selectedMhz[2].setValue(radNavScratchpad); - fmgc.FMGCInternal.VOR1.freqSet = 1; - mcdu_scratchpad.scratchpads[i].empty(); - } else { - mcdu_message(i, "NOT ALLOWED"); } } else { - mcdu_message(i, "NOT ALLOWED"); + mcdu_message(i, "FORMAT ERROR"); } } } else if (key == "L2") { @@ -142,30 +210,58 @@ var radnavInput = func(key, i) { } } else if (key == "R1") { if (radNavScratchpad == "CLR") { - fmgc.FMGCInternal.VOR2.freqSet = 0; + fmgc.FMGCInternal.VOR1.freqSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { - if (radNavScratchpadSize == 3 or radNavScratchpadSize == 5 or radNavScratchpadSize == 6) { - if (radNavScratchpad >= 108.10 and radNavScratchpad <= 111.95) { - if (radNavScratchpad == 108.10 or radNavScratchpad == 108.15 or radNavScratchpad == 108.30 or radNavScratchpad == 108.35 or radNavScratchpad == 108.50 or radNavScratchpad == 108.55 or radNavScratchpad == 108.70 or radNavScratchpad == 108.75 or radNavScratchpad == 108.90 or radNavScratchpad == 108.95 - or radNavScratchpad == 109.10 or radNavScratchpad == 109.15 or radNavScratchpad == 109.30 or radNavScratchpad == 109.35 or radNavScratchpad == 109.50 or radNavScratchpad == 109.55 or radNavScratchpad == 109.70 or radNavScratchpad == 109.75 or radNavScratchpad == 109.90 or radNavScratchpad == 109.95 - or radNavScratchpad == 110.10 or radNavScratchpad == 110.15 or radNavScratchpad == 110.30 or radNavScratchpad == 110.35 or radNavScratchpad == 110.50 or radNavScratchpad == 110.55 or radNavScratchpad == 110.70 or radNavScratchpad == 110.75 or radNavScratchpad == 110.90 or radNavScratchpad == 110.95 - or radNavScratchpad == 111.10 or radNavScratchpad == 111.15 or radNavScratchpad == 111.30 or radNavScratchpad == 111.35 or radNavScratchpad == 111.50 or radNavScratchpad == 111.55 or radNavScratchpad == 111.70 or radNavScratchpad == 111.75 or radNavScratchpad == 111.90 or radNavScratchpad == 111.95) { - mcdu_message(i, "NOT ALLOWED"); + if (size(split("/", radNavScratchpad)) == 2) { + if (size(split("/", radNavScratchpad)[1]) != 0) { + mcdu_message(i, "FORMAT ERROR"); + return; + } else { + radNavScratchpad = split("/", radNavScratchpad)[0]; + if (num(radNavScratchpad) != radNavScratchpad) { + mcdu_message(i, "FORMAT ERROR"); } else { - pts.Instrumentation.Nav.Frequencies.selectedMhz[3].setValue(radNavScratchpad); + returny = parseFrequencyVOR(radNavScratchpad, i, 3); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.VOR2.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } + } + } else if (size(split("/", radNavScratchpad)) == 1) { + if (num(radNavScratchpad) == radNavScratchpad) { + returny = parseFrequencyVOR(radNavScratchpad, i, 3); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.VOR2.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } else if (isstr(radNavScratchpad)) { + returny = parseIdentVOR(radNavScratchpad, i, 3); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + # TODO - NEW NAVAID page + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (returny == 3) { fmgc.FMGCInternal.VOR2.freqSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } - } else if (radNavScratchpad >= 112.00 and radNavScratchpad <= 117.95) { - pts.Instrumentation.Nav.Frequencies.selectedMhz[3].setValue(radNavScratchpad); - fmgc.FMGCInternal.VOR2.freqSet = 1; - mcdu_scratchpad.scratchpads[i].empty(); - } else { - mcdu_message(i, "NOT ALLOWED"); } } else { - mcdu_message(i, "NOT ALLOWED"); + mcdu_message(i, "FORMAT ERROR"); } } } else if (key == "R2") { From 8d70481780e836f25b6647cdc9564c20c38f5ec9 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 27 Dec 2021 13:57:57 +0000 Subject: [PATCH 2/5] ADF autotune --- Nasal/MCDU/RADNAV.nas | 152 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 124 insertions(+), 28 deletions(-) diff --git a/Nasal/MCDU/RADNAV.nas b/Nasal/MCDU/RADNAV.nas index 3b1f7275..72582450 100644 --- a/Nasal/MCDU/RADNAV.nas +++ b/Nasal/MCDU/RADNAV.nas @@ -27,13 +27,53 @@ var parseFrequencyVOR = func(scratchpad, i, num) { } } -var searchResult = nil; +var searchResultVOR = nil; var parseIdentVOR = func(scratchpad, i, num) { # TODO - duplicate names if (size(scratchpad) == 3) { - searchResult = findNavaidsByID(scratchpad); - if (size(searchResult) != 0) { - pts.Instrumentation.Nav.Frequencies.selectedMhz[num].setValue(searchResult[0].frequency / 100); + searchResultVOR = findNavaidsByID(scratchpad); + if (size(searchResultVOR) != 0) { + pts.Instrumentation.Nav.Frequencies.selectedMhz[num].setValue(searchResultVOR[0].frequency / 100); + return 3; + } else { + return 2; + } + } else { + return 1; + } +}; + +var splitScratchpadADF = nil; +var parseFrequencyADF = func(scratchpad, i, num) { + if (size(scratchpad) >= 3 and size(scratchpad) <= 6) { + if (scratchpad >= 190 and scratchpad <= 1799) { + if (scratchpad != int(scratchpad)) { + splitScratchpadADF = split(".",scratchpad); + if (size(splitScratchpadADF) != 2 or splitScratchpadADF[1] != "5") { + return 3; + } else { + pts.Instrumentation.Adf.Frequencies.selectedKhz[num].setValue(scratchpad); + return 4; + } + } else { + pts.Instrumentation.Adf.Frequencies.selectedKhz[num].setValue(scratchpad); + return 4; + } + } else { + return 2; + } + } else { + return 1; + } +} + +var searchResultADF = nil; +var parseIdentADF = func(scratchpad, i, num) { + # TODO - duplicate names + if (size(scratchpad) == 2 or size(scratchpad) == 3) { + searchResultADF = findNavaidsByID(scratchpad); + if (size(searchResultADF) != 0) { + pts.Instrumentation.Adf.Frequencies.selectedKhz[num].setValue(searchResultADF[0].frequency / 100); return 3; } else { return 2; @@ -170,27 +210,55 @@ var radnavInput = func(key, i) { fmgc.FMGCInternal.ADF1.freqSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { - if (radNavScratchpadSize >= 3 and radNavScratchpadSize <= 6) { - if (radNavScratchpad >= 190 and radNavScratchpad <= 1799) { - if (radNavScratchpad != int(radNavScratchpad)) { - var splitradNavScratchpad = split(".",radNavScratchpad); - if (size(splitradNavScratchpad) != 2 or splitradNavScratchpad[1] != "5") { + if (size(split("/", radNavScratchpad)) == 2) { + if (size(split("/", radNavScratchpad)[0]) != 0) { + mcdu_message(i, "FORMAT ERROR"); + return; + } else { + radNavScratchpad = split("/", radNavScratchpad)[1]; + if (num(radNavScratchpad) != radNavScratchpad) { + mcdu_message(i, "FORMAT ERROR"); + } else { + returny = parseFrequencyADF(radNavScratchpad, i, 0); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { mcdu_message(i, "NOT ALLOWED"); - } else { - pts.Instrumentation.Adf.Frequencies.selectedKhz[0].setValue(radNavScratchpad); + } elsif (returny == 4) { fmgc.FMGCInternal.ADF1.freqSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } - } else { - pts.Instrumentation.Adf.Frequencies.selectedKhz[0].setValue(radNavScratchpad); + } + } + } else if (size(split("/", radNavScratchpad)) == 1) { + if (num(radNavScratchpad) == radNavScratchpad) { + returny = parseFrequencyADF(radNavScratchpad, i, 0); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.ADF1.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } else if (isstr(radNavScratchpad)) { + returny = parseIdentADF(radNavScratchpad, i, 0); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + # TODO - NEW NAVAID page + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (returny == 3) { fmgc.FMGCInternal.ADF1.freqSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } - } else { - mcdu_message(i, "NOT ALLOWED"); } } else { - mcdu_message(i, "NOT ALLOWED"); + mcdu_message(i, "FORMAT ERROR"); } } } else if (key == "L6") { @@ -286,27 +354,55 @@ var radnavInput = func(key, i) { fmgc.FMGCInternal.ADF2.freqSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { - if (radNavScratchpadSize >= 3 and radNavScratchpadSize <= 6) { - if (radNavScratchpad >= 190 and radNavScratchpad <= 1799) { - if (radNavScratchpad != int(radNavScratchpad)) { - var splitradNavScratchpad = split(".",radNavScratchpad); - if (size(splitradNavScratchpad) != 2 or splitradNavScratchpad[1] != "5") { + if (size(split("/", radNavScratchpad)) == 2) { + if (size(split("/", radNavScratchpad)[1]) != 0) { + mcdu_message(i, "FORMAT ERROR"); + return; + } else { + radNavScratchpad = split("/", radNavScratchpad)[0]; + if (num(radNavScratchpad) != radNavScratchpad) { + mcdu_message(i, "FORMAT ERROR"); + } else { + returny = parseFrequencyADF(radNavScratchpad, i, 1); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { mcdu_message(i, "NOT ALLOWED"); - } else { - pts.Instrumentation.Adf.Frequencies.selectedKhz[1].setValue(radNavScratchpad); + } elsif (returny == 4) { fmgc.FMGCInternal.ADF2.freqSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } - } else { - pts.Instrumentation.Adf.Frequencies.selectedKhz[1].setValue(radNavScratchpad); + } + } + } else if (size(split("/", radNavScratchpad)) == 1) { + if (num(radNavScratchpad) == radNavScratchpad) { + returny = parseFrequencyADF(radNavScratchpad, i, 1); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } elsif (returny == 3) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (returny == 4) { + fmgc.FMGCInternal.ADF2.freqSet = 1; + mcdu_scratchpad.scratchpads[i].empty(); + } + } else if (isstr(radNavScratchpad)) { + returny = parseIdentADF(radNavScratchpad, i, 1); + if (returny == 1) { + mcdu_message(i, "FORMAT ERROR"); + } elsif (returny == 2) { + # TODO - NEW NAVAID page + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (returny == 3) { fmgc.FMGCInternal.ADF2.freqSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } - } else { - mcdu_message(i, "NOT ALLOWED"); } } else { - mcdu_message(i, "NOT ALLOWED"); + mcdu_message(i, "FORMAT ERROR"); } } } else if (key == "R6") { From 7833a3a5f23296d1123c0f5d2e615ea2b065b1f5 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 27 Dec 2021 15:21:33 +0000 Subject: [PATCH 3/5] VOR: accept 2-char long idents --- Nasal/MCDU/RADNAV.nas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nasal/MCDU/RADNAV.nas b/Nasal/MCDU/RADNAV.nas index 72582450..d42722e5 100644 --- a/Nasal/MCDU/RADNAV.nas +++ b/Nasal/MCDU/RADNAV.nas @@ -30,7 +30,7 @@ var parseFrequencyVOR = func(scratchpad, i, num) { var searchResultVOR = nil; var parseIdentVOR = func(scratchpad, i, num) { # TODO - duplicate names - if (size(scratchpad) == 3) { + if (size(scratchpad) == 2 or size(scratchpad) == 3) { searchResultVOR = findNavaidsByID(scratchpad); if (size(searchResultVOR) != 0) { pts.Instrumentation.Nav.Frequencies.selectedMhz[num].setValue(searchResultVOR[0].frequency / 100); From 183f6e888f888ada1ec71ce907dd9289c6b00be2 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 27 Dec 2021 15:43:45 +0000 Subject: [PATCH 4/5] Add a small M to the ND to show that the VOR has been manually tuned --- .../ND/canvas/framework/navdisplay.nas | 35 +- Models/Instruments/ND/canvas/res/airbusND.svg | 502 +++++++++--------- Models/Instruments/ND/canvas/style.nas | 30 +- Nasal/MCDU/RADNAV.nas | 2 +- 4 files changed, 314 insertions(+), 255 deletions(-) diff --git a/Models/Instruments/ND/canvas/framework/navdisplay.nas b/Models/Instruments/ND/canvas/framework/navdisplay.nas index 4220dcf8..e144ab0d 100644 --- a/Models/Instruments/ND/canvas/framework/navdisplay.nas +++ b/Models/Instruments/ND/canvas/framework/navdisplay.nas @@ -212,7 +212,8 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update # because things are much better configurable that way # now look up all required SVG elements and initialize member fields using the same name to have a convenient handle foreach(var element; ["dmeL","dmeR","vorL","vorR","vorLId","vorRId", - "status.wxr","status.wpt","status.sta","status.arpt","terrHI","terrLO","TerrLabel","terrAhead","terrAltGroup"]) + "status.wxr","status.wpt","status.sta","status.arpt","terrHI","terrLO","TerrLabel","terrAhead","terrAltGroup", + "vorLIdtuneMode","vorRIdtuneMode"]) me.symbols[element] = me.nd.getElementById(element); foreach(var element; ["dmeLDist","dmeRDist"]) @@ -572,7 +573,31 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec var dme1_path = "/instrumentation/dme[2]"; var dme2_path = "/instrumentation/dme[3]"; + + if(me.get_switch("toggle_lh_vor_adf") == 1) { + if (fmgc.FMGCInternal.VOR1.freqSet) { + me.symbols.vorLIdtuneMode.show(); + } else { + me.symbols.vorLIdtuneMode.hide(); + } + } else if(me.get_switch("toggle_lh_vor_adf") == -1) { + if (fmgc.FMGCInternal.ADF1.freqSet) { + me.symbols.vorLIdtuneMode.show(); + } else { + me.symbols.vorLIdtuneMode.hide(); + } + } else { + me.symbols.vorLIdtuneMode.hide(); + } + if(me.get_switch("toggle_rh_vor_adf") == 1) { + + if (fmgc.FMGCInternal.VOR2.freqSet) { + me.symbols.vorRIdtuneMode.show(); + } else { + me.symbols.vorRIdtuneMode.hide(); + } + me.symbols.vorR.setText("VOR R"); me.symbols.vorR.setColor(0.195,0.96,0.097); me.symbols.dmeR.setText("DME"); @@ -587,6 +612,13 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec else me.symbols.dmeRDist.setText(" ---"); me.symbols.dmeRDist.setColor(0.195,0.96,0.097); } elsif(me.get_switch("toggle_rh_vor_adf") == -1) { + + if (fmgc.FMGCInternal.ADF2.freqSet) { + me.symbols.vorRIdtuneMode.show(); + } else { + me.symbols.vorRIdtuneMode.hide(); + } + me.symbols.vorR.setText("ADF R"); me.symbols.vorR.setColor(0,0.6,0.85); me.symbols.dmeR.setText(""); @@ -598,6 +630,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec me.symbols.dmeRDist.setText(""); me.symbols.dmeRDist.setColor(0,0.6,0.85); } else { + me.symbols.vorRIdtuneMode.hide(); me.symbols.vorR.setText(""); me.symbols.dmeR.setText(""); me.symbols.vorRId.setText(""); diff --git a/Models/Instruments/ND/canvas/res/airbusND.svg b/Models/Instruments/ND/canvas/res/airbusND.svg index 363030ba..281ec49e 100644 --- a/Models/Instruments/ND/canvas/res/airbusND.svg +++ b/Models/Instruments/ND/canvas/res/airbusND.svg @@ -1,19 +1,19 @@ TERRTERRAHEAD -TERR -000 + id="tspan1248">AHEAD 000 + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#179ab7;fill-opacity:1;stroke:none" + x="952.74292" + y="826.34009" + id="TerrLabel" + inkscape:label="#text7243">TERR +000 +000 VOR 1 + x="41.859375" + y="919.5495">VOR1 ABC + x="126.51562" + y="956.56171">ABCMM VOR 2 + style="font-size:32px;line-height:1.25;fill:#0dc04b"> VOR2 ABC + style="font-size:32px;line-height:1.25;fill:#0dc04b"> ABC + sodipodi:nodetypes="cscc" + inkscape:connector-curvature="0" + id="altArc" + d="m 351.124,888.591 c 0,0 72.1,-39.455 161.041,-39.455 88.941,0 161.041,39.455 161.041,39.455 v 0" + style="fill:none;stroke:#00ff00;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0" + inkscape:label="#path3888-1" /> 999 + y="993.85461">999 .9 + id="tspan1329" + sodipodi:role="line" + style="font-size:24px;line-height:1.25;fill:#0dc04b">.9 999 + id="tspan3084" + sodipodi:role="line" + style="font-size:32px;line-height:1.25;text-align:end;text-anchor:end;fill:#0dc04b">999 .9 + y="993.85461">.9 GPS PRIMARY LOST + style="opacity:0.99;fill:none;stroke:#ffffff;stroke-width:3.15591;stroke-miterlimit:4;stroke-dasharray:none" + id="nd_warn_msgbox" + width="563.05048" + height="46.844471" + x="230.3676" + y="919.6969" />GPS PRIMARY LOST TA ONLY + style="opacity:0.99;fill:none;stroke:#ffffff;stroke-width:3.15591;stroke-miterlimit:4;stroke-dasharray:none" + id="taOnlyBox" + width="563.05048" + height="46.844471" + x="230.3676" + y="871.6969" />TA ONLY + inkscape:label="#text7243" + id="text3549-7" + y="-258.81296" + x="-364.83682" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:36px;line-height:125%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(0.34999975)" /> HDG + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:53.3333px;line-height:0%;font-family:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;fill:#ff0000;fill-opacity:1;stroke:none" + x="511.82605" + y="292.91833" + id="nd_warn_hdg" + inkscape:label="#text3239">HDG MAP NOT AVAIL + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:53.3333px;line-height:0%;font-family:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;fill:#ff0000;fill-opacity:1;stroke:none" + x="510.7153" + y="399.58936" + id="nd_warn_map" + inkscape:label="#text3239">MAP NOT AVAIL RANGE CHANGE - \ No newline at end of file + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:53.3333px;line-height:0%;font-family:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + x="510.7153" + y="537.58936" + id="nd_msg_change" + inkscape:label="#text3401">RANGE CHANGE + diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index 0d37513b..d7d7715e 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -798,7 +798,7 @@ canvas.NDStyles["Airbus"] = { if(nd.get_switch("toggle_display_mode") == "APP") nd.symbols.ilsLbl.setText("ILS"); else - nd.symbols.ilsLbl.setText("VOR 1"); + nd.symbols.ilsLbl.setText("VOR1"); }, is_false: func(nd) nd.symbols.ilsLbl.hide(), }, @@ -1660,13 +1660,13 @@ canvas.NDStyles["Airbus"] = { is_true: func(nd) { nd.symbols.dmeL.show(); if(nd.get_switch("toggle_lh_vor_adf") < 0){ - nd.symbols.vorL.setText("ADF 1"); + nd.symbols.vorL.setText("ADF1"); nd.symbols.vorL.setColor(0.195,0.96,0.097); nd.symbols.vorLId.setColor(0.195,0.96,0.097); #nd.symbols.dmeLDist.setColor(0.195,0.96,0.097); nd.symbols.dmeL.setText(""); } else { - nd.symbols.vorL.setText("VOR 1"); + nd.symbols.vorL.setText("VOR1"); nd.symbols.vorL.setColor(1,1,1); nd.symbols.vorLId.setColor(1,1,1); #nd.symbols.dmeLDist.setColor(1,1,1); @@ -1687,12 +1687,12 @@ canvas.NDStyles["Airbus"] = { is_true: func(nd) { nd.symbols.dmeR.show(); if(nd.get_switch("toggle_rh_vor_adf") < 0){ - nd.symbols.vorR.setText("ADF 2"); + nd.symbols.vorR.setText("ADF2"); nd.symbols.vorR.setColor(0.195,0.96,0.097); nd.symbols.vorRId.setColor(0.195,0.96,0.097); nd.symbols.dmeR.setText(""); } else { - nd.symbols.vorR.setText("VOR 2"); + nd.symbols.vorR.setText("VOR2"); nd.symbols.vorR.setColor(1,1,1); nd.symbols.vorRId.setColor(1,1,1); #nd.symbols.dmeRDist.setColor(1,1,1); @@ -1718,10 +1718,11 @@ canvas.NDStyles["Airbus"] = { var adf = "instrumentation/adf/"; var navident = getprop(adf~ "ident"); var frq = getprop(adf~ "frequencies/selected-khz"); - if(navident != "") + if(navident != "") { nd.symbols.vorLId.setText(navident); - else + } else { nd.symbols.vorLId.setText(sprintf("%3d", frq)); + } nd.symbols.dmeLDist.setText(""); } else { var nav = nd.get_nav_path("vor", 0); @@ -1730,10 +1731,11 @@ canvas.NDStyles["Airbus"] = { var dme = nd.get_nav_path("dme", 0); var dst = getprop(dme~ "indicated-distance-nm"); #print(dme~ "indicated-distance-nm"); - if(getprop(nav~ "in-range")) + if(getprop(nav~ "in-range")) { nd.symbols.vorLId.setText(navID); - else + } else { nd.symbols.vorLId.setText(frq); + } if(getprop(dme~ "in-range")) nd.symbols.dmeLDist.setText(sprintf("%3.1f", dst)); @@ -1775,10 +1777,11 @@ canvas.NDStyles["Airbus"] = { var adf = "instrumentation/adf[1]/"; var navident = getprop(adf~ "ident"); var frq = getprop(adf~ "frequencies/selected-khz"); - if(navident != "") + if(navident != "") { nd.symbols.vorRId.setText(navident); - else + } else { nd.symbols.vorRId.setText(sprintf("%3d", frq)); + } nd.symbols.dmeRDist.setText(""); } else { var nav = nd.get_nav_path("vor", 1); @@ -1787,10 +1790,11 @@ canvas.NDStyles["Airbus"] = { var dme = nd.get_nav_path("dme", 1); var dst = getprop(dme~ "indicated-distance-nm"); #print(dme~ "indicated-distance-nm"); - if(getprop(nav~ "in-range")) + if(getprop(nav~ "in-range")) { nd.symbols.vorRId.setText(navID); - else + } else { nd.symbols.vorRId.setText(frq); + } if(getprop(dme~ "in-range")) nd.symbols.dmeRDist.setText(sprintf("%3.1f", dst)); diff --git a/Nasal/MCDU/RADNAV.nas b/Nasal/MCDU/RADNAV.nas index d42722e5..2a5098e8 100644 --- a/Nasal/MCDU/RADNAV.nas +++ b/Nasal/MCDU/RADNAV.nas @@ -278,7 +278,7 @@ var radnavInput = func(key, i) { } } else if (key == "R1") { if (radNavScratchpad == "CLR") { - fmgc.FMGCInternal.VOR1.freqSet = 0; + fmgc.FMGCInternal.VOR2.freqSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { if (size(split("/", radNavScratchpad)) == 2) { From 4cc86d0ab03f3385dd008d2d9a8fb70b1a1c4093 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 27 Dec 2021 16:54:23 +0000 Subject: [PATCH 5/5] PRINTER NOT AVAIL --- Nasal/MCDU/DATA.nas | 4 ++-- Nasal/MCDU/MCDU.nas | 44 +------------------------------------------- 2 files changed, 3 insertions(+), 45 deletions(-) diff --git a/Nasal/MCDU/DATA.nas b/Nasal/MCDU/DATA.nas index 7afe6763..6ef87d1c 100644 --- a/Nasal/MCDU/DATA.nas +++ b/Nasal/MCDU/DATA.nas @@ -11,13 +11,13 @@ var dataInput = func(key, i) { setprop("MCDU[" ~ i ~ "]/page", "GPSMON"); } elsif (key == "L5") { if (canvas_mcdu.myClosestAirport[i] != nil) { - canvas_mcdu.myClosestAirport[i].del(); + canvas_mcdu.myClosestAirport[i].del(); } canvas_mcdu.myClosestAirport[i] = nil; canvas_mcdu.myClosestAirport[i] = closestAirportPage.new(i); setprop("MCDU[" ~ i ~ "]/page", "CLOSESTAIRPORT"); } elsif (key == "R5") { - setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC"); + mcdu_message(i, "PRINTER NOT AVAILABLE"); } } diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 8511ce8c..8931782a 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -256,10 +256,6 @@ var lskbutton = func(btn, i) { radnavInput("L1",i); } else if (page == "DATA") { dataInput("L1",i); - } else if (page == "PRINTFUNC") { - printInput("L1",i); - } else if (page == "PRINTFUNC2") { - printInput2("L1",i); } else if (page == "LATREV") { if (canvas_mcdu.myLatRev[i].type == 0) { if (canvas_mcdu.myDeparture[i] != nil) { @@ -410,10 +406,6 @@ var lskbutton = func(btn, i) { perfDESInput("L2",i); } else if (page == "DATA") { dataInput("L2",i); - } else if (page == "PRINTFUNC") { - printInput("L2",i); - } else if (page == "PRINTFUNC2") { - printInput2("L2",i); } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(2); } else if (page == "DEPARTURE") { @@ -537,10 +529,6 @@ var lskbutton = func(btn, i) { radnavInput("L3",i); } else if (page == "DATA") { dataInput("L3",i); - } else if (page == "PRINTFUNC") { - printInput("L3",i); - } else if (page == "PRINTFUNC2") { - printInput2("L3",i); } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(3); } else if (page == "DEPARTURE") { @@ -664,8 +652,6 @@ var lskbutton = func(btn, i) { perfAPPRInput("L4",i); } else if (page == "RADNAV") { radnavInput("L4",i); - } else if (page == "PRINTFUNC2") { - printInput2("L4",i); } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(4); } else if (page == "DEPARTURE") { @@ -784,10 +770,6 @@ var lskbutton = func(btn, i) { perfGAInput("L5",i); } else if (page == "RADNAV") { radnavInput("L5",i); - } else if (page == "PRINTFUNC") { - printInput("L5",i); - } else if (page == "PRINTFUNC2") { - printInput2("L5",i); } else if (page == "DATA") { dataInput("L5",i); } else if (page == "DATA2") { @@ -855,8 +837,6 @@ var lskbutton = func(btn, i) { perfAPPRInput("L6",i); } else if (page == "PERFGA") { perfGAInput("L6",i); - } else if (page == "PRINTFUNC2") { - printInput2("L6",i); } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(6); } else if (page == "LATREV" or page == "VERTREV" or page == "DUPLICATENAMES") { @@ -932,10 +912,6 @@ var rskbutton = func(btn, i) { canvas_mcdu.myDESWIND[i].pushButtonRight(1); } else if (page == "RADNAV") { radnavInput("R1",i); - } else if (page == "PRINTFUNC") { - printInput("R1",i); - } else if (page == "PRINTFUNC2") { - printInput2("R1",i); } else if (page == "LATREV") { if (canvas_mcdu.myLatRev[i].type == 1) { if (canvas_mcdu.myArrival[i] != nil) { @@ -1008,10 +984,6 @@ var rskbutton = func(btn, i) { perfAPPRInput("R2",i); } else if (page == "RADNAV") { radnavInput("R2",i); - } else if (page == "PRINTFUNC") { - printInput("R2",i); - } else if (page == "PRINTFUNC2") { - printInput2("R2",i); } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonRight(2); } else if (page == "ARRIVAL") { @@ -1053,10 +1025,6 @@ var rskbutton = func(btn, i) { perfTOInput("R3",i); } else if (page == "PERFAPPR") { perfAPPRInput("R3",i); - } else if (page == "PRINTFUNC") { - printInput("R3",i); - } else if (page == "PRINTFUNC2") { - printInput2("R3",i); } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonRight(3); } else if (page == "ARRIVAL") { @@ -1146,8 +1114,6 @@ var rskbutton = func(btn, i) { perfAPPRInput("R4",i); } else if (page == "RADNAV") { radnavInput("R4",i); - } else if (page == "PRINTFUNC2") { - printInput2("R4",i); } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonRight(4); } else if (page == "ARRIVAL") { @@ -1284,7 +1250,7 @@ var rskbutton = func(btn, i) { perfDESInput("R6",i); } else if (page == "PERFAPPR") { perfAPPRInput("R6",i); - } else if ((page == "DATA") or (page == "PRINTFUNC") or (page == "PRINTFUNC2")) { + } else if (page == "DATA") { mcdu_message(i, "AOC DISABLED"); } else if (page == "INITA") { initInputA("R6",i); @@ -1343,10 +1309,6 @@ var arrowbutton = func(btn, i) { } } else if (page == "INITB" or page == "FUELPRED") { pageNode[i].setValue("INITA"); - } else if (page == "PRINTFUNC") { - pageNode[i].setValue("PRINTFUNC2"); - } else if (page == "PRINTFUNC2") { - pageNode[i].setValue("PRINTFUNC"); } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].scrollLeft(); } else if (page == "ARRIVAL") { @@ -1375,10 +1337,6 @@ var arrowbutton = func(btn, i) { } } else if (page == "INITB" or page == "FUELPRED") { pageNode[i].setValue("INITA"); - } else if (page == "PRINTFUNC") { - pageNode[i].setValue("PRINTFUNC2"); - } else if (page == "PRINTFUNC2") { - pageNode[i].setValue("PRINTFUNC"); } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].scrollRight(); } else if (page == "ARRIVAL") {