A3XX: Make ADF Radios working MCDU, fix MCDU bug

This commit is contained in:
Joshua Davidson 2017-07-06 11:37:43 -04:00
parent e0e41ee7fa
commit 6f30803842
7 changed files with 393 additions and 83 deletions

View file

@ -714,6 +714,45 @@
<height type="int">64</height>
</font-resolution>
</text>
<text>
<name>adf1freq3</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.042</y-m>
<z-m>0.0285</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">%s</format>
<truncate type="bool">false</truncate>
<font type="string">BoeingCDU-Large.ttf</font>
<property>/FMGC/internal/adf1-mcdu</property>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.0050</character-size>
<font-resolution>
<width type="int">64</width>
<height type="int">64</height>
</font-resolution>
</text>
<animation>
<type>select</type>
<object-name>adf1freq2</object-name>
<condition>
<not><property>/FMGC/internal/adf1freq-set</property></not>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>adf1freq3</object-name>
<condition>
<property>/FMGC/internal/adf1freq-set</property>
</condition>
</animation>
<text>
<name>adf2freq</name>
@ -761,6 +800,45 @@
<height type="int">64</height>
</font-resolution>
</text>
<text>
<name>adf2freq3</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>0.041</y-m>
<z-m>0.0285</z-m>
</offsets>
<alignment>right-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">%s</format>
<truncate type="bool">false</truncate>
<font type="string">BoeingCDU-Large.ttf</font>
<property>/FMGC/internal/adf2-mcdu</property>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.0050</character-size>
<font-resolution>
<width type="int">64</width>
<height type="int">64</height>
</font-resolution>
</text>
<animation>
<type>select</type>
<object-name>adf2freq2</object-name>
<condition>
<not><property>/FMGC/internal/adf2freq-set</property></not>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>adf2freq3</object-name>
<condition>
<property>/FMGC/internal/adf2freq-set</property>
</condition>
</animation>
<!-- Colors -->
<!-- White -->
@ -818,7 +896,9 @@
<object-name>ilscrs13</object-name>
<object-name>mlscrs2</object-name>
<object-name>adf1freq2</object-name>
<object-name>adf1freq3</object-name>
<object-name>adf2freq2</object-name>
<object-name>adf2freq3</object-name>
<diffuse>
<red>0</red>
<green>0.5</green>

View file

@ -714,6 +714,45 @@
<height type="int">64</height>
</font-resolution>
</text>
<text>
<name>adf1freq3</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>-0.042</y-m>
<z-m>0.0285</z-m>
</offsets>
<alignment>left-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">%s</format>
<truncate type="bool">false</truncate>
<font type="string">BoeingCDU-Large.ttf</font>
<property>/FMGC/internal/adf1-mcdu</property>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.0050</character-size>
<font-resolution>
<width type="int">64</width>
<height type="int">64</height>
</font-resolution>
</text>
<animation>
<type>select</type>
<object-name>adf1freq2</object-name>
<condition>
<not><property>/FMGC/internal/adf1freq-set</property></not>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>adf1freq3</object-name>
<condition>
<property>/FMGC/internal/adf1freq-set</property>
</condition>
</animation>
<text>
<name>adf2freq</name>
@ -761,6 +800,45 @@
<height type="int">64</height>
</font-resolution>
</text>
<text>
<name>adf2freq3</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>0.041</y-m>
<z-m>0.0285</z-m>
</offsets>
<alignment>right-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">%s</format>
<truncate type="bool">false</truncate>
<font type="string">BoeingCDU-Large.ttf</font>
<property>/FMGC/internal/adf2-mcdu</property>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.0050</character-size>
<font-resolution>
<width type="int">64</width>
<height type="int">64</height>
</font-resolution>
</text>
<animation>
<type>select</type>
<object-name>adf2freq2</object-name>
<condition>
<not><property>/FMGC/internal/adf2freq-set</property></not>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>adf2freq3</object-name>
<condition>
<property>/FMGC/internal/adf2freq-set</property>
</condition>
</animation>
<!-- Colors -->
<!-- White -->
@ -818,7 +896,9 @@
<object-name>ilscrs13</object-name>
<object-name>mlscrs2</object-name>
<object-name>adf1freq2</object-name>
<object-name>adf1freq3</object-name>
<object-name>adf2freq2</object-name>
<object-name>adf2freq3</object-name>
<diffuse>
<red>0</red>
<green>0.5</green>

