1
0
Fork 0

HF simulation: add class, static noises, and tuning. Interface with RMP

This commit is contained in:
legoboyvdlp R 2020-04-21 13:07:47 +01:00
parent 0462960737
commit 6c1c255a98
5 changed files with 150 additions and 2 deletions

View file

@ -959,6 +959,11 @@
<dc-bat-three-minutes type="bool">0</dc-bat-three-minutes>
<start type="bool">0</start>
</apu>
<comm>
<hf>
<tone1000hz type="bool">0</tone1000hz>
</hf>
</comm>
<electrical n="0">
<bus>
<dc-1 type="double">0</dc-1>
@ -1529,7 +1534,10 @@
<not><property>/FMGC/keyboard-right</property></not>
</condition>
<command>nasal</command>
<script>space(1, modifiers.getValue())</script>
<script>
space(1, modifiers.getValue());
systems.HFS[0].pttToggle();
</script>
</binding>
<mod-up>
<binding>
@ -1538,7 +1546,10 @@
<not><property>/FMGC/keyboard-right</property></not>
</condition>
<command>nasal</command>
<script>space(0, modifiers.getValue())</script>
<script>
space(0, modifiers.getValue());
systems.HFS[0].pttToggle();
</script>
</binding>
</mod-up>
<mod-shift>
@ -3917,6 +3928,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>

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

@ -0,0 +1,100 @@
# A3XX High Frequency Radio
# Jonathan Redpath
# Copyright (c) 2020 Josh Davidson (Octal450)
var toneControl = props.globals.getNode("/systems/comm/hf/tone1000hz");
var reception = props.globals.getNode("/systems/comm/hf/reception");
var _toneTime = nil;
var highFrequencyRadio = {
selectedChannelKhz: -9999,
transmit: 0,
tuned: 0,
overrideDataLink: 0,
datalinkConnected: 0,
_transmitTime: nil,
new: func(powerNode) {
var a = { parents:[highFrequencyRadio] };
a.powerNode = powerNode;
me.selectChannel(2800);
return a;
},
selectChannel: func(selectedKhz) {
if (selectedKhz < 2000 or selectedKhz > 29999) { return; }
if (selectedKhz - int(selectedKhz) != 0) { return; }
me.selectedChannelKhz = selectedKhz;
me.tuned = 0;
},
pttToggle: func() {
if (me.powerNode.getValue() < 110) {
me.transmit = 0;
return;
}
if (me.transmit) {
me.transmit = 0;
reception.setValue(1);
} else {
me.transmit = 1;
reception.setValue(0);
}
if (me.transmit) {
_transmitTime = pts.Sim.Time.elapsedSec.getValue();
if (me.selectedChannelKhz < 2800 or me.selectedChannelKhz > 23999) {
me.generate1000Hz();
return;
}
if (!me.tuned) {
me.generate1000Hz(5);
me.tuned = 1;
}
} else {
ecam.transmitFlag = 0;
if (_toneTime == nil) {
toneControl.setValue(0);
}
_transmitTime = nil;
}
},
monitorPTT: func() {
if (transmit) {
if (pts.Sim.Time.elapsedSec.getValue() > _transmitTime + 60) {
ecam.transmitFlag = 1;
}
}
},
generate1000Hz: func(timeSec = 0) {
if (timeSec == 0) {
toneControl.setValue(1);
} else {
toneControl.setValue(1);
_toneTime = pts.Sim.Time.elapsedSec.getValue() + timeSec;
toneTimer.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), highFrequencyRadio.new(systems.ELEC.Bus.ac2)];
var toneTimer = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > _toneTime) {
toneControl.setValue(0);
_toneTime = nil;
toneTimer.stop();
}
});

View file

@ -1383,6 +1383,42 @@
</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>
<equals>
<property>/systems/comm/hf/tone1000hz</property>
<value>1</value>
</equals>
</and>
</condition>
<volume>
<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>
<equals>
<property>/systems/comm/hf/reception</property>
<value>1</value>
</equals>
</and>
</condition>
<volume>
<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.