1
0
Fork 0

Merge branch 'comm' into dev

This commit is contained in:
legoboyvdlp R 2020-04-21 20:24:20 +01:00
commit c5b2352fad
12 changed files with 493 additions and 76 deletions

View file

@ -959,6 +959,14 @@
<dc-bat-three-minutes type="bool">0</dc-bat-three-minutes>
<start type="bool">0</start>
</apu>
<comm>
<hf>
<reception-1 type="bool">1</reception-1>
<reception-2 type="bool">1</reception-2>
<tone1000hz-1 type="bool">0</tone1000hz-1>
<tone1000hz-2 type="bool">0</tone1000hz-2>
</hf>
</comm>
<electrical n="0">
<bus>
<dc-1 type="double">0</dc-1>
@ -1536,7 +1544,14 @@
<not><property>/FMGC/keyboard-right</property></not>
</condition>
<command>nasal</command>
<script>space(1, modifiers.getValue())</script>
<script>
space(1, modifiers.getValue());
if (getprop("systems/audio/acp[0]/call_chan") == "hf1") {
systems.HFS[0].pttToggle();
} elsif (getprop("systems/audio/acp[0]/call_chan") == "hf2") {
systems.HFS[1].pttToggle();
}
</script>
</binding>
<mod-up>
<binding>
@ -1545,7 +1560,14 @@
<not><property>/FMGC/keyboard-right</property></not>
</condition>
<command>nasal</command>
<script>space(0, modifiers.getValue())</script>
<script>
space(0, modifiers.getValue());
if (getprop("systems/audio/acp[0]/call_chan") == "hf1") {
systems.HFS[0].pttToggle();
} elsif (getprop("systems/audio/acp[0]/call_chan") == "hf2") {
systems.HFS[1].pttToggle();
}
</script>
</binding>
</mod-up>
<mod-shift>
@ -3924,6 +3946,7 @@
<file>Aircraft/A320-family/Nasal/Systems/ADIRS/ADIRS.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/ADIRS/ADR.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/ADIRS/SwitchingPanel.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/Comm/HF.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/fire.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/brakes.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/brakesystem.nas</file>

View file

@ -6,6 +6,19 @@
<path>res/Audio.ac</path>
<!-- Headset show/hide on Audio Control Panel(click on body) -->
<animation>
<type>pick</type>
<object-name>audio_body</object-name>
<action>
<button>0</button>
<binding>
<command>property-toggle</command>
<property>controls/audio/headset-toggle</property>
</binding>
</action>
</animation>
<!-- INT/RAD switch -->
<animation>
<type>pick</type>
@ -1083,7 +1096,7 @@
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>audio_vhf2_led</object-name>
@ -1106,7 +1119,7 @@
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>audio_vhf3_led</object-name>
@ -1129,7 +1142,7 @@
</or>
</condition>
</animation>
<animation>
<name>Panel lighting</name>
<type>material</type>
@ -1149,7 +1162,7 @@
<object-name>audio_glare</object-name>
<object-name>audio_int_rad</object-name>
</effect>
<animation>
<type>select</type>
<object-name>audio_hf1_led</object-name>
@ -1172,7 +1185,7 @@
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>audio_hf2_led</object-name>
@ -1195,7 +1208,7 @@
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>audio_mech_led</object-name>

View file

@ -484,8 +484,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[0]/hf1-standby</property>
<step>1</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
</binding>
@ -509,8 +509,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[0]/hf2-standby</property>
<step>1</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
</binding>
@ -750,8 +750,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[0]/hf1-standby</property>
<step>-1</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
</binding>
@ -775,8 +775,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[0]/hf2-standby</property>
<step>-1</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
</binding>
@ -894,8 +894,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[0]/hf1-standby</property>
<step>100</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
<mask>integer</mask>
</binding>
@ -920,8 +920,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[0]/hf2-standby</property>
<step>100</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
<mask>integer</mask>
</binding>
@ -1036,8 +1036,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[0]/hf1-standby</property>
<step>-100</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
<mask>integer</mask>
</binding>
@ -1062,8 +1062,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[0]/hf2-standby</property>
<step>-100</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
<mask>integer</mask>
</binding>

View file

