Added functionality to the RMP. VHF1 + VHF2 fully working
Signed-off-by: merspieler <merspieler@airmail.cc>
This commit is contained in:
parent
2f4c68389e
commit
cafa1d6001
6 changed files with 3260 additions and 24 deletions
|
@ -1547,6 +1547,9 @@
|
|||
<autopush_route>
|
||||
<file>Aircraft/IDG-A32X/Nasal/autopush_route.nas</file>
|
||||
</autopush_route>
|
||||
<rmp>
|
||||
<file>Aircraft/IDG-A32X/Models/Instruments/Radio/Radio.nas</file>
|
||||
</rmp>
|
||||
</nasal>
|
||||
|
||||
</PropertyList>
|
||||
|
|
|
@ -488,19 +488,7 @@
|
|||
<object-name>master_caution_on</object-name>
|
||||
<object-name>master_warning_on</object-name>
|
||||
<object-name>qnh-test</object-name>
|
||||
<object-name>radio_adf_led</object-name>
|
||||
<object-name>radio_am_led</object-name>
|
||||
<object-name>radio_bfo_led</object-name>
|
||||
<object-name>radio_hf1_led</object-name>
|
||||
<object-name>radio_hf2_led</object-name>
|
||||
<object-name>radio_ls_led</object-name>
|
||||
<object-name>radio_nav_led</object-name>
|
||||
<object-name>radio_opt_led</object-name>
|
||||
<object-name>radio_sel_led</object-name>
|
||||
<object-name>radio_vhf1_led</object-name>
|
||||
<object-name>radio_vhf2_led</object-name>
|
||||
<object-name>radio_vhf3_led</object-name>
|
||||
<object-name>radio_vor_led</object-name>
|
||||
<object-name>rudder-trim-test</object-name>
|
||||
<object-name>spd-text-test</object-name>
|
||||
<object-name>terr_on_nd_on</object-name>
|
||||
|
|
234
Models/Instruments/Radio/Radio.nas
Normal file
234
Models/Instruments/Radio/Radio.nas
Normal file
|
@ -0,0 +1,234 @@
|
|||
# A3XX Radio Managment Panel
|
||||
# merspieler
|
||||
|
||||
############################
|
||||
# Copyright (c) merspieler #
|
||||
############################
|
||||
|
||||
# GLOBAL TODO add stuff for HF1, HF2, VOR, LS and ADF
|
||||
|
||||
var rmp_update = nil;
|
||||
|
||||
var act_vhf1 = props.globals.getNode("/instrumentation/comm[0]/frequencies/selected-mhz-fmt");
|
||||
var act_vhf2 = props.globals.getNode("/instrumentation/comm[1]/frequencies/selected-mhz-fmt");
|
||||
# TODO when VHF3 is available uncomment this
|
||||
#var act_vhf3 = props.globals.getNode("/instrumentation/comm[2]/frequencies/selected-mhz-fmt");
|
||||
|
||||
var act_display_rmp1 = props.globals.initNode("/controls/radio/rmp[0]/active-display", "123.900");
|
||||
var stby_display_rmp1 = props.globals.initNode("/controls/radio/rmp[0]/standby-display", "118.700");
|
||||
var stby_rmp1_vhf1 = props.globals.initNode("/systems/radio/rmp[0]/vhf1-standby", 118.7);
|
||||
var stby_rmp1_vhf2 = props.globals.initNode("/systems/radio/rmp[0]/vhf2-standby", 123.12);
|
||||
var stby_rmp1_vhf3 = props.globals.initNode("/systems/radio/rmp[0]/vhf3-standby", 121.5);
|
||||
|
||||
var act_display_rmp2 = props.globals.initNode("/controls/radio/rmp[1]/active-display", "127.900");
|
||||
var stby_display_rmp2 = props.globals.initNode("/controls/radio/rmp[1]/standby-display", "123.125");
|
||||
var stby_rmp2_vhf1 = props.globals.initNode("/systems/radio/rmp[1]/vhf1-standby", 118.7);
|
||||
var stby_rmp2_vhf2 = props.globals.initNode("/systems/radio/rmp[1]/vhf2-standby", 123.12);
|
||||
var stby_rmp2_vhf3 = props.globals.initNode("/systems/radio/rmp[1]/vhf3-standby", 121.5);
|
||||
|
||||
var act_display_rmp3 = props.globals.initNode("/controls/radio/rmp[2]/active-display", "127.900");
|
||||
var stby_display_rmp3 = props.globals.initNode("/controls/radio/rmp[2]/standby-display", "123.125");
|
||||
var stby_rmp3_vhf1 = props.globals.initNode("/systems/radio/rmp[2]/vhf1-standby", 118.7);
|
||||
var stby_rmp3_vhf2 = props.globals.initNode("/systems/radio/rmp[2]/vhf2-standby", 123.12);
|
||||
var stby_rmp3_vhf3 = props.globals.initNode("/systems/radio/rmp[2]/vhf3-standby", 121.5);
|
||||
|
||||
var chan_rmp1 = props.globals.initNode("/systems/radio/rmp[0]/sel_chan", "vhf1");
|
||||
var chan_rmp2 = props.globals.initNode("/systems/radio/rmp[1]/sel_chan", "vhf2");
|
||||
var chan_rmp3 = props.globals.initNode("/systems/radio/rmp[2]/sel_chan", "vhf3");
|
||||
|
||||
var init = func() {
|
||||
for(var i = 0; i < 3; i += 1) {
|
||||
setprop("/systems/radio/rmp[" ~ i ~ "]/hf1-standby", 510);
|
||||
setprop("/systems/radio/rmp[" ~ i ~ "]/hf2-standby", 891);
|
||||
}
|
||||
|
||||
var rmp_update = maketimer(0.2, func {
|
||||
rmp_refresh.update();
|
||||
});
|
||||
}
|
||||
|
||||
var update_active_vhf = func(vhf) {
|
||||
var sel1 = chan_rmp1.getValue();
|
||||
var sel2 = chan_rmp2.getValue();
|
||||
# In case that a 3rd RMP is added, uncomment the following line and expand the if statements with the sel3 comparison
|
||||
# var sel3 = chan_rmp3.getValue();
|
||||
|
||||
if(vhf == 1) {
|
||||
if(sel1 == "vhf1" or sel2 == "vhf1") {
|
||||
var act = sprintf("%3.3f", act_vhf1.getValue());
|
||||
|
||||
if(sel1 == "vhf1") {
|
||||
act_display_rmp1.setValue(act);
|
||||
}
|
||||
if(sel2 == "vhf1") {
|
||||
act_display_rmp2.setValue(act);
|
||||
}
|
||||
}
|
||||
} else if (vhf == 2) {
|
||||
if(sel1 == "vhf2" or sel2 == "vhf2") {
|
||||
var act = sprintf("%3.3f", act_vhf2.getValue());
|
||||
|
||||
if(sel1 == "vhf2") {
|
||||
act_display_rmp1.setValue(act);
|
||||
}
|
||||
if(sel2 == "vhf2") {
|
||||
act_display_rmp2.setValue(act);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# TODO when VHF3 is available uncomment this
|
||||
# if(sel1 == "vhf2" or sel2 == "vhf2") {
|
||||
# var act = sprintf("%3.3f", act_vhf2.getValue());
|
||||
#
|
||||
# if(sel1 == "vhf2") {
|
||||
# act_display_rmp1.setValue(act);
|
||||
# }
|
||||
# if(sel2 == "vhf2") {
|
||||
# act_display_rmp2.setValue(act);
|
||||
# }
|
||||
# }
|
||||
}
|
||||
};
|
||||
|
||||
var update_stby_vhf = func(rmp_no, vhf) {
|
||||
if(rmp_no == 0) {
|
||||
if(vhf == 1) {
|
||||
var stby = sprintf("%3.3f", stby_rmp1_vhf1.getValue());
|
||||
} else if(vhf == 2) {
|
||||
var stby = sprintf("%3.3f", stby_rmp1_vhf2.getValue());
|
||||
} else {
|
||||
var stby = sprintf("%3.3f", stby_rmp1_vhf3.getValue());
|
||||
}
|
||||
|
||||
stby_display_rmp1.setValue(stby);
|
||||
} else {
|
||||
if(vhf == 1) {
|
||||
var stby = sprintf("%3.3f", stby_rmp2_vhf1.getValue());
|
||||
} else if(vhf == 2) {
|
||||
var stby = sprintf("%3.3f", stby_rmp2_vhf2.getValue());
|
||||
} else {
|
||||
var stby = sprintf("%3.3f", stby_rmp2_vhf3.getValue());
|
||||
}
|
||||
|
||||
stby_display_rmp2.setValue(stby);
|
||||
}
|
||||
}
|
||||
|
||||
var update_chan_sel = func(rmp_no) {
|
||||
update_active_vhf(1);
|
||||
update_active_vhf(2);
|
||||
update_active_vhf(3);
|
||||
|
||||
if(rmp_no == 0) {
|
||||
var chan = chan_rmp1.getValue();
|
||||
if(chan == "vhf1") {
|
||||
update_stby_vhf(rmp_no, 1);
|
||||
} else if(chan == "vhf1") {
|
||||
update_stby_vhf(rmp_no, 2);
|
||||
} else {
|
||||
update_stby_vhf(rmp_no, 3);
|
||||
}
|
||||
} else if(rmp_no == 1) {
|
||||
var chan = chan_rmp2.getValue();
|
||||
if(chan == "vhf1") {
|
||||
update_stby_vhf(rmp_no, 1);
|
||||
} else if(chan == "vhf2") {
|
||||
update_stby_vhf(rmp_no, 2);
|
||||
} else {
|
||||
update_stby_vhf(rmp_no, 3);
|
||||
}
|
||||
} else {
|
||||
# In case that a 3rd RMP is added, uncomment this
|
||||
# var chan = chan_rmp3.getValue();
|
||||
# if(chan == "vhf1") {
|
||||
# update_stby_vhf(rmp_no, 1);
|
||||
# } else if(chan == "vhf2") {
|
||||
# update_stby_vhf(rmp_no, 2);
|
||||
# } else {
|
||||
# update_stby_vhf(rmp_no, 3);
|
||||
# }
|
||||
}
|
||||
}
|
||||
|
||||
var transfer = func(rmp_no) {
|
||||
|
||||
rmp_no = rmp_no - 1;
|
||||
var sel_chan = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/sel_chan");
|
||||
|
||||
if(string.match(sel_chan, "vhf[1-3]")) {
|
||||
var mod1 = int(string.replace(sel_chan, "vhf", ""));
|
||||
var mod = mod1 - 1;
|
||||
|
||||
# TODO remove this IF statement when /instrumentation/comm[2] was added
|
||||
if(mod == 2) { return;}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# In case that a 3rd RMP is added, increase the check in the following 3 loops to `i <= 2`
|
||||
setlistener("/systems/radio/rmp[0]/vhf1-standby", func {
|
||||
update_stby_vhf(0, 1);
|
||||
});
|
||||
|
||||
setlistener("/systems/radio/rmp[0]/vhf2-standby", func {
|
||||
update_stby_vhf(0, 2);
|
||||
});
|
||||
|
||||
setlistener("/systems/radio/rmp[0]/vhf3-standby", func {
|
||||
update_stby_vhf(0, 3);
|
||||
});
|
||||
|
||||
setlistener("/systems/radio/rmp[1]/vhf1-standby", func {
|
||||
update_stby_vhf(1, 1);
|
||||
});
|
||||
|
||||
setlistener("/systems/radio/rmp[1]/vhf2-standby", func {
|
||||
update_stby_vhf(1, 2);
|
||||
});
|
||||
|
||||
setlistener("/systems/radio/rmp[1]/vhf3-standby", func {
|
||||
update_stby_vhf(1, 3);
|
||||
});
|
||||
|
||||
setlistener("/systems/radio/rmp[2]/vhf1-standby", func {
|
||||
update_stby_vhf(0, 1);
|
||||
});
|
||||
|
||||
setlistener("/systems/radio/rmp[2]/vhf2-standby", func {
|
||||
update_stby_vhf(0, 2);
|
||||
});
|
||||
|
||||
setlistener("/systems/radio/rmp[2]/vhf3-standby", func {
|
||||
update_stby_vhf(0, 3);
|
||||
});
|
||||
|
||||
setlistener("/instrumentation/comm[0]/frequencies/selected-mhz", func {
|
||||
update_active_vhf(1);
|
||||
});
|
||||
|
||||
setlistener("/instrumentation/comm[1]/frequencies/selected-mhz", func {
|
||||
update_active_vhf(2);
|
||||
});
|
||||
|
||||
# In case that a 3rd RMP is added, uncomment the following lines
|
||||
#setlistener("/instrumentation/comm[2]/frequencies/selected-mhz", func {
|
||||
# update_active_vhf(2);
|
||||
#});
|
||||
|
||||
setlistener("/systems/radio/rmp[0]/sel_chan", func {
|
||||
update_chan_sel(0);
|
||||
});
|
||||
|
||||
setlistener("/systems/radio/rmp[1]/sel_chan", func {
|
||||
update_chan_sel(1);
|
||||
});
|
||||
|
||||
setlistener("/systems/radio/rmp[2]/sel_chan", func {
|
||||
update_chan_sel(2);
|
||||
});
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -193,6 +193,7 @@ var systemsInit = func {
|
|||
libraries.ECAM.init();
|
||||
libraries.BUTTONS.init();
|
||||
libraries.variousReset();
|
||||
rmp.init();
|
||||
}
|
||||
|
||||
setlistener("/sim/signals/fdm-initialized", func {
|
||||
|
|
Reference in a new issue