View file

@ -233,6 +233,8 @@ var various2 = maketimer(0.5, func {
nav1();
nav2();
nav3();
adf0();
adf1();
var latmode = getprop("/it-autoflight/output/lat");
if (latmode == 0) {
setprop("/it-autoflight/custom/show-hdg", 1);
@ -258,7 +260,7 @@ var nav1 = func {
var namenav1 = getprop("/instrumentation/nav[1]/nav-id");
if (freqnav1 >= 108.10 and freqnav1 <= 111.95) {
if (namenav1 != "") {
setprop("/FMGC/internal/ils2-mcdu", namenav1 ~ "/" ~ freqnav1);
setprop("/FMGC/internal/ils2-mcdu", freqnav1 ~ "/" ~ namenav1);
} else {
setprop("/FMGC/internal/ils2-mcdu", freqnav1);
}
@ -284,13 +286,39 @@ var nav3 = func {
var namenav3 = getprop("/instrumentation/nav[3]/nav-id");
if (freqnav3 >= 108.00 and freqnav3 <= 117.95) {
if (namenav3 != "") {
setprop("/FMGC/internal/vor2-mcdu", namenav3 ~ "/" ~ freqnav3);
setprop("/FMGC/internal/vor2-mcdu", freqnav3 ~ "/" ~ namenav3);
} else {
setprop("/FMGC/internal/vor2-mcdu", freqnav3);
}
}
}
var adf0 = func {
var freqadf0uf = getprop("/instrumentation/adf[0]/frequencies/selected-khz");
var freqadf0 = sprintf("%.2f", freqadf0uf);
var nameadf0 = getprop("/instrumentation/adf[0]/ident");
if (freqadf0 >= 190 and freqadf0 <= 1750) {
if (nameadf0 != "") {
setprop("/FMGC/internal/adf1-mcdu", nameadf0 ~ "/" ~ freqadf0);
} else {
setprop("/FMGC/internal/adf1-mcdu", freqadf0);
}
}
}
var adf1 = func {
var freqadf1uf = getprop("/instrumentation/adf[1]/frequencies/selected-khz");
var freqadf1 = sprintf("%.2f", freqadf1uf);
var nameadf1 = getprop("/instrumentation/adf[1]/ident");
if (freqadf1 >= 190 and freqadf1 <= 1750) {
if (nameadf1 != "") {
setprop("/FMGC/internal/adf2-mcdu", freqadf1 ~ "/" ~ nameadf1);
} else {
setprop("/FMGC/internal/adf2-mcdu", freqadf1);
}
}
}
#################
# Managed Speed #
#################

View file

@ -48,12 +48,15 @@ var MCDU_reset = func {
setprop("/FMGC/internal/vor1crs-set", 0);
setprop("/FMGC/internal/vor2freq-set", 0);
setprop("/FMGC/internal/vor2crs-set", 0);
setprop("/FMGC/internal/adf1freq-set", 0);
setprop("/FMGC/internal/adf2freq-set", 0);
}
var lskbutton = func(btn) {
if (btn == "1") {
if (getprop("/MCDU[0]/page") == "MCDU") {
setprop("/MCDU[0]/page", getprop("/MCDU[0]/last-fmgc-page"));
setprop("/MCDU[0]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", "");
} else if (getprop("/MCDU[0]/page") == "TO") {
perfTOInput("L1");
@ -125,6 +128,8 @@ var lskbutton = func(btn) {
perfCRZInput("L5");
} else if (getprop("/MCDU[0]/page") == "DES") {
perfDESInput("L5");
} else if (getprop("/MCDU[0]/page") == "RADNAV") {
radnavInput("L5");
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
@ -207,6 +212,8 @@ var rskbutton = func(btn) {
} else if (btn == "5") {
if (getprop("/MCDU[0]/page") == "TO") {
perfTOInput("R5");
} else if (getprop("/MCDU[0]/page") == "RADNAV") {
radnavInput("R5");
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));

View file

@ -138,6 +138,33 @@ var radnavInput = func(key) {
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L5") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/adf1freq-set", 0);
setprop("/MCDU[0]/scratchpad-msg", "0");
setprop("/MCDU[0]/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[0]/scratchpad", "");
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/vor2freq-set", 0);
@ -207,5 +234,32 @@ var radnavInput = func(key) {
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R5") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/adf2freq-set", 0);
setprop("/MCDU[0]/scratchpad-msg", "0");
setprop("/MCDU[0]/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[0]/scratchpad", "");
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
}
}

View file

@ -48,12 +48,15 @@ var MCDU_reset = func {
setprop("/FMGC/internal/vor1crs-set", 0);
setprop("/FMGC/internal/vor2freq-set", 0);
setprop("/FMGC/internal/vor2crs-set", 0);
setprop("/FMGC/internal/adf1freq-set", 0);
setprop("/FMGC/internal/adf2freq-set", 0);
}
var lskbutton = func(btn) {
if (btn == "1") {
if (getprop("/MCDU[1]/page") == "MCDU") {
setprop("/MCDU[1]/page", getprop("/MCDU[1]/last-fmgc-page"));
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[1]/scratchpad", "");
} else if (getprop("/MCDU[1]/page") == "TO") {
perfTOInput("L1");
@ -125,6 +128,8 @@ var lskbutton = func(btn) {
perfCRZInput("L5");
} else if (getprop("/MCDU[1]/page") == "DES") {
perfDESInput("L5");
} else if (getprop("/MCDU[1]/page") == "RADNAV") {
radnavInput("L5");
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
@ -207,6 +212,8 @@ var rskbutton = func(btn) {
} else if (btn == "5") {
if (getprop("/MCDU[1]/page") == "TO") {
perfTOInput("R5");
} else if (getprop("/MCDU[1]/page") == "RADNAV") {
radnavInput("R5");
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));

View file

@ -3,12 +3,12 @@
##################################################################
var radnavInput = func(key) {
var scratchpad = getprop("/MCDU[1]/scratchpad");
var scratchpad = getprop("/MCDU[0]/scratchpad");
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/vor1freq-set", 0);
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 3 or tfs == 5 or tfs == 6) {
@ -17,67 +17,67 @@ var radnavInput = func(key) {
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) {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
} else {
setprop("/instrumentation/nav[2]/frequencies/selected-mhz", scratchpad);
setprop("/FMGC/internal/vor1freq-set", 1);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/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[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L2") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/vor1crs-set", 0);
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad-msg", "0");
setprop("/MCDU[0]/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[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L3") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/ils1freq-set", 0);
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 3 or tfs == 5 or tfs == 6) {
@ -88,61 +88,88 @@ var radnavInput = func(key) {
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[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L4") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/ils1crs-set", 0);
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad-msg", "0");
setprop("/MCDU[0]/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[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L5") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/adf1freq-set", 0);
setprop("/MCDU[0]/scratchpad-msg", "0");
setprop("/MCDU[0]/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[0]/scratchpad", "");
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/vor2freq-set", 0);
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 3 or tfs == 5 or tfs == 6) {
@ -151,60 +178,87 @@ var radnavInput = func(key) {
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) {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
} else {
setprop("/instrumentation/nav[3]/frequencies/selected-mhz", scratchpad);
setprop("/FMGC/internal/vor2freq-set", 1);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/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[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R2") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/vor2crs-set", 0);
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 3) {
if (scratchpad >= 0 and scratchpad <= 360) {
setprop("/instrumentation/nav[1]/radials/selected-deg", scratchpad);
setprop("/FMGC/internal/vor2crs-set", 1);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R5") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/adf2freq-set", 0);
setprop("/MCDU[0]/scratchpad-msg", "0");
setprop("/MCDU[0]/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[0]/scratchpad", "");
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
}