@ -484,8 +484,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[1]/hf1-standby</property>
<step>1</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
</binding>
@ -509,8 +509,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[1]/hf2-standby</property>
<step>1</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
</binding>
@ -750,8 +750,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[1]/hf1-standby</property>
<step>-1</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
</binding>
@ -775,8 +775,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[1]/hf2-standby</property>
<step>-1</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
</binding>
@ -894,8 +894,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[1]/hf1-standby</property>
<step>100</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
<mask>integer</mask>
</binding>
@ -920,8 +920,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[1]/hf2-standby</property>
<step>100</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
<mask>integer</mask>
</binding>
@ -1036,8 +1036,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[1]/hf1-standby</property>
<step>-100</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
<mask>integer</mask>
</binding>
@ -1062,8 +1062,8 @@
<command>property-adjust</command>
<property>systems/radio/rmp[1]/hf2-standby</property>
<step>-100</step>
<min>200</min>
<max>1800</max>
<min>2000</min>
<max>29999</max>
<wrap>true</wrap>
<mask>integer</mask>
</binding>

View file

@ -25,6 +25,8 @@ var stallVoice = props.globals.initNode("/sim/sound/warnings/stall-voice", 0, "B
var engOpt = props.globals.getNode("options/eng", 1);
# local variables
var transmitFlag1 = 0;
var transmitFlag2 = 0;
var phaseVar = nil;
var dualFailFACActive = 1;
var emerConfigFACActive = 1;
@ -1291,6 +1293,18 @@ var messages_priority_2 = func {
} else {
ECAM_controller.warningReset(crgFwdFireDetFault);
}
if (hf1Emitting.clearFlag == 0 and transmitFlag1) {
hf1Emitting.active = 1;
} else {
ECAM_controller.warningReset(hf1Emitting);
}
if (hf2Emitting.clearFlag == 0 and transmitFlag2) {
hf2Emitting.active = 1;
} else {
ECAM_controller.warningReset(hf2Emitting);
}
}
var messages_priority_1 = func {

View file

@ -252,6 +252,11 @@ var warnings = std.Vector.new([
var apuLoopBFault = warning.new(msg: "APU FIRE LOOP B FAULT", colour: "a", isMainMsg: 1),
var crgFwdFireDetFault = warning.new(msg: "FWD CRG DET FAULT", colour: "a", isMainMsg: 1),
var crgAftFireDetFault = warning.new(msg: "AFT CRG DET FAULT", colour: "a", isMainMsg: 1),
# Radios
var hf1Emitting = warning.new(msg: "COM HF 1 EMITTING", colour: "a", aural: 1, light: 1, isMainMsg: 1),
var hf2Emitting = warning.new(msg: "COM HF 2 EMITTING", colour: "a", aural: 1, light: 1, isMainMsg: 1),
# Recall
var recallNormal = warning.new(msg: " ", colour: "g", isMainMsg: 1),
var recallNormal1 = warning.new(msg: " ", colour: "g", isMainMsg: 1),

View file

@ -5,6 +5,22 @@
# Copyright (c) merspieler #
############################
var genFourRand = func() {
var sequence = int(rand() * 10) ~ int(rand() * 10) ~ int(rand() * 10) ~ int(rand() * 10);
while (sequence < 2000 or sequence > 10000) {
sequence = int(rand() * 10) ~ int(rand() * 10) ~ int(rand() * 10) ~ int(rand() * 10);
}
return sequence;
}
var genFiveRand = func() {
var sequence = int(rand() * 10) ~ int(rand() * 10) ~ int(rand() * 10) ~ int(rand() * 10) ~ int(rand() * 10);
while (sequence < 10000 or sequence > 29999) {
sequence = int(rand() * 10) ~ int(rand() * 10) ~ int(rand() * 10) ~ int(rand() * 10) ~ int(rand() * 10);
}
return sequence;
}
# GLOBAL TODO add stuff for HF1, HF2, VOR, LS and ADF
var chan_rmp1_v = "vhr1";
@ -15,23 +31,37 @@ 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");
if (rand() > 0.5) {
var hf1 = genFourRand();
var hf2 = genFiveRand();
} else {
var hf1 = genFiveRand();
var hf2 = genFourRand();
}
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");
var stby_rmp1_vhf2 = props.globals.initNode("/systems/radio/rmp[0]/vhf2-standby", 122.6, "DOUBLE");
var stby_rmp1_vhf3 = props.globals.initNode("/systems/radio/rmp[0]/vhf3-standby", 123.2, "DOUBLE");
var stby_rmp1_hf1 = props.globals.initNode("/systems/radio/rmp[0]/hf1-standby", hf1, "DOUBLE");
var stby_rmp1_hf2 = props.globals.initNode("/systems/radio/rmp[0]/hf2-standby", hf2, "DOUBLE");
var act_display_rmp2 = props.globals.initNode("/controls/radio/rmp[1]/active-display", "119.400", "STRING");
var stby_display_rmp2 = props.globals.initNode("/controls/radio/rmp[1]/standby-display", "122.600", "STRING");
var stby_rmp2_vhf1 = props.globals.initNode("/systems/radio/rmp[1]/vhf1-standby", 121.4, "DOUBLE");
var stby_rmp2_vhf2 = props.globals.initNode("/systems/radio/rmp[1]/vhf2-standby", 122.6, "DOUBLE");
var stby_rmp2_vhf3 = props.globals.initNode("/systems/radio/rmp[1]/vhf3-standby", 123.2, "DOUBLE");
var stby_rmp2_hf1 = props.globals.initNode("/systems/radio/rmp[1]/hf1-standby", hf1, "DOUBLE");
var stby_rmp2_hf2 = props.globals.initNode("/systems/radio/rmp[1]/hf2-standby", hf2, "DOUBLE");
var act_display_rmp3 = props.globals.initNode("/controls/radio/rmp[2]/active-display", "data", "STRING");
var stby_display_rmp3 = props.globals.initNode("/controls/radio/rmp[2]/standby-display", "123.200", "STRING");
var stby_rmp3_vhf1 = props.globals.initNode("/systems/radio/rmp[2]/vhf1-standby", 121.4, "DOUBLE");
var stby_rmp3_vhf2 = props.globals.initNode("/systems/radio/rmp[2]/vhf2-standby", 122.6, "DOUBLE");
var stby_rmp3_vhf3 = props.globals.initNode("/systems/radio/rmp[2]/vhf3-standby", 123.2, "DOUBLE");
var stby_rmp3_hf1 = props.globals.initNode("/systems/radio/rmp[2]/hf1-standby", hf1, "DOUBLE");
var stby_rmp3_hf2 = props.globals.initNode("/systems/radio/rmp[2]/hf2-standby", hf2, "DOUBLE");
var chan_rmp1 = props.globals.initNode("/systems/radio/rmp[0]/sel_chan", "vhf1", "STRING");
var chan_rmp2 = props.globals.initNode("/systems/radio/rmp[1]/sel_chan", "vhf2", "STRING");
@ -50,11 +80,6 @@ var am_mode_rmp2 = props.globals.initNode("/systems/radio/rmp[1]/am-active", 0,
var am_mode_rmp3 = props.globals.initNode("/systems/radio/rmp[2]/am-active", 0, "BOOL");
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);
}
chan_rmp1.setValue("vhf1");
chan_rmp2.setValue("vhf2");
chan_rmp3.setValue("vhf3");
@ -164,17 +189,49 @@ 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);
if (sel1 == "hf1") {
act_display_rmp1.setValue(act);
}
if (sel2 == "hf1") {
act_display_rmp2.setValue(act);
}
if (sel3 == "hf1") {
act_display_rmp3.setValue(act);
}
}
} else if (vhf == 5) {
if (sel1 == "hf2" or sel2 == "hf2") {
var act = sprintf("%5.0f", systems.HFS[1].selectedChannelKhz);
if (sel1 == "hf2") {
act_display_rmp1.setValue(act);
}
if (sel2 == "hf2") {
act_display_rmp2.setValue(act);
}
if (sel3 == "hf2") {
act_display_rmp3.setValue(act);
}
}
}
};
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());
} else if (freq == 4) {
var stby = sprintf("%5.0f", stby_rmp1_hf1.getValue());
} else if (freq == 5) {
var stby = sprintf("%5.0f", stby_rmp1_hf2.getValue());
}
if (stby == 0) {
@ -183,12 +240,16 @@ 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());
} else if (freq == 4) {
var stby = sprintf("%5.0f", stby_rmp2_hf1.getValue());
} else if (freq == 5) {
var stby = sprintf("%5.0f", stby_rmp2_hf2.getValue());
}
if (stby == 0) {
@ -197,12 +258,16 @@ 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());
} else if (freq == 4) {
var stby = sprintf("%5.0f", stby_rmp3_hf1.getValue());
} else if (freq == 5) {
var stby = sprintf("%5.0f", stby_rmp3_hf2.getValue());
}
if (stby == 0) {
@ -217,33 +282,47 @@ 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);
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 (chan == "hf1") {
update_stby_freq(rmp_no, 4);
} else if (chan == "hf2") {
update_stby_freq(rmp_no, 5);
}
} 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 if (chan == "hf1") {
update_stby_freq(rmp_no, 4);
} else if (chan == "hf2") {
update_stby_freq(rmp_no, 5);
}
} 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);
} else if (chan == "hf1") {
update_stby_freq(rmp_no, 4);
} else if (chan == "hf2") {
update_stby_freq(rmp_no, 5);
}
}
}
@ -259,43 +338,74 @@ var transfer = func(rmp_no) {
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);
} elsif (string.match(sel_chan, "hf[1-2]")) {
var mod1 = int(string.replace(sel_chan, "hf", ""));
var mod = mod1 - 1;
var 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);
}
}
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[0]/hf1-standby", func {
update_stby_freq(0, 4);
});
setlistener("/systems/radio/rmp[0]/hf2-standby", func {
update_stby_freq(0, 5);
});
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[1]/hf1-standby", func {
update_stby_freq(1, 4);
});
setlistener("/systems/radio/rmp[1]/hf2-standby", func {
update_stby_freq(3, 5);
});
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("/systems/radio/rmp[2]/hf1-standby", func {
update_stby_freq(2, 4);
});
setlistener("/systems/radio/rmp[2]/hf2-standby", func {
update_stby_freq(2, 5);
});
setlistener("/instrumentation/comm[0]/frequencies/selected-mhz", func {

View file

@ -244,6 +244,7 @@ var systemsLoop = maketimer(0.1, func {
fcu.FCUController.loop();
dmc.DMController.loop();
systems.APUController.loop();
systems.HFLoop();
if ((getprop("controls/pneumatic/switches/groundair") or getprop("controls/electrical/ground-cart")) and ((getprop("velocities/groundspeed-kt") > 2) or (getprop("controls/gear/brake-parking") == 0 and getprop("services/chocks/nose") == 0 and getprop("services/chocks/left") == 0 and getprop("services/chocks/right") == 0))) {
setprop("controls/electrical/ground-cart", 0);

181
Nasal/Systems/Comm/HF.nas Normal file
View file

@ -0,0 +1,181 @@
# A3XX High Frequency Radio
# Jonathan Redpath
# Copyright (c) 2020 Josh Davidson (Octal450)
var highFrequencyRadio = {
overrideDataLink: 0,
datalinkConnected: 0,
new: func(powerNode, num) {
var a = { parents:[highFrequencyRadio] };
a.powerNode = powerNode;
a.selectedChannelKhz = int(rand() * 10) ~ int(rand() * 10) ~ int(rand() * 10) ~ int(rand() * 10);
a.num = num;
a.receptionProp = props.globals.getNode("/systems/comm/hf/reception-" ~ (num + 1));
a.toneControl = props.globals.getNode("/systems/comm/hf/tone1000hz-" ~ (num + 1));
a._toneTime = nil;
a._transmitTime = nil;
a.transmit = 0;
a.tuned = 0;
return a;
},
selectChannel: func(selectedKhz) {
if (selectedKhz < 2000 or selectedKhz > 29999) { return; }
if (selectedKhz - int(selectedKhz) != 0) { return; }
me.selectedChannelKhz = selectedKhz;
me.tuned = 0;
rmp.update_active_vhf(me.num + 4);
},
pttToggle: func() {
if (me.powerNode.getValue() < 110) {
me.transmit = 0;
return;
}
if (me.transmit) {
me.transmit = 0;
me.receptionProp.setValue(1);
} else {
me.transmit = 1;
me.receptionProp.setValue(0);
}
if (me.transmit) {
me._transmitTime = pts.Sim.Time.elapsedSec.getValue();
if (me.num == 0) {
transmitTimer1.start();
} else {
transmitTimer2.start();
}
if (me.selectedChannelKhz < 2800 or me.selectedChannelKhz > 23999) {
me.generate1000Hz();
return;
}
if (!me.tuned) {
me.generate1000Hz(5);
me.tuned = 1;
}
} else {
if (me.num == 0) {
transmitTimer1.stop();
} else {
transmitTimer2.stop();
}
if (me.num == 0) {
ecam.transmitFlag1 = 0;
} else {
ecam.transmitFlag2 = 0;
}
if (me._toneTime == nil) {
me.toneControl.setValue(0);
}
me._transmitTime = nil;
}
},
monitorPTT: func() {
if (me.transmit) {
if (pts.Sim.Time.elapsedSec.getValue() > me._transmitTime + 60) {
if (me.num == 0) {
ecam.transmitFlag1 = 1;
} else {
ecam.transmitFlag2 = 1;
}
}
}
},
generate1000Hz: func(timeSec = 0) {
if (timeSec == 0) {
me.toneControl.setValue(1);
} else {
me.toneControl.setValue(1);
me._toneTime = pts.Sim.Time.elapsedSec.getValue() + timeSec;
if (me.num == 0) {
toneTimer1.start();
} else {
toneTimer2.start();
}
}
},
datalink: func() {
if (me.powerNode.getValue() < 115) {
me.datalinkConnected = 0;
return;
}
if (overrideConnected or !pts.Gear.wow[0].getValue()) {
datalinkConnected = 1;
} else {
datalinkConnected = 0;
}
},
};
var HFS = [highFrequencyRadio.new(systems.ELEC.Bus.acEssShed, 0), highFrequencyRadio.new(systems.ELEC.Bus.ac2, 1)];
# Can't use setlistener on the voltage as it always gets written to by JSB (and changes according to engine rpm)
var update_items_HF_radio = [
props.UpdateManager.FromProperty("/systems/electrical/bus/ac-ess-shed", 0.1, func(notification)
{
if (systems.ELEC.Bus.acEssShed.getValue() < 110) {
HFS[0].transmit = 0;
HFS[0].receptionProp.setValue(0);
toneTimer1.stop();
transmitTimer1.stop();
HFS[0].toneControl.setValue(0);
HFS[0]._toneTime = nil;
ecam.transmitFlag1 = 0;
} else {
HFS[0].receptionProp.setValue(1);
}
}
),
props.UpdateManager.FromProperty("/systems/electrical/bus/ac-2", 0.1, func(notification)
{
if (systems.ELEC.Bus.ac2.getValue() < 110) {
HFS[1].transmit = 0;
HFS[1].receptionProp.setValue(0);
toneTimer2.stop();
transmitTimer2.stop();
HFS[1].toneControl.setValue(0);
HFS[1]._toneTime = nil;
ecam.transmitFlag2 = 0;
} else {
HFS[1].receptionProp.setValue(1);
}
}
),
];
var HFLoop = func() {
foreach (var update_item_HF; update_items_HF_radio) {
update_item_HF.update(nil);
}
}
var toneTimer1 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > HFS[0]._toneTime) {
HFS[0].toneControl.setValue(0);
HFS[0]._toneTime = nil;
toneTimer1.stop();
}
});
var toneTimer2 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > HFS[1]._toneTime) {
HFS[1].toneControl.setValue(0);
HFS[1]._toneTime = nil;
toneTimer2.stop();
}
});
var transmitTimer1 = maketimer(1, func() {
HFS[0].monitorPTT();
});
var transmitTimer2 = maketimer(1, func() {
HFS[1].monitorPTT();
});

