diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index de81f74..de42cfd 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -727,6 +727,31 @@ var canvas_MCDU_base = { me["Simple_R3S"].setText("CHAN/ MLS"); me["Simple_R4S"].setText("SLOPE CRS"); me["Simple_R5S"].setText("FREQ/ADF2"); + + if (getprop("systems/radio/rmp[0]/nav") or getprop("systems/radio/rmp[1]/nav")) { + me["Simple_L1"].hide(); + me["Simple_L2"].hide(); + me["Simple_L3"].hide(); + me["Simple_L4"].hide(); + me["Simple_L5"].hide(); + me["Simple_R1"].hide(); + me["Simple_R2"].hide(); + me["Simple_R3"].hide(); + me["Simple_R4"].hide(); + me["Simple_R5"].hide(); + } else { + me["Simple_L1"].show(); + me["Simple_L2"].show(); + me["Simple_L3"].show(); + me["Simple_L4"].show(); + me["Simple_L5"].show(); + me["Simple_R1"].show(); + me["Simple_R2"].show(); + me["Simple_R3"].show(); + me["Simple_R4"].show(); + me["Simple_R5"].show(); + } + } else if (page == "INITA") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index 62bc723..9357c8b 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -1529,7 +1529,7 @@ canvas.NDStyles["Airbus"] = { nd.symbols.vorLId.setText(navID); else nd.symbols.vorLId.setText(frq); - if(getprop(dme~ "in-range")) + if(getprop(dme~ "in-range") and !getprop("systems/radio/rmp[0]/nav") and !getprop("systems/radio/rmp[1]/nav")) nd.symbols.dmeLDist.setText(sprintf("%3.1f", dst)); else nd.symbols.dmeLDist.setText(" ---"); @@ -1584,7 +1584,7 @@ canvas.NDStyles["Airbus"] = { nd.symbols.vorRId.setText(navID); else nd.symbols.vorRId.setText(frq); - if(getprop(dme~ "in-range")) + if(getprop(dme~ "in-range") and !getprop("systems/radio/rmp[0]/nav") and !getprop("systems/radio/rmp[1]/nav")) nd.symbols.dmeRDist.setText(sprintf("%3.1f", dst)); else nd.symbols.dmeRDist.setText(" ---"); diff --git a/Models/Instruments/Radio/Radio1.xml b/Models/Instruments/Radio/Radio1.xml index 57e18a2..2691426 100644 --- a/Models/Instruments/Radio/Radio1.xml +++ b/Models/Instruments/Radio/Radio1.xml @@ -240,7 +240,6 @@ - @@ -1826,4 +2228,5 @@ radio_on - \ No newline at end of file + + diff --git a/Models/Instruments/Radio/Radio2.xml b/Models/Instruments/Radio/Radio2.xml index 9ad8181..0b5b811 100644 --- a/Models/Instruments/Radio/Radio2.xml +++ b/Models/Instruments/Radio/Radio2.xml @@ -240,7 +240,6 @@ - @@ -1827,3 +2229,4 @@ + diff --git a/Models/Instruments/Radio/res/Radio.ac b/Models/Instruments/Radio/res/Radio.ac index b987caa..1a1fd2c 100644 --- a/Models/Instruments/Radio/res/Radio.ac +++ b/Models/Instruments/Radio/res/Radio.ac @@ -14746,9 +14746,9 @@ SURF 0X0 mat 1 refs 4 5 0.993212 0.944859 -4 0.931324 0.944859 -10 0.931324 0.943492 11 0.993212 0.943492 +10 0.931324 0.943492 +4 0.931324 0.944859 SURF 0X0 mat 1 refs 4 @@ -14760,9 +14760,9 @@ SURF 0X0 mat 1 refs 4 1 0.965523 0.925681 -0 0.997855 0.925681 -4 0.997855 0.935702 5 0.965523 0.935702 +4 0.997855 0.935702 +0 0.997855 0.925681 SURF 0X0 mat 1 refs 4 @@ -14792,9 +14792,9 @@ SURF 0X0 mat 1 refs 4 0 0.931324 0.94175 -1 0.993212 0.94175 -3 0.993212 0.942381 2 0.931324 0.942381 +3 0.993212 0.942381 +1 0.993212 0.94175 kids 0 OBJECT poly name "radio_nav_lit.axis" diff --git a/Models/Instruments/Radio/res/Radio.png b/Models/Instruments/Radio/res/Radio.png index a51531d..b94a1a2 100644 Binary files a/Models/Instruments/Radio/res/Radio.png and b/Models/Instruments/Radio/res/Radio.png differ diff --git a/Nasal/MCDU/RADNAV.nas b/Nasal/MCDU/RADNAV.nas index 9d96dab..668b067 100644 --- a/Nasal/MCDU/RADNAV.nas +++ b/Nasal/MCDU/RADNAV.nas @@ -3,187 +3,191 @@ # Copyright (c) 2020 Josh Davidson (Octal450) var radnavInput = func(key, i) { - var scratchpad = getprop("/MCDU[" ~ i ~ "]/scratchpad"); - if (key == "L1") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/vor1freq-set", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); - } else { - var tfs = size(scratchpad); - if (tfs == 3 or tfs == 5 or tfs == 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) { - notAllowed(i); - } else { + if (!getprop("systems/radio/rmp[0]/nav") and !getprop("systems/radio/rmp[1]/nav")) { + var scratchpad = getprop("/MCDU[" ~ i ~ "]/scratchpad"); + if (key == "L1") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/vor1freq-set", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 3 or tfs == 5 or tfs == 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) { + notAllowed(i); + } else { + setprop("/instrumentation/nav[2]/frequencies/selected-mhz", scratchpad); + setprop("/FMGC/internal/vor1freq-set", 1); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } + } else if (scratchpad >= 112.00 and scratchpad <= 117.95) { setprop("/instrumentation/nav[2]/frequencies/selected-mhz", scratchpad); setprop("/FMGC/internal/vor1freq-set", 1); setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); } - } else if (scratchpad >= 112.00 and scratchpad <= 117.95) { - setprop("/instrumentation/nav[2]/frequencies/selected-mhz", scratchpad); - setprop("/FMGC/internal/vor1freq-set", 1); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); } else { notAllowed(i); } - } else { - notAllowed(i); } - } - } else if (key == "L2") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/vor1crs-set", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); - } else { - var tfs = size(scratchpad); - if (tfs >= 1 and tfs <= 3) { - if (scratchpad >= 0 and scratchpad <= 360) { - setprop("/instrumentation/nav[2]/radials/selected-deg", scratchpad); - setprop("/FMGC/internal/vor1crs-set", 1); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (key == "L2") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/vor1crs-set", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs >= 1 and tfs <= 3) { + if (scratchpad >= 0 and scratchpad <= 360) { + setprop("/instrumentation/nav[2]/radials/selected-deg", scratchpad); + setprop("/FMGC/internal/vor1crs-set", 1); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } } else { notAllowed(i); } - } else { - notAllowed(i); } - } - } else if (key == "L3") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/ils1freq-set", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); - } else { - var tfs = size(scratchpad); - if (tfs == 3 or tfs == 5 or tfs == 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) { - setprop("/instrumentation/nav[0]/frequencies/selected-mhz", scratchpad); - setprop("/FMGC/internal/ils1freq-set", 1); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (key == "L3") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/ils1freq-set", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 3 or tfs == 5 or tfs == 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) { + setprop("/instrumentation/nav[0]/frequencies/selected-mhz", scratchpad); + setprop("/FMGC/internal/ils1freq-set", 1); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } } else { notAllowed(i); } } else { notAllowed(i); } - } else { - notAllowed(i); } - } - } else if (key == "L4") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/ils1crs-set", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); - } else { - var tfs = size(scratchpad); - if (tfs >= 1 and tfs <= 3) { - if (scratchpad >= 0 and scratchpad <= 360) { - setprop("/instrumentation/nav[0]/radials/selected-deg", scratchpad); - setprop("/FMGC/internal/ils1crs-set", 1); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (key == "L4") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/ils1crs-set", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs >= 1 and tfs <= 3) { + if (scratchpad >= 0 and scratchpad <= 360) { + setprop("/instrumentation/nav[0]/radials/selected-deg", scratchpad); + setprop("/FMGC/internal/ils1crs-set", 1); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } } else { notAllowed(i); } - } else { - notAllowed(i); } - } - } else if (key == "L5") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/adf1freq-set", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); - } else { - var tfs = size(scratchpad); - if (tfs == 3 or tfs == 4) { - if (scratchpad >= 190 and scratchpad <= 1750) { - setprop("/instrumentation/adf[0]/frequencies/selected-khz", scratchpad); - setprop("/FMGC/internal/adf1freq-set", 1); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (key == "L5") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/adf1freq-set", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 3 or tfs == 4) { + if (scratchpad >= 190 and scratchpad <= 1750) { + setprop("/instrumentation/adf[0]/frequencies/selected-khz", scratchpad); + setprop("/FMGC/internal/adf1freq-set", 1); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } } else { notAllowed(i); } - } else { - notAllowed(i); } - } - } else if (key == "R1") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/vor2freq-set", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); - } else { - var tfs = size(scratchpad); - if (tfs == 3 or tfs == 5 or tfs == 6) { - if (scratchpad >= 108.10 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) { - notAllowed(i); - } else { + } else if (key == "R1") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/vor2freq-set", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 3 or tfs == 5 or tfs == 6) { + if (scratchpad >= 108.10 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) { + notAllowed(i); + } else { + setprop("/instrumentation/nav[3]/frequencies/selected-mhz", scratchpad); + setprop("/FMGC/internal/vor2freq-set", 1); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } + } else if (scratchpad >= 112.00 and scratchpad <= 117.95) { setprop("/instrumentation/nav[3]/frequencies/selected-mhz", scratchpad); setprop("/FMGC/internal/vor2freq-set", 1); setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); } - } else if (scratchpad >= 112.00 and scratchpad <= 117.95) { - setprop("/instrumentation/nav[3]/frequencies/selected-mhz", scratchpad); - setprop("/FMGC/internal/vor2freq-set", 1); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); } else { notAllowed(i); } - } else { - notAllowed(i); } - } - } else if (key == "R2") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/vor2crs-set", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); - } else { - var tfs = size(scratchpad); - if (tfs >= 1 and tfs <= 3) { - if (scratchpad >= 0 and scratchpad <= 360) { - setprop("/instrumentation/nav[3]/radials/selected-deg", scratchpad); - setprop("/FMGC/internal/vor2crs-set", 1); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (key == "R2") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/vor2crs-set", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs >= 1 and tfs <= 3) { + if (scratchpad >= 0 and scratchpad <= 360) { + setprop("/instrumentation/nav[3]/radials/selected-deg", scratchpad); + setprop("/FMGC/internal/vor2crs-set", 1); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } } else { notAllowed(i); } - } else { - notAllowed(i); } - } - } else if (key == "R5") { - if (scratchpad == "CLR") { - setprop("/FMGC/internal/adf2freq-set", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); - } else { - var tfs = size(scratchpad); - if (tfs == 3 or tfs == 4) { - if (scratchpad >= 190 and scratchpad <= 1750) { - setprop("/instrumentation/adf[1]/frequencies/selected-khz", scratchpad); - setprop("/FMGC/internal/adf2freq-set", 1); - setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (key == "R5") { + if (scratchpad == "CLR") { + setprop("/FMGC/internal/adf2freq-set", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + var tfs = size(scratchpad); + if (tfs == 3 or tfs == 4) { + if (scratchpad >= 190 and scratchpad <= 1750) { + setprop("/instrumentation/adf[1]/frequencies/selected-khz", scratchpad); + setprop("/FMGC/internal/adf2freq-set", 1); + setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } } else { notAllowed(i); } - } else { - notAllowed(i); } } + } else { + notAllowed(i); } } diff --git a/Nasal/rmp.nas b/Nasal/rmp.nas index d76aa4b..0daf424 100644 --- a/Nasal/rmp.nas +++ b/Nasal/rmp.nas @@ -5,7 +5,7 @@ # Copyright (c) merspieler # ############################ -# GLOBAL TODO add stuff for HF1, HF2, VOR, LS and ADF +# GLOBAL TODO add stuff for HF1, HF2 var chan_rmp1_v = "vhr1"; var chan_rmp2_v = "vhr2"; @@ -15,6 +15,20 @@ var act_vhf1 = props.globals.getNode("instrumentation/comm[0]/frequencies/select var act_vhf2 = props.globals.getNode("instrumentation/comm[1]/frequencies/selected-mhz"); var act_vhf3 = props.globals.getNode("instrumentation/comm[2]/frequencies/selected-mhz"); +var act_ls1 = props.globals.getNode("instrumentation/nav[0]/frequencies/selected-mhz"); +var act_vor1 = props.globals.getNode("instrumentation/nav[2]/frequencies/selected-mhz"); +var act_vor2 = props.globals.getNode("instrumentation/nav[3]/frequencies/selected-mhz"); +var act_adf1 = props.globals.getNode("instrumentation/adf[0]/frequencies/selected-khz"); +var act_adf2 = props.globals.getNode("instrumentation/adf[1]/frequencies/selected-khz"); +var stby_ls1 = props.globals.getNode("instrumentation/nav[0]/frequencies/standby-mhz"); +var stby_vor1 = props.globals.getNode("instrumentation/nav[2]/frequencies/standby-mhz"); +var stby_vor2 = props.globals.getNode("instrumentation/nav[3]/frequencies/standby-mhz"); +var stby_adf1 = props.globals.getNode("instrumentation/adf[0]/frequencies/standby-khz"); +var stby_adf2 = props.globals.getNode("instrumentation/adf[1]/frequencies/standby-khz"); +var act_ls1_crs = props.globals.getNode("instrumentation/nav[0]/radials/selected-deg"); +var act_vor1_crs = props.globals.getNode("instrumentation/nav[2]/radials/selected-deg"); +var act_vor2_crs = props.globals.getNode("instrumentation/nav[3]/radials/selected-deg"); + var act_display_rmp1 = props.globals.initNode("/controls/radio/rmp[0]/active-display", "118.700", "STRING"); var stby_display_rmp1 = props.globals.initNode("/controls/radio/rmp[0]/standby-display", "121.400", "STRING"); var stby_rmp1_vhf1 = props.globals.initNode("/systems/radio/rmp[0]/vhf1-standby", 121.4, "DOUBLE"); @@ -49,6 +63,9 @@ var am_mode_rmp1 = props.globals.initNode("/systems/radio/rmp[0]/am-active", 0, var am_mode_rmp2 = props.globals.initNode("/systems/radio/rmp[1]/am-active", 0, "BOOL"); var am_mode_rmp3 = props.globals.initNode("/systems/radio/rmp[2]/am-active", 0, "BOOL"); +var sel_crs_rmp1 = props.globals.initNode("/systems/radio/rmp[0]/select-crs", 1, "BOOL"); +var sel_crs_rmp2 = props.globals.initNode("/systems/radio/rmp[1]/select-crs", 1, "BOOL"); + var init = func() { for(var i = 0; i < 3; i += 1) { setprop("systems/radio/rmp[" ~ i ~ "]/hf1-standby", 510); @@ -165,15 +182,60 @@ var update_active_vhf = func(vhf) { } } } -}; +} + +var update_displays_nav = func(nav) { + var chan1 = chan_rmp1.getValue(); + var chan2 = chan_rmp2.getValue(); + + if (nav == 1) { + if (chan1 == "ls") { + act_display_rmp1.setValue(sprintf("%3.2f", act_ls1.getValue())); + if (sel_crs_rmp1.getBoolValue()) { + stby_display_rmp1.setValue("C-" ~ sprintf("%3.0f", act_ls1_crs.getValue())); + } else { + stby_display_rmp1.setValue(sprintf("%3.2f", stby_ls1.getValue())); + } + } + if (chan2 == "ls") { + act_display_rmp2.setValue(sprintf("%3.2f", act_ls1.getValue())); + if (sel_crs_rmp2.getBoolValue()) { + stby_display_rmp2.setValue("C-" ~ sprintf("%3.0f", act_ls1_crs.getValue())); + } else { + stby_display_rmp2.setValue(sprintf("%3.2f", stby_ls1.getValue())); + } + } + } else if (nav == 3 and chan1 == "vor") { + act_display_rmp1.setValue(sprintf("%3.2f", act_vor1.getValue())); + if (sel_crs_rmp1.getBoolValue()) { + stby_display_rmp1.setValue("C-" ~ sprintf("%3.0f", act_vor1_crs.getValue())); + } else { + stby_display_rmp1.setValue(sprintf("%3.2f", stby_vor1.getValue())); + } + + } else if (nav == 4 and chan2 == "vor") { + act_display_rmp2.setValue(sprintf("%3.2f", act_vor2.getValue())); + if (sel_crs_rmp2.getBoolValue()) { + stby_display_rmp2.setValue("C-" ~ sprintf("%3.0f", act_vor2_crs.getValue())); + } else { + stby_display_rmp2.setValue(sprintf("%3.2f", stby_vor2.getValue())); + } + } else if (nav == 5 and chan1 == "adf") { + act_display_rmp1.setValue(sprintf("%4.0f", act_adf1.getValue())); + stby_display_rmp1.setValue(sprintf("%4.0f", stby_adf1.getValue())); + } else if (nav == 6 and chan2 == "adf") { + act_display_rmp2.setValue(sprintf("%4.0f", act_adf2.getValue())); + stby_display_rmp2.setValue(sprintf("%4.0f", stby_adf2.getValue())); + } +} -var update_stby_vhf = func(rmp_no, vhf) { +var update_stby_freq = func(rmp_no, freq) { if (rmp_no == 0) { - if (vhf == 1) { + if (freq == 1) { var stby = sprintf("%3.3f", stby_rmp1_vhf1.getValue()); - } else if (vhf == 2) { + } else if (freq == 2) { var stby = sprintf("%3.3f", stby_rmp1_vhf2.getValue()); - } else if (vhf == 3) { + } else if (freq == 3) { var stby = sprintf("%3.3f", stby_rmp1_vhf3.getValue()); } @@ -183,11 +245,11 @@ var update_stby_vhf = func(rmp_no, vhf) { stby_display_rmp1.setValue(stby); } } else if (rmp_no == 1) { - if (vhf == 1) { + if (freq == 1) { var stby = sprintf("%3.3f", stby_rmp2_vhf1.getValue()); - } else if (vhf == 2) { + } else if (freq == 2) { var stby = sprintf("%3.3f", stby_rmp2_vhf2.getValue()); - } else if (vhf == 3) { + } else if (freq == 3) { var stby = sprintf("%3.3f", stby_rmp2_vhf3.getValue()); } @@ -197,11 +259,11 @@ var update_stby_vhf = func(rmp_no, vhf) { stby_display_rmp2.setValue(stby); } } else { - if (vhf == 1) { + if (freq == 1) { var stby = sprintf("%3.3f", stby_rmp3_vhf1.getValue()); - } else if (vhf == 2) { + } else if (freq == 2) { var stby = sprintf("%3.3f", stby_rmp3_vhf2.getValue()); - } else if (vhf == 3) { + } else if (freq == 3) { var stby = sprintf("%3.3f", stby_rmp3_vhf3.getValue()); } @@ -217,85 +279,136 @@ var update_chan_sel = func(rmp_no) { update_active_vhf(1); update_active_vhf(2); update_active_vhf(3); + update_active_vhf(4); + update_active_vhf(5); + + update_displays_nav(1); + update_displays_nav(rmp_no + 3); + update_displays_nav(rmp_no + 5); if (rmp_no == 0) { var chan = chan_rmp1.getValue(); if (chan == "vhf1") { - update_stby_vhf(rmp_no, 1); + update_stby_freq(rmp_no, 1); } else if (chan == "vhf2") { - update_stby_vhf(rmp_no, 2); - } else { - update_stby_vhf(rmp_no, 3); + update_stby_freq(rmp_no, 2); + } else if (chan == "vhf3") { + update_stby_freq(rmp_no, 3); } } else if (rmp_no == 1) { var chan = chan_rmp2.getValue(); if (chan == "vhf1") { - update_stby_vhf(rmp_no, 1); + update_stby_freq(rmp_no, 1); } else if (chan == "vhf2") { - update_stby_vhf(rmp_no, 2); - } else { - update_stby_vhf(rmp_no, 3); + update_stby_freq(rmp_no, 2); + } else if (chan == "vhf3") { + update_stby_freq(rmp_no, 3); } } else { var chan = chan_rmp3.getValue(); if (chan == "vhf1") { - update_stby_vhf(rmp_no, 1); + update_stby_freq(rmp_no, 1); } else if (chan == "vhf2") { - update_stby_vhf(rmp_no, 2); - } else { - update_stby_vhf(rmp_no, 3); + update_stby_freq(rmp_no, 2); + } else if (chan == "vhf3") { + update_stby_freq(rmp_no, 3); } } } var transfer = func(rmp_no) { rmp_no = rmp_no - 1; - var sel_chan = getprop("systems/radio/rmp[" ~ rmp_no ~ "]/sel_chan"); + var sel_chan = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/sel_chan"); + var sel_crs = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs"); if (string.match(sel_chan, "vhf[1-3]")) { var mod1 = int(string.replace(sel_chan, "vhf", "")); var mod = mod1 - 1; var mem = getprop("instrumentation/comm[" ~ mod ~ "]/frequencies/selected-mhz"); - setprop("instrumentation/comm[" ~ mod ~ "]/frequencies/selected-mhz", getprop("systems/radio/rmp[" ~ rmp_no ~ "]/vhf" ~ mod1 ~ "-standby")); - setprop("systems/radio/rmp[" ~ rmp_no ~ "]/vhf" ~ mod1 ~ "-standby", mem); + setprop("instrumentation/comm[" ~ mod ~ "]/frequencies/selected-mhz", getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/vhf" ~ mod1 ~ "-standby")); + setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/vhf" ~ mod1 ~ "-standby", mem); + } elsif (sel_chan == "adf") { + var mem = getprop("instrumentation/adf[" ~ rmp_no ~ "]/frequencies/selected-khz"); + setprop("instrumentation/adf[" ~ rmp_no ~ "]/frequencies/selected-khz", getprop("instrumentation/adf[" ~ rmp_no ~ "]/frequencies/standby-khz")); + setprop("instrumentation/adf[" ~ rmp_no ~ "]/frequencies/standby-khz", mem); + update_displays_nav(rmp_no + 5); + } elsif (sel_chan == "vor") { + if (sel_crs) { + setprop("instrumentation/nav[" ~ (rmp_no + 2) ~ "]/frequencies/standby-mhz", getprop("instrumentation/nav[" ~ (rmp_no + 2) ~ "]/frequencies/selected-mhz")); + setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs", 0); + update_displays_nav(rmp_no + 3); + } else { + setprop("instrumentation/nav[" ~ (rmp_no + 2) ~ "]/frequencies/selected-mhz", getprop("instrumentation/nav[" ~ (rmp_no + 2) ~ "]/frequencies/standby-mhz")); + setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs", 1); + update_displays_nav(rmp_no + 3); + } + } elsif (sel_chan == "ls") { + if (sel_crs) { + setprop("instrumentation/nav[0]/frequencies/standby-mhz", getprop("instrumentation/nav[0]/frequencies/selected-mhz")); + setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs", 0); + update_displays_nav(1); + } else { + setprop("instrumentation/nav[0]/frequencies/selected-mhz", getprop("instrumentation/nav[0]/frequencies/standby-mhz")); + setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs", 1); + update_displays_nav(1); + } + } +} + +var change_nav_mode = func(rmp_nr, nav_mode) { + if (!nav_mode.getBoolValue()) { + if (rmp_nr == 1 and (chan_rmp1.getValue() == "vor" or chan_rmp1.getValue() == "ls" or chan_rmp1.getValue() == "adf")) { + chan_rmp1.setValue("vhf1"); + } + if (rmp_nr == 2 and (chan_rmp2.getValue() == "vor" or chan_rmp2.getValue() == "ls" or chan_rmp2.getValue() == "adf")) { + chan_rmp2.setValue("vhf2"); + } + setprop("/FMGC/internal/ils1freq-set", 1); + setprop("/FMGC/internal/ils1crs-set", 1); + setprop("/FMGC/internal/vor1freq-set", 1); + setprop("/FMGC/internal/vor1crs-set", 1); + setprop("/FMGC/internal/vor2freq-set", 1); + setprop("/FMGC/internal/vor2crs-set", 1); + setprop("/FMGC/internal/adf1freq-set", 1); + setprop("/FMGC/internal/adf2freq-set", 1); } } setlistener("/systems/radio/rmp[0]/vhf1-standby", func { - update_stby_vhf(0, 1); + update_stby_freq(0, 1); }); setlistener("/systems/radio/rmp[0]/vhf2-standby", func { - update_stby_vhf(0, 2); + update_stby_freq(0, 2); }); setlistener("/systems/radio/rmp[0]/vhf3-standby", func { - update_stby_vhf(0, 3); + update_stby_freq(0, 3); }); setlistener("/systems/radio/rmp[1]/vhf1-standby", func { - update_stby_vhf(1, 1); + update_stby_freq(1, 1); }); setlistener("/systems/radio/rmp[1]/vhf2-standby", func { - update_stby_vhf(1, 2); + update_stby_freq(1, 2); }); setlistener("/systems/radio/rmp[1]/vhf3-standby", func { - update_stby_vhf(1, 3); + update_stby_freq(1, 3); }); setlistener("/systems/radio/rmp[2]/vhf1-standby", func { - update_stby_vhf(2, 1); + update_stby_freq(2, 1); }); setlistener("/systems/radio/rmp[2]/vhf2-standby", func { - update_stby_vhf(2, 2); + update_stby_freq(2, 2); }); setlistener("/systems/radio/rmp[2]/vhf3-standby", func { - update_stby_vhf(2, 3); + update_stby_freq(2, 3); }); setlistener("/instrumentation/comm[0]/frequencies/selected-mhz", func { @@ -321,3 +434,64 @@ setlistener("/systems/radio/rmp[1]/sel_chan", func { setlistener("/systems/radio/rmp[2]/sel_chan", func { update_chan_sel(2); }); + +setlistener("/instrumentation/nav[0]/frequencies/selected-mhz", func { + update_displays_nav(1); +}); + +setlistener("/instrumentation/nav[0]/frequencies/standby-mhz", func { + update_displays_nav(1); +}); + +setlistener("/instrumentation/nav[2]/frequencies/selected-mhz", func { + update_displays_nav(3); +}); + +setlistener("/instrumentation/nav[2]/frequencies/standby-mhz", func { + update_displays_nav(3); +}); + +setlistener("/instrumentation/nav[3]/frequencies/selected-mhz", func { + update_displays_nav(4); +}); + +setlistener("/instrumentation/nav[3]/frequencies/standby-mhz", func { + update_displays_nav(4); +}); + +setlistener("/instrumentation/adf[0]/frequencies/selected-khz", func { + update_displays_nav(5); +}); + +setlistener("/instrumentation/adf[0]/frequencies/standby-khz", func { + update_displays_nav(5); +}); + +setlistener("/instrumentation/adf[1]/frequencies/selected-khz", func { + update_displays_nav(6); +}); + +setlistener("/instrumentation/adf[1]/frequencies/standby-khz", func { + update_displays_nav(6); +}); + +setlistener("/instrumentation/nav[0]/radials/selected-deg", func { + update_displays_nav(1); +}); + +setlistener("/instrumentation/nav[2]/radials/selected-deg", func { + update_displays_nav(3); +}); + +setlistener("/instrumentation/nav[3]/radials/selected-deg", func { + update_displays_nav(4); +}); + +setlistener("/systems/radio/rmp[0]/nav", func(nav_mode) { + change_nav_mode(1, nav_mode); +}); + +setlistener("/systems/radio/rmp[1]/nav", func(nav_mode) { + change_nav_mode(2, nav_mode); +}); +