diff --git a/A320-main.xml b/A320-main.xml index 1d661ea5..705fb8e9 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -959,6 +959,14 @@ 0 0 + + + 1 + 1 + 0 + 0 + + 0 @@ -1536,7 +1544,14 @@ /FMGC/keyboard-right nasal - + @@ -1545,7 +1560,14 @@ /FMGC/keyboard-right nasal - + @@ -3924,6 +3946,7 @@ Aircraft/A320-family/Nasal/Systems/ADIRS/ADIRS.nas Aircraft/A320-family/Nasal/Systems/ADIRS/ADR.nas Aircraft/A320-family/Nasal/Systems/ADIRS/SwitchingPanel.nas + Aircraft/A320-family/Nasal/Systems/Comm/HF.nas Aircraft/A320-family/Nasal/Systems/fire.nas Aircraft/A320-family/Nasal/Systems/brakes.nas Aircraft/A320-family/Nasal/Systems/brakesystem.nas diff --git a/Models/Instruments/Audio/Audio2.xml b/Models/Instruments/Audio/Audio2.xml index e27d3e1f..7b522908 100644 --- a/Models/Instruments/Audio/Audio2.xml +++ b/Models/Instruments/Audio/Audio2.xml @@ -6,6 +6,19 @@ res/Audio.ac + + + pick + audio_body + + + + property-toggle + controls/audio/headset-toggle + + + + pick @@ -1083,7 +1096,7 @@ - + select audio_vhf2_led @@ -1106,7 +1119,7 @@ - + select audio_vhf3_led @@ -1129,7 +1142,7 @@ - + Panel lighting material @@ -1149,7 +1162,7 @@ audio_glare audio_int_rad - + select audio_hf1_led @@ -1172,7 +1185,7 @@ - + select audio_hf2_led @@ -1195,7 +1208,7 @@ - + select audio_mech_led diff --git a/Models/Instruments/Radio/Radio1.xml b/Models/Instruments/Radio/Radio1.xml index f819d06a..32eacf26 100644 --- a/Models/Instruments/Radio/Radio1.xml +++ b/Models/Instruments/Radio/Radio1.xml @@ -484,8 +484,8 @@ property-adjust systems/radio/rmp[0]/hf1-standby 1 - 200 - 1800 + 2000 + 29999 true @@ -509,8 +509,8 @@ property-adjust systems/radio/rmp[0]/hf2-standby 1 - 200 - 1800 + 2000 + 29999 true @@ -750,8 +750,8 @@ property-adjust systems/radio/rmp[0]/hf1-standby -1 - 200 - 1800 + 2000 + 29999 true @@ -775,8 +775,8 @@ property-adjust systems/radio/rmp[0]/hf2-standby -1 - 200 - 1800 + 2000 + 29999 true @@ -894,8 +894,8 @@ property-adjust systems/radio/rmp[0]/hf1-standby 100 - 200 - 1800 + 2000 + 29999 true integer @@ -920,8 +920,8 @@ property-adjust systems/radio/rmp[0]/hf2-standby 100 - 200 - 1800 + 2000 + 29999 true integer @@ -1036,8 +1036,8 @@ property-adjust systems/radio/rmp[0]/hf1-standby -100 - 200 - 1800 + 2000 + 29999 true integer @@ -1062,8 +1062,8 @@ property-adjust systems/radio/rmp[0]/hf2-standby -100 - 200 - 1800 + 2000 + 29999 true integer diff --git a/Models/Instruments/Radio/Radio2.xml b/Models/Instruments/Radio/Radio2.xml index 2c15b033..88710a14 100644 --- a/Models/Instruments/Radio/Radio2.xml +++ b/Models/Instruments/Radio/Radio2.xml @@ -484,8 +484,8 @@ property-adjust systems/radio/rmp[1]/hf1-standby 1 - 200 - 1800 + 2000 + 29999 true @@ -509,8 +509,8 @@ property-adjust systems/radio/rmp[1]/hf2-standby 1 - 200 - 1800 + 2000 + 29999 true @@ -750,8 +750,8 @@ property-adjust systems/radio/rmp[1]/hf1-standby -1 - 200 - 1800 + 2000 + 29999 true @@ -775,8 +775,8 @@ property-adjust systems/radio/rmp[1]/hf2-standby -1 - 200 - 1800 + 2000 + 29999 true @@ -894,8 +894,8 @@ property-adjust systems/radio/rmp[1]/hf1-standby 100 - 200 - 1800 + 2000 + 29999 true integer @@ -920,8 +920,8 @@ property-adjust systems/radio/rmp[1]/hf2-standby 100 - 200 - 1800 + 2000 + 29999 true integer @@ -1036,8 +1036,8 @@ property-adjust systems/radio/rmp[1]/hf1-standby -100 - 200 - 1800 + 2000 + 29999 true integer @@ -1062,8 +1062,8 @@ property-adjust systems/radio/rmp[1]/hf2-standby -100 - 200 - 1800 + 2000 + 29999 true integer diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 71ad97fb..c19d9bbb 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -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 { diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index ce87f3c0..f3c2e5d9 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -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), diff --git a/Nasal/Panels/rmp.nas b/Nasal/Panels/rmp.nas index d76aa4bc..223add57 100644 --- a/Nasal/Panels/rmp.nas +++ b/Nasal/Panels/rmp.nas @@ -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 { diff --git a/Nasal/Sim/libraries.nas b/Nasal/Sim/libraries.nas index 7c4c0b8f..f974a4a8 100644 --- a/Nasal/Sim/libraries.nas +++ b/Nasal/Sim/libraries.nas @@ -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); diff --git a/Nasal/Systems/Comm/HF.nas b/Nasal/Systems/Comm/HF.nas new file mode 100644 index 00000000..1a4257ff --- /dev/null +++ b/Nasal/Systems/Comm/HF.nas @@ -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(); +}); diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml index 271dee4e..4468afd6 100644 --- a/Sounds/A320-common-sound.xml +++ b/Sounds/A320-common-sound.xml @@ -1470,6 +1470,76 @@ + + HF PTT tone + looped + Aircraft/A320-family/Sounds/Cockpit/1000hz.wav + + + /sim/current-view/internal + /systems/comm/hf/tone1000hz-1 + /controls/audio/acp[0]/hf1-recive + + + + controls/audio/acp[0]/hf1-volume + 0.4 + + + + + HF PTT tone 2 + looped + Aircraft/A320-family/Sounds/Cockpit/1000hz.wav + + + /sim/current-view/internal + /systems/comm/hf/tone1000hz-2 + /controls/audio/acp[0]/hf2-recive + + + + controls/audio/acp[0]/hf2-volume + 0.4 + + + + + HF static + looped + Aircraft/A320-family/Sounds/Cockpit/hf-radio-static.wav + + + /sim/current-view/internal + /systems/comm/hf/reception-1 + /controls/audio/acp[0]/hf1-recive + /systems/comm/hf/tone1000hz-1 + + + + controls/audio/acp[0]/hf1-volume + 0.4 + + + + + HF static 2 + looped + Aircraft/A320-family/Sounds/Cockpit/hf-radio-static.wav + + + /sim/current-view/internal + /systems/comm/hf/reception-2 + /controls/audio/acp[0]/hf2-recive + /systems/comm/hf/tone1000hz-2 + + + + controls/audio/acp[0]/hf2-volume + 0.4 + + + RelayBatt1 once diff --git a/Sounds/Cockpit/1000hz.wav b/Sounds/Cockpit/1000hz.wav new file mode 100644 index 00000000..29c3e243 Binary files /dev/null and b/Sounds/Cockpit/1000hz.wav differ diff --git a/Sounds/Cockpit/hf-radio-static.wav b/Sounds/Cockpit/hf-radio-static.wav new file mode 100644 index 00000000..852be00a Binary files /dev/null and b/Sounds/Cockpit/hf-radio-static.wav differ