View file

@ -1470,6 +1470,76 @@
</volume>
</cvrtone>
<hftone>
<name>HF PTT tone</name>
<mode>looped</mode>
<path>Aircraft/A320-family/Sounds/Cockpit/1000hz.wav</path>
<condition>
<and>
<property>/sim/current-view/internal</property>
<property>/systems/comm/hf/tone1000hz-1</property>
<property>/controls/audio/acp[0]/hf1-recive</property>
</and>
</condition>
<volume>
<property>controls/audio/acp[0]/hf1-volume</property>
<factor>0.4</factor>
</volume>
</hftone>
<hftone>
<name>HF PTT tone 2</name>
<mode>looped</mode>
<path>Aircraft/A320-family/Sounds/Cockpit/1000hz.wav</path>
<condition>
<and>
<property>/sim/current-view/internal</property>
<property>/systems/comm/hf/tone1000hz-2</property>
<property>/controls/audio/acp[0]/hf2-recive</property>
</and>
</condition>
<volume>
<property>controls/audio/acp[0]/hf2-volume</property>
<factor>0.4</factor>
</volume>
</hftone>
<hfstatic>
<name>HF static</name>
<mode>looped</mode>
<path>Aircraft/A320-family/Sounds/Cockpit/hf-radio-static.wav</path>
<condition>
<and>
<property>/sim/current-view/internal</property>
<property>/systems/comm/hf/reception-1</property>
<property>/controls/audio/acp[0]/hf1-recive</property>
<not><property>/systems/comm/hf/tone1000hz-1</property></not>
</and>
</condition>
<volume>
<property>controls/audio/acp[0]/hf1-volume</property>
<factor>0.4</factor>
</volume>
</hfstatic>
<hfstatic>
<name>HF static 2</name>
<mode>looped</mode>
<path>Aircraft/A320-family/Sounds/Cockpit/hf-radio-static.wav</path>
<condition>
<and>
<property>/sim/current-view/internal</property>
<property>/systems/comm/hf/reception-2</property>
<property>/controls/audio/acp[0]/hf2-recive</property>
<not><property>/systems/comm/hf/tone1000hz-2</property></not>
</and>
</condition>
<volume>
<property>controls/audio/acp[0]/hf2-volume</property>
<factor>0.4</factor>
</volume>
</hfstatic>
<relay>
<name>RelayBatt1</name>
<mode>once</mode>

BIN
Sounds/Cockpit/1000hz.wav Normal file

Binary file not shown.

Binary file not shown.