1
0
Fork 0

Misc fixes + improvements to Nasal code; no real changes; only improved code quality

This commit is contained in:
legoboyvdlp R 2021-06-08 18:16:19 +01:00
parent 0dd4f55400
commit aa3990d3d9
8 changed files with 125 additions and 106 deletions

View file

@ -92,7 +92,8 @@ var revisionFile = (getprop("/sim/aircraft-dir") ~ "/revision.txt");
var current_revision = io.readfile(revisionFile);
print("A320-family Revision: " ~ current_revision);
setprop("/systems/acconfig/revision", current_revision);
setprop("/systems/acconfig/options/fo-view", 0);
var foViewNode = props.globals.initNode("/systems/acconfig/options/fo-view", 0, "BOOL");
setprop("/systems/acconfig/options/simbrief-username", "");
setlistener("/systems/acconfig/new-revision", func {
@ -209,7 +210,7 @@ var readSettings = func {
setprop("/systems/apu/oil/allow-oil-consumption", getprop("/systems/acconfig/options/allow-oil-consumption"));
setprop("/sim/model/autopush/route/show", getprop("/systems/acconfig/options/autopush/show-route"));
setprop("/sim/model/autopush/route/show-wingtip", getprop("/systems/acconfig/options/autopush/show-wingtip"));
setprop("/options/system/fo-view", getprop("/systems/acconfig/options/fo-view"));
setprop("/options/system/fo-view", foViewNode.getValue());
setprop("/FMGC/simbrief-username", getprop("/systems/acconfig/options/simbrief-username"));
setprop("/systems/atsu/atis-server", getprop("/systems/acconfig/options/atis-server"));
setprop("/systems/atsu/wxr-server", getprop("/systems/acconfig/options/wxr-server"));
@ -223,7 +224,7 @@ var writeSettings = func {
setprop("/systems/acconfig/options/allow-oil-consumption", getprop("/systems/apu/oil/allow-oil-consumption"));
setprop("/systems/acconfig/options/autopush/show-route", getprop("/sim/model/autopush/route/show"));
setprop("/systems/acconfig/options/autopush/show-wingtip", getprop("/sim/model/autopush/route/show-wingtip"));
setprop("/systems/acconfig/options/fo-view", getprop("/options/system/fo-view"));
foViewNode.setValue(getprop("/options/system/fo-view"));
setprop("/systems/acconfig/options/simbrief-username", getprop("/FMGC/simbrief-username"));
setprop("/systems/acconfig/options/atis-server", getprop("/systems/atsu/atis-server"));
setprop("/systems/acconfig/options/wxr-server", getprop("/systems/atsu/wxr-server"));

View file

@ -41,7 +41,6 @@ var easeArrow = {
#me.element.hide();
me.duration = 0;
me.changed = 1;
print("VOR reset");
},
setzero: func {
me.duration = 0;

View file

@ -2155,7 +2155,7 @@ var messages_priority_2 = func {
ECAM_controller.warningReset(athr_lim_1);
}
if (getprop("/instrumentation/tcas/serviceable") == 0 and phaseVar2 != 1 and phaseVar2 != 3 and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8 and phaseVar2 != 10 and systems.ELEC.Bus.ac1.getValue() >= 110 and pts.Instrumentation.TCAS.Inputs.mode.getValue() != 1 and tcasFault.clearFlag == 0) {
if (pts.Instrumentation.TCAS.servicable.getValue() == 0 and phaseVar2 != 1 and phaseVar2 != 3 and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8 and phaseVar2 != 10 and systems.ELEC.Bus.ac1.getValue() >= 110 and pts.Instrumentation.TCAS.Inputs.mode.getValue() != 1 and tcasFault.clearFlag == 0) {
tcasFault.active = 1;
} else {
ECAM_controller.warningReset(tcasFault);

View file

@ -192,6 +192,7 @@ var Instrumentation = {
locDeflection: props.globals.getNode("/instrumentation/nav[0]/heading-needle-deflection-norm"),
},
TCAS: {
servicable: props.globals.getNode("/instrumentation/tcas/serviceable"),
Inputs: {
mode: props.globals.getNode("/instrumentation/tcas/inputs/mode"),
},

View file

@ -32,7 +32,7 @@ var init = func() {
}
var update_com1 = func() {
if (getprop("/systems/acconfig/options/fo-view") == 1) {
if (acconfig.foViewNode.getValue() == 1) {
if (vhf1_fo_recive.getValue()) {
com1_volume.setValue(vhf1_fo_volume.getValue());
} else {
@ -48,7 +48,7 @@ var update_com1 = func() {
}
var update_com2 = func() {
if (getprop("/systems/acconfig/options/fo-view") == 1) {
if (acconfig.foViewNode.getValue() == 1) {
if (vhf2_fo_recive.getValue()) {
com2_volume.setValue(vhf2_fo_volume.getValue());
} else {

View file

@ -141,10 +141,11 @@ var transponderPanel = {
code: "2000",
codeDisp: "2000",
codeProp: props.globals.initNode("/systems/atc/transponder-code", "2000", "STRING"),
failNode: props.globals.getNode("/systems/atc/failed"),
failLight: 0,
clearFlag: 0,
keypad: func(keyNum) {
if (props.globals.getNode("/controls/switches/annun-test", 1).getBoolValue() or props.globals.getNode("/systems/electrical/bus/dc-ess", 1).getValue() < 25) {
if (pts.Controls.Switches.annunTest.getBoolValue() or systems.ELEC.Bus.dcEss.getValue() < 25) {
return;
}
if (keyNum < 0 or keyNum > 7) {
@ -162,7 +163,7 @@ var transponderPanel = {
}
},
clearKey: func() {
if (props.globals.getNode("/controls/switches/annun-test", 1).getBoolValue() or props.globals.getNode("/systems/electrical/bus/dc-ess", 1).getValue() < 25) {
if (pts.Controls.Switches.annunTest.getBoolValue() or systems.ELEC.Bus.dcEss.getValue() < 25) {
return;
}
if (me.codeDisp != "") {
@ -214,7 +215,7 @@ var transponderPanel = {
return;
}
me.failLight = newFail;
props.globals.getNode("/systems/atc/failed").setBoolValue(me.failLight);
me.failNode.setBoolValue(me.failLight);
},
identSwitch: func() {
Transponders.vector[me.atcSel - 1].ident();
@ -255,27 +256,27 @@ var transponderPanel = {
updateADR1: func(val) {
if (Transponders.vector[me.atcSel - 1].activeADIRS == 1) {
if (val) {
setprop("/instrumentation/tcas/serviceable", 1);
pts.Instrumentation.TCAS.servicable.setValue(1);
} else {
setprop("/instrumentation/tcas/serviceable", 0);
pts.Instrumentation.TCAS.servicable.setValue(0);
}
}
},
updateADR2: func(val) {
if (Transponders.vector[me.atcSel - 1].activeADIRS == 2) {
if (val) {
setprop("/instrumentation/tcas/serviceable", 1);
pts.Instrumentation.TCAS.servicable.setValue(1);
} else {
setprop("/instrumentation/tcas/serviceable", 0);
pts.Instrumentation.TCAS.servicable.setValue(0);
}
}
},
updateADR3: func(val) {
if (Transponders.vector[me.atcSel - 1].activeADIRS == 3) {
if (val) {
setprop("/instrumentation/tcas/serviceable", 1);
pts.Instrumentation.TCAS.servicable.setValue(1);
} else {
setprop("/instrumentation/tcas/serviceable", 0);
pts.Instrumentation.TCAS.servicable.setValue(0);
}
}
},
@ -295,7 +296,6 @@ setlistener("/instrumentation/transponder/id-code", func {
var Transponders = std.Vector.new([Transponder.new("/systems/electrical/bus/ac-ess-shed", 1), Transponder.new("/systems/electrical/bus/ac-2", 2)]);
setlistener("/systems/navigation/adr/operating-1", func() {
transponderPanel.updateADR1(systems.ADIRS.Operating.adr[0].getValue());
}, 1, 0);

View file

@ -1,10 +1,12 @@
#
# Chrono - Clock - ET
#
var chr = aircraft.timer.new("instrumentation/chrono[0]/elapsetime-sec",1);
var clk = aircraft.timer.new("instrumentation/clock/elapsetime-sec",1);
var chrono_cpt = aircraft.timer.new("instrumentation/ndchrono[0]/elapsetime-sec",1);
var chrono_fo = aircraft.timer.new("instrumentation/ndchrono[1]/elapsetime-sec",1);
var chr = aircraft.timer.new("/instrumentation/chrono[0]/elapsetime-sec",1);
var clk = aircraft.timer.new("/instrumentation/clock/elapsetime-sec",1);
var chrono_cpt = aircraft.timer.new("/instrumentation/ndchrono[0]/elapsetime-sec",1);
var chrono_fo = aircraft.timer.new("/instrumentation/ndchrono[1]/elapsetime-sec",1);
var chrono_cpt_node = props.globals.getNode("/instrumentation/ndchrono[0]/elapsetime-sec");
var chrono_fo_node = props.globals.getNode("/instrumentation/ndchrono[1]/elapsetime-sec");
var chr_min = nil;
var chr_sec = nil;
@ -141,7 +143,7 @@ setlistener("/instrumentation/chrono[0]/chrono-reset", func(et){
}, 0, 0);
#Chrono
setlistener("instrumentation/efis[0]/inputs/CHRONO", func(et){
setlistener("/instrumentation/efis[0]/inputs/CHRONO", func(et){
chrono0 = et.getValue();
if (chrono0 == 1){
chrono_cpt.start();
@ -149,11 +151,11 @@ setlistener("instrumentation/efis[0]/inputs/CHRONO", func(et){
chrono_cpt.stop();
} elsif (chrono0 == 0) {
chrono_cpt.reset();
setprop("instrumentation/ndchrono[0]/elapsetime-sec", 0);
chrono_cpt_node.setValue(0);
}
}, 0, 0);
setlistener("instrumentation/efis[1]/inputs/CHRONO", func(et){
setlistener("/instrumentation/efis[1]/inputs/CHRONO", func(et){
chrono1 = et.getValue();
if (chrono1 == 1){
chrono_fo.start();
@ -161,11 +163,11 @@ setlistener("instrumentation/efis[1]/inputs/CHRONO", func(et){
chrono_fo.stop();
} elsif (chrono1 == 0) {
chrono_fo.reset();
setprop("instrumentation/ndchrono[1]/elapsetime-sec", 0);
chrono_fo_node.setValue(0);
}
}, 0, 0);
setlistener("instrumentation/clock/et-selector", func(et){
setlistener("/instrumentation/clock/et-selector", func(et){
tmp1 = et.getValue();
if (tmp1 == 2){
clk.reset();
@ -272,37 +274,39 @@ var start_loop = maketimer(0.1, func {
}
#Cpt Chrono
chr0_tmp = getprop("instrumentation/ndchrono[0]/elapsetime-sec");
chr0_tmp = chrono_cpt_node.getValue();
if (chr0_tmp >= 360000) {
setprop("instrumentation/ndchrono[0]/elapsetime-sec", getprop("instrumentation/ndchrono[0]/elapsetime-sec") - 360000);
};
chrono_cpt_node.setValue(chrono_cpt_node.getValue() - 360000);
}
chr0_hh = int(chr0_tmp * 0.000277777777778);
chr0_min = int((chr0_tmp * 0.0166666666667) - (chr0_hh * 60));
chr0_sec = int(chr0_tmp - (chr0_min * 60) - (chr0_hh * 3600));
setprop("instrumentation/ndchrono[0]/etHh_cpt", chr0_hh);
setprop("instrumentation/ndchrono[0]/etMin_cpt", chr0_min);
setprop("instrumentation/ndchrono[0]/etSec_cpt", chr0_sec);
cpt_chrono.etHh_cpt.setValue(chr0_hh);
cpt_chrono.etMin_cpt.setValue(chr0_min);
cpt_chrono.etSec_cpt.setValue(chr0_sec);
if (chr0_tmp >= 3600) {
setprop("instrumentation/ndchrono[0]/text", sprintf("%02d H %02d'", chr0_hh, chr0_min));
cpt_chrono.text.setValue(sprintf("%02d H %02d'", chr0_hh, chr0_min));
} else {
setprop("instrumentation/ndchrono[0]/text", sprintf("%02d' %02d''", chr0_min, chr0_sec));
cpt_chrono.text.setValue(sprintf("%02d' %02d''", chr0_min, chr0_sec));
}
#Fo Chrono
chr1_tmp = getprop("instrumentation/ndchrono[1]/elapsetime-sec");
chr1_tmp = chrono_fo_node.getValue();
if (chr1_tmp >= 360000) {
setprop("instrumentation/ndchrono[1]/elapsetime-sec", getprop("instrumentation/ndchrono[1]/elapsetime-sec") - 360000);
};
chrono_fo_node.setValue(chrono_fo_node.getValue() - 360000);
}
chr1_hh = int(chr1_tmp * 0.000277777777778);
chr1_min = int(chr1_tmp * 0.0166666666667);
chr1_sec = int(chr1_tmp - (chr1_min * 60) - (chr1_hh * 3600));
setprop("instrumentation/ndchrono[1]/etHh_fo", chr1_hh);
setprop("instrumentation/ndchrono[1]/etMin_fo", chr1_min);
setprop("instrumentation/ndchrono[1]/etSec_fo", chr1_sec);
fo_chrono.etHh_fo.setValue(chr1_hh);
fo_chrono.etMin_fo.setValue(chr1_min);
fo_chrono.etSec_fo.setValue(chr1_sec);
if (chr1_tmp >= 3600) {
setprop("instrumentation/ndchrono[1]/text", sprintf("%02d H %02d'", chr1_hh, chr1_min));
fo_chrono.text.setValue(sprintf("%02d H %02d'", chr1_hh, chr1_min));
} else {
setprop("instrumentation/ndchrono[1]/text", sprintf("%02d' %02d''", chr1_min, chr1_sec));
fo_chrono.text.setValue(sprintf("%02d' %02d''", chr1_min, chr1_sec));
}
});

View file

@ -27,23 +27,23 @@ var chan_rmp1_v = "vhr1";
var chan_rmp2_v = "vhr2";
var chan_rmp3_v = "vhr3";
var act_vhf1 = props.globals.getNode("instrumentation/comm[0]/frequencies/selected-mhz");
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_vhf1 = props.globals.getNode("/instrumentation/comm[0]/frequencies/selected-mhz");
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_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");
if (rand() > 0.5) {
var hf1 = genFourRand();
@ -149,13 +149,19 @@ var rmpUpdate = func() {
}
}
var act = nil;
var data_mode = nil;
var sel1 = nil;
var sel2 = nil;
var sel3 = nil;
var update_active_vhf = func(vhf) {
var sel1 = chan_rmp1.getValue();
var sel2 = chan_rmp2.getValue();
var sel3 = chan_rmp3.getValue();
sel1 = chan_rmp1.getValue();
sel2 = chan_rmp2.getValue();
sel3 = chan_rmp3.getValue();
if (vhf == 1) {
var act = sprintf("%3.3f", act_vhf1.getValue());
act = sprintf("%3.3f", act_vhf1.getValue());
if (sel1 == "vhf1") {
act_display_rmp1.setValue(act);
@ -167,7 +173,7 @@ var update_active_vhf = func(vhf) {
act_display_rmp3.setValue(act);
}
} else if (vhf == 2) {
var act = sprintf("%3.3f", act_vhf2.getValue());
act = sprintf("%3.3f", act_vhf2.getValue());
if (sel1 == "vhf2") {
act_display_rmp1.setValue(act);
@ -179,8 +185,8 @@ var update_active_vhf = func(vhf) {
act_display_rmp3.setValue(act);
}
} else if (vhf == 3) {
var act = sprintf("%3.3f", act_vhf3.getValue());
var data_mode = vhf3_data_mode.getValue();
act = sprintf("%3.3f", act_vhf3.getValue());
data_mode = vhf3_data_mode.getValue();
if (sel1 == "vhf3") {
if (data_mode == 1) {
@ -205,7 +211,7 @@ var update_active_vhf = func(vhf) {
}
} else if (vhf == 4) {
if (sel1 == "hf1" or sel2 == "hf1") {
var act = sprintf("%5.0f", systems.HFS[0].selectedChannelKhz);
act = sprintf("%5.0f", systems.HFS[0].selectedChannelKhz);
if (sel1 == "hf1") {
act_display_rmp1.setValue(act);
@ -219,7 +225,7 @@ var update_active_vhf = func(vhf) {
}
} else if (vhf == 5) {
if (sel1 == "hf2" or sel2 == "hf2") {
var act = sprintf("%5.0f", systems.HFS[1].selectedChannelKhz);
act = sprintf("%5.0f", systems.HFS[1].selectedChannelKhz);
if (sel1 == "hf2") {
act_display_rmp1.setValue(act);
@ -279,65 +285,67 @@ var update_displays_nav = func(nav) {
}
}
var stby = nil;
var update_stby_freq = func(rmp_no, freq) {
var data_mode = vhf3_data_mode.getValue();
data_mode = vhf3_data_mode.getValue();
if (rmp_no == 0) {
if (freq == 1) {
var stby = sprintf("%3.3f", stby_rmp1_vhf1.getValue());
stby = sprintf("%3.3f", stby_rmp1_vhf1.getValue());
} else if (freq == 2) {
var stby = sprintf("%3.3f", stby_rmp1_vhf2.getValue());
stby = sprintf("%3.3f", stby_rmp1_vhf2.getValue());
} else if (freq == 3) {
if (data_mode == 0) {
var stby = "data";
stby = "data";
} else {
var stby = sprintf("%3.3f", stby_rmp1_vhf3.getValue());
stby = sprintf("%3.3f", stby_rmp1_vhf3.getValue());
}
} else if (freq == 4) {
var stby = sprintf("%5.0f", stby_rmp1_hf1.getValue());
stby = sprintf("%5.0f", stby_rmp1_hf1.getValue());
} else if (freq == 5) {
var stby = sprintf("%5.0f", stby_rmp1_hf2.getValue());
stby = sprintf("%5.0f", stby_rmp1_hf2.getValue());
}
stby_display_rmp1.setValue(stby);
} else if (rmp_no == 1) {
if (freq == 1) {
var stby = sprintf("%3.3f", stby_rmp2_vhf1.getValue());
stby = sprintf("%3.3f", stby_rmp2_vhf1.getValue());
} else if (freq == 2) {
var stby = sprintf("%3.3f", stby_rmp2_vhf2.getValue());
stby = sprintf("%3.3f", stby_rmp2_vhf2.getValue());
} else if (freq == 3) {
if (data_mode == 0) {
var stby = "data";
stby = "data";
} else {
var stby = sprintf("%3.3f", stby_rmp2_vhf3.getValue());
stby = sprintf("%3.3f", stby_rmp2_vhf3.getValue());
}
} else if (freq == 4) {
var stby = sprintf("%5.0f", stby_rmp2_hf1.getValue());
stby = sprintf("%5.0f", stby_rmp2_hf1.getValue());
} else if (freq == 5) {
var stby = sprintf("%5.0f", stby_rmp2_hf2.getValue());
stby = sprintf("%5.0f", stby_rmp2_hf2.getValue());
}
stby_display_rmp2.setValue(stby);
} else {
if (freq == 1) {
var stby = sprintf("%3.3f", stby_rmp3_vhf1.getValue());
stby = sprintf("%3.3f", stby_rmp3_vhf1.getValue());
} else if (freq == 2) {
var stby = sprintf("%3.3f", stby_rmp3_vhf2.getValue());
stby = sprintf("%3.3f", stby_rmp3_vhf2.getValue());
} else if (freq == 3) {
if (data_mode == 0) {
var stby = "data";
stby = "data";
} else {
var stby = sprintf("%3.3f", stby_rmp3_vhf3.getValue());
stby = sprintf("%3.3f", stby_rmp3_vhf3.getValue());
}
} else if (freq == 4) {
var stby = sprintf("%5.0f", stby_rmp3_hf1.getValue());
stby = sprintf("%5.0f", stby_rmp3_hf1.getValue());
} else if (freq == 5) {
var stby = sprintf("%5.0f", stby_rmp3_hf2.getValue());
stby = sprintf("%5.0f", stby_rmp3_hf2.getValue());
}
stby_display_rmp3.setValue(stby);
}
}
var chan = nil;
var update_chan_sel = func(rmp_no) {
update_active_vhf(1);
update_active_vhf(2);
@ -350,7 +358,7 @@ var update_chan_sel = func(rmp_no) {
update_displays_nav(rmp_no + 5);
if (rmp_no == 0) {
var chan = chan_rmp1.getValue();
chan = chan_rmp1.getValue();
if (chan == "vhf1") {
update_stby_freq(rmp_no, 1);
} else if (chan == "vhf2") {
@ -363,7 +371,7 @@ var update_chan_sel = func(rmp_no) {
update_stby_freq(rmp_no, 5);
}
} else if (rmp_no == 1) {
var chan = chan_rmp2.getValue();
chan = chan_rmp2.getValue();
if (chan == "vhf1") {
update_stby_freq(rmp_no, 1);
} else if (chan == "vhf2") {
@ -376,7 +384,7 @@ var update_chan_sel = func(rmp_no) {
update_stby_freq(rmp_no, 5);
}
} else {
var chan = chan_rmp3.getValue();
chan = chan_rmp3.getValue();
if (chan == "vhf1") {
update_stby_freq(rmp_no, 1);
} else if (chan == "vhf2") {
@ -391,13 +399,19 @@ var update_chan_sel = func(rmp_no) {
}
}
var sel_chan = nil;
var sel_crs = nil;
var mod1 = nil;
var mod = nil;
var mem = nil;
var transfer = func(rmp_no) {
rmp_no = rmp_no - 1;
var sel_chan = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/sel_chan");
var sel_crs = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs");
sel_chan = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/sel_chan");
sel_crs = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs");
if (string.match(sel_chan, "vhf[1-3]")) {
var data_mode = vhf3_data_mode.getValue();
data_mode = vhf3_data_mode.getValue();
if (string.match(sel_chan, "vhf3")) {
if (data_mode == 0) {
vhf3_data_mode.setValue(1);
@ -415,41 +429,41 @@ var transfer = func(rmp_no) {
update_stby_freq(2, 3);
}
}
var mod1 = int(string.replace(sel_chan, "vhf", ""));
var mod = mod1 - 1;
mod1 = int(string.replace(sel_chan, "vhf", ""));
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"));
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);
} elsif (string.match(sel_chan, "hf[1-2]")) {
var mod1 = int(string.replace(sel_chan, "hf", ""));
var mod = mod1 - 1;
mod1 = int(string.replace(sel_chan, "hf", ""));
mod = mod1 - 1;
var mem = systems.HFS[mod].selectedChannelKhz;
mem = systems.HFS[mod].selectedChannelKhz;
systems.HFS[mod].selectChannel(getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/hf" ~ mod1 ~ "-standby"));
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/hf" ~ 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);
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("/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("/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("/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("/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);
}