1
0
Fork 0

A320: improve ADF system - add BFO prompt to RADNAV page, make the volume selector work; improve frequency display and parsing; miscellaneous corrections

This commit is contained in:
Jonathan Redpath 2021-12-24 19:33:31 +00:00
parent cf6a24c06d
commit 1e93076a83
8 changed files with 166 additions and 37 deletions

View file

@ -99,6 +99,8 @@ var ils1FreqSet = props.globals.getNode("/FMGC/internal/ils1freq-set", 1);
var ils1CRSSet = props.globals.getNode("/FMGC/internal/ils1crs-set", 1);
var adf1FreqSet = props.globals.getNode("/FMGC/internal/adf1freq-set", 1);
var adf2FreqSet = props.globals.getNode("/FMGC/internal/adf2freq-set", 1);
var adf1Bfo = props.globals.getNode("/systems/radio/rmp[0]/bfo-active", 1);
var adf2Bfo = props.globals.getNode("/systems/radio/rmp[1]/bfo-active", 1);
var ils1CRS = props.globals.getNode("/instrumentation/nav[0]/radials/selected-deg", 1);
var vor1CRS = props.globals.getNode("/instrumentation/nav[2]/radials/selected-deg", 1);
var vor2CRS = props.globals.getNode("/instrumentation/nav[3]/radials/selected-deg", 1);
@ -2595,12 +2597,12 @@ var canvas_MCDU_base = {
me.colorLeft("blu", "blu", "blu", "blu", "blu", "blu");
me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "blu");
me.colorCenter("wht", "wht", "wht", "wht", "wht", "grn");
me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht");
me.colorRight("blu", "blu", "blu", "blu", "blu", "blu");
me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht");
me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "blu");
pageSwitch[i].setBoolValue(1);
}
@ -2625,14 +2627,28 @@ var canvas_MCDU_base = {
} else {
me["Simple_L4"].setFontSize(small);
}
me["Simple_L6"].setText(" ADF1 BFO");
me["Simple_R6"].setText("ADF2 BFO ");
if (adf1FreqSet.getValue() == 1) {
me["Simple_L5"].setFont(default);
me["Simple_L5"].setFontSize(normal);
me["Simple_L5"].setText(sprintf("%s", adf1.getValue()));
me["Simple_L5"].setText(sprintf(" %s", adf1.getValue()));
me["Simple_L6"].show();
if (adf1Bfo.getValue()) {
# TODO - wrong arrow
me["Simple_L6_Arrow"].hide();
} else {
me["Simple_L6_Arrow"].show();
}
} else {
me["Simple_L5"].setFont(symbol);
me["Simple_L5"].setFontSize(small);
me["Simple_L5"].setText("[ ]/[ ]");
me["Simple_L5"].setText("[ ]/[ .]");
me["Simple_L6"].hide();
me["Simple_L6_Arrow"].hide();
}
if (vor2FreqSet.getValue() == 1) {
@ -2645,14 +2661,25 @@ var canvas_MCDU_base = {
} else {
me["Simple_R2"].setFontSize(small);
}
if (adf2FreqSet.getValue() == 1) {
me["Simple_R5"].setFont(default);
me["Simple_R5"].setFontSize(normal);
me["Simple_R5"].setText(sprintf("%s", adf2.getValue()));
me["Simple_R5"].setText(sprintf("%s ", adf2.getValue()));
me["Simple_R6"].show();
if (adf2Bfo.getValue()) {
# TODO - wrong arrow
me["Simple_R6_Arrow"].hide();
} else {
me["Simple_R6_Arrow"].show();
}
} else {
me["Simple_R5"].setFont(symbol);
me["Simple_R5"].setFontSize(small);
me["Simple_R5"].setText("[ ]/[ ]");
me["Simple_R5"].setText("[ .]/[ ]");
me["Simple_R6"].hide();
me["Simple_R6_Arrow"].hide();
}
me["Simple_L1"].setText(" " ~ vor1.getValue());

View file

@ -577,28 +577,18 @@ var nav3 = func {
}
var adf0 = func {
var freqadf0uf = getprop("/instrumentation/adf[0]/frequencies/selected-khz");
var freqadf0 = sprintf("%.2f", freqadf0uf);
var nameadf0 = getprop("/instrumentation/adf[0]/ident") or "";
if (freqadf0 >= 190 and freqadf0 <= 1750) {
if (nameadf0 != "") {
var freqadf0 = sprintf("%.1f", pts.Instrumentation.Adf.Frequencies.selectedKhz[0].getValue());
if (freqadf0 >= 190 and freqadf0 <= 1799) {
var nameadf0 = pts.Instrumentation.Adf.ident[0].getValue() or " ";
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") or "";
if (freqadf1 >= 190 and freqadf1 <= 1750) {
if (nameadf1 != "") {
var freqadf1 = sprintf("%.1f", pts.Instrumentation.Adf.Frequencies.selectedKhz[1].getValue());
if (freqadf1 >= 190 and freqadf1 <= 1799) {
var nameadf1 = pts.Instrumentation.Adf.ident[1].getValue() or " ";
setprop("/FMGC/internal/adf2-mcdu", freqadf1 ~ "/" ~ nameadf1);
} else {
setprop("/FMGC/internal/adf2-mcdu", freqadf1);
}
}
}

View file

@ -154,6 +154,12 @@ var Gear = {
};
var Instrumentation = {
Adf: {
ident: [props.globals.getNode("/instrumentation/adf[0]/ident"), props.globals.getNode("/instrumentation/adf[1]/ident")],
Frequencies: {
selectedKhz: [props.globals.getNode("/instrumentation/adf[0]/frequencies/selected-khz"), props.globals.getNode("/instrumentation/adf[1]/frequencies/selected-khz")],
},
},
AirspeedIndicator: {
indicatedSpdKt: props.globals.getNode("/instrumentation/airspeed-indicator/indicated-speed-kt"),
indicatedMach: props.globals.getNode("/instrumentation/airspeed-indicator/indicated-mach"),

View file

@ -843,6 +843,8 @@ var lskbutton = func(btn, i) {
pageNode[i].setValue("WINDCLB");
} else if (page == "ROUTESELECTION") {
initInputROUTESEL("L6",i);
} else if (page == "RADNAV") {
radnavInput("L6",i);
} else if (page == "PERFCLB") {
perfCLBInput("L6",i);
} else if (page == "PERFCRZ") {
@ -1286,6 +1288,8 @@ var rskbutton = func(btn, i) {
mcdu_message(i, "AOC DISABLED");
} else if (page == "INITA") {
initInputA("R6",i);
} else if (page == "RADNAV") {
radnavInput("R6",i);
} else if (page == "F-PLNA" or page == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(6);
} else if (page == "VERTREV") {

View file

@ -104,11 +104,22 @@ var radnavInput = func(key, i) {
mcdu_scratchpad.scratchpads[i].empty();
} 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);
if (tfs >= 3 and tfs <= 6) {
if (scratchpad >= 190 and scratchpad <= 1799) {
if (scratchpad != int(scratchpad)) {
var splitScratchpad = split(".",scratchpad);
if (size(splitScratchpad) != 2 or splitScratchpad[1] != "5") {
mcdu_message(i, "NOT ALLOWED");
} else {
setprop("/instrumentation/adf[0]/frequencies/selected-khz", scratchpad);
setprop("/FMGC/internal/adf1freq-set", 1);
mcdu_scratchpad.scratchpads[i].empty();
}
} else {
setprop("/instrumentation/adf[0]/frequencies/selected-khz", scratchpad);
setprop("/FMGC/internal/adf1freq-set", 1);
mcdu_scratchpad.scratchpads[i].empty();
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
@ -116,6 +127,22 @@ var radnavInput = func(key, i) {
mcdu_message(i, "NOT ALLOWED");
}
}
} else if (key == "L6") {
if (getprop("/FMGC/internal/adf1freq-set")) {
if (scratchpad == "CLR" and getprop("/systems/radio/rmp[0]/bfo-active")) {
setprop("/systems/radio/rmp[0]/bfo-active", 0);
mcdu_scratchpad.scratchpads[i].empty();
} else {
var tfs = size(scratchpad);
if (tfs == 0 and !getprop("/systems/radio/rmp[0]/bfo-active")) {
setprop("/systems/radio/rmp[0]/bfo-active", 1);
} else {
mcdu_message(i, "NOT ALLOWED");
}
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (key == "R1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/vor2freq-set", 0);
@ -169,11 +196,22 @@ var radnavInput = func(key, i) {
mcdu_scratchpad.scratchpads[i].empty();
} 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);
if (tfs >= 3 and tfs <= 6) {
if (scratchpad >= 190 and scratchpad <= 1799) {
if (scratchpad != int(scratchpad)) {
var splitScratchpad = split(".",scratchpad);
if (size(splitScratchpad) != 2 or splitScratchpad[1] != "5") {
mcdu_message(i, "NOT ALLOWED");
} else {
setprop("/instrumentation/adf[1]/frequencies/selected-khz", scratchpad);
setprop("/FMGC/internal/adf2freq-set", 1);
mcdu_scratchpad.scratchpads[i].empty();
}
} else {
setprop("/instrumentation/adf[1]/frequencies/selected-khz", scratchpad);
setprop("/FMGC/internal/adf2freq-set", 1);
mcdu_scratchpad.scratchpads[i].empty();
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
@ -181,8 +219,24 @@ var radnavInput = func(key, i) {
mcdu_message(i, "NOT ALLOWED");
}
}
} else if (key == "R6") {
if (getprop("/FMGC/internal/adf2freq-set")) {
if (scratchpad == "CLR" and getprop("/systems/radio/rmp[1]/bfo-active")) {
setprop("/systems/radio/rmp[1]/bfo-active", 0);
mcdu_scratchpad.scratchpads[i].empty();
} else {
var tfs = size(scratchpad);
if (tfs == 0 and !getprop("/systems/radio/rmp[1]/bfo-active")) {
setprop("/systems/radio/rmp[1]/bfo-active", 1);
} else {
mcdu_message(i, "NOT ALLOWED");
}
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
}
}

View file

@ -11,11 +11,19 @@ var vhf1_capt_recive = props.globals.initNode("/controls/audio/acp[0]/vhf1-reciv
var vhf2_capt_recive = props.globals.initNode("/controls/audio/acp[0]/vhf2-recive", 1, "BOOL");
var vhf1_capt_volume = props.globals.initNode("/controls/audio/acp[0]/vhf1-volume", 1, "DOUBLE");
var vhf2_capt_volume = props.globals.initNode("/controls/audio/acp[0]/vhf2-volume", 1, "DOUBLE");
var adf1_capt_receive = props.globals.initNode("/controls/audio/acp[0]/adf1-recive", 0, "BOOL");
var adf1_capt_volume = props.globals.initNode("/controls/audio/acp[0]/adf1-volume", 1, "DOUBLE");
var adf2_capt_receive = props.globals.initNode("/controls/audio/acp[0]/adf2-recive", 0, "BOOL");
var adf2_capt_volume = props.globals.initNode("/controls/audio/acp[0]/adf2-volume", 1, "DOUBLE");
var vhf1_fo_recive = props.globals.initNode("/controls/audio/acp[1]/vhf1-recive", 1, "BOOL");
var vhf2_fo_recive = props.globals.initNode("/controls/audio/acp[1]/vhf2-recive", 1, "BOOL");
var vhf1_fo_volume = props.globals.initNode("/controls/audio/acp[1]/vhf1-volume", 1, "DOUBLE");
var vhf2_fo_volume = props.globals.initNode("/controls/audio/acp[1]/vhf2-volume", 1, "DOUBLE");
var adf1_fo_receive = props.globals.initNode("/controls/audio/acp[1]/adf1-recive", 0, "BOOL");
var adf1_fo_volume = props.globals.initNode("/controls/audio/acp[1]/adf1-volume", 1, "DOUBLE");
var adf2_fo_receive = props.globals.initNode("/controls/audio/acp[1]/adf2-recive", 0, "BOOL");
var adf2_fo_volume = props.globals.initNode("/controls/audio/acp[1]/adf2-volume", 1, "DOUBLE");
var com1_volume = props.globals.getNode("instrumentation/comm[0]/volume");
var com2_volume = props.globals.getNode("instrumentation/comm[1]/volume");

View file

@ -490,7 +490,7 @@ var change_nav_mode = func(rmp_nr, nav_mode) {
}
# ADF Radio: Implement BFO such that you will hear audio
var BFOActive = [props.globals.getNode("/systems/radio/rmp[0]/bfo-active"),props.globals.getNode("/systems/radio/rmp[1]/bfo-active")];
var BFOActive = [props.globals.initNode("/systems/radio/rmp[0]/bfo-active", 0, "BOOL"),props.globals.initNode("/systems/radio/rmp[1]/bfo-active", 0, "BOOL")];
var ADFIdent = [props.globals.getNode("/instrumentation/adf[0]/ident-audible"),props.globals.getNode("/instrumentation/adf[1]/ident-audible")];
var ADFMode = [props.globals.getNode("/instrumentation/adf[0]/mode"),props.globals.getNode("/instrumentation/adf[1]/mode")];

View file

@ -39,6 +39,46 @@
</channel>
<channel name="ACP" execrate="8">
<switch name="/instrumentation/adf[0]/volume-norm">
<default value="0"/>
<test logic="AND" value="/controls/audio/acp[0]/adf1-volume">
/controls/audio/acp[0]/adf1-recive eq 1
<test logic="OR">
/controls/audio/acp[1]/adf1-recive eq 0
/controls/audio/acp[0]/adf1-volume ge /controls/audio/acp[1]/adf1-volume
</test>
</test>
<test logic="AND" value="/controls/audio/acp[1]/adf1-volume">
/controls/audio/acp[1]/adf1-recive eq 1
<test logic="OR">
/controls/audio/acp[0]/adf1-recive eq 0
/controls/audio/acp[0]/adf1-volume lt /controls/audio/acp[1]/adf1-volume
</test>
</test>
</switch>
<switch name="/instrumentation/adf[1]/volume-norm">
<default value="0"/>
<test logic="AND" value="/controls/audio/acp[0]/adf2-volume">
/controls/audio/acp[0]/adf2-recive eq 1
<test logic="OR">
/controls/audio/acp[1]/adf2-recive eq 0
/controls/audio/acp[0]/adf2-volume ge /controls/audio/acp[1]/adf2-volume
</test>
</test>
<test logic="AND" value="/controls/audio/acp[1]/adf2-volume">
/controls/audio/acp[1]/adf2-recive eq 1
<test logic="OR">
/controls/audio/acp[0]/adf2-recive eq 0
/controls/audio/acp[0]/adf2-volume lt /controls/audio/acp[1]/adf2-volume
</test>
</test>
</switch>
</channel>
<channel name="System Display" execrate="8">
<switch name="/ECAM/Lower/g-force-display-cmd">