1
0
Fork 0

Add support for FGCom multiple radio support

PTT now in

/controls/radios/comm-ptt as an int; non zero indicates which comm radio to use

/comm-radio-selected is the default comm channel to use. This should usually be the same as will be set by PTT into /controls/radios/comm-ptt

NOTE: that PTT will switch the FG comm inbound and outbound frequency to whichever radio was PTT'd.
This commit is contained in:
Richard Harrison 2019-03-19 21:15:58 +01:00
parent aaa2c0cffb
commit 4c6b103293
5 changed files with 58 additions and 6 deletions

View file

@ -561,7 +561,25 @@ var weaponSelect = func(d) {
##
# Communication.
#
var ptt = func(b) setprop("/instrumentation/comm/ptt", b);
var ptt = func(b) setprop("/controls/radios/comm-ptt", b);
_setlistener("/instrumentation/comm[0]/ptt", func {
var v=getprop("/instrumentation/comm[0]/ptt");
setprop("/controls/radios/comm-radio-selected", 1);
if (v.getValue())
setprop("/controls/radios/comm-ptt", 1);
else
setprop("/controls/radios/comm-ptt", 0);
});
_setlistener("/instrumentation/comm[1]/ptt", func {
var v=getprop("/instrumentation/comm[1]/ptt");
setprop("/controls/radios/comm-radio-selected", 2);
if (v.getValue())
setprop("/controls/radios/comm-ptt", 2);
else
setprop("/controls/radios/comm-ptt", 0);
});
##
# Lighting.

View file

@ -541,6 +541,7 @@ var buttonBindings = [
NasalButton.new("Aileron Trim Left", "controls.aileronTrim(-1);", 1),
NasalButton.new("Aileron Trim Right", "controls.aileronTrim(1);", 1),
NasalHoldButton.new("FGCom PTT", "controls.ptt(1);", "controls.ptt(0);"),
NasalHoldButton.new("FGCom PTT(2)", "controls.ptt(2);", "controls.ptt(0);"),
NasalHoldButton.new("Trigger", "controls.trigger(1);", "controls.trigger(0);"),
NasalHoldButton.new("Pickle", "controls.applyPickle(1);","controls.applyPickle(0);"),
NasalButton.new("Flaps Up", "controls.flapsDown(-1);",0),

View file

@ -917,6 +917,7 @@ Started September 2000 by David Megginson, david@megginson.com
<performance-monitor>
<enabled type="bool" userarchive="n" preserve="y">false</enabled>
<interval-s type="double" userarchive="n" preserve="y">1.0</interval-s>
<max-time-per-frame-ms type="int" userarchive="n" preserve="y">7</max-time-per-frame-ms>
</performance-monitor>
<!-- animated jetway options -->
<jetways>
@ -1090,6 +1091,16 @@ Started September 2000 by David Megginson, david@megginson.com
<beacon type="bool">true</beacon>
<strobe type="bool">false</strobe>
</lighting>
<radios>
<!--New for 2019.1 - the ability to select the comm radio frequency used by fgcom.
The active (transmitting frequency) will also be sent over MP to allow RDF by other MP models.
Both comm-ptt and comm-radio-selected should be set to the same value as fgcom only currently permits
single channel operation.
0 = off, otherwise comm radio selected (/instrumentation/comm[0] it will be 1)
-->
<comm-ptt type="int">0</comm-ptt>
<comm-radio-selected type="int">1</comm-radio-selected>
</radios>
<anti-ice>
<pitot-heat type="bool">false</pitot-heat>
<engine n="0">

View file

@ -413,7 +413,7 @@ var assignButton = func(cmd) {
<row>5</row>
<col>3</col>
<halign>fill</halign>
<legend>FGCom PTT</legend>
<legend>FGCom PTT(1)</legend>
<binding>
<command>nasal</command>
<script>
@ -426,6 +426,19 @@ var assignButton = func(cmd) {
<row>6</row>
<col>3</col>
<halign>fill</halign>
<legend>FGCom PTT(2)</legend>
<binding>
<command>nasal</command>
<script>
assignButton("FGCom PTT(2)");
</script>
</binding>
</button>
<button>
<row>7</row>
<col>3</col>
<halign>fill</halign>
<legend>Trigger</legend>
<binding>
<command>nasal</command>
@ -436,7 +449,7 @@ var assignButton = func(cmd) {
</button>
<button>
<row>7</row>
<row>8</row>
<col>3</col>
<halign>fill</halign>
<legend>Custom</legend>
@ -449,7 +462,7 @@ var assignButton = func(cmd) {
</button>
<button>
<row>8</row>
<row>9</row>
<col>3</col>
<halign>fill</halign>
<legend>NWS toggle</legend>

View file

@ -249,7 +249,7 @@
</equals>
</enable>
<live>1</live>
<property>/instrumentation/comm[0]/ptt</property>
<property>/controls/radios/comm-ptt</property>
<binding>
<command>dialog-apply</command>
<object-name>ptt-test</object-name>
@ -258,7 +258,16 @@
<text>
<row>4</row>
<col>1</col>
<label> (/instrumentation/comm/ptt) </label>
<label> 1</label>
<format> %.0f</format>
<live>true</live>
<halign>left</halign>
<property>/controls/radios/comm-ptt</property>
</text>
<text>
<row>4</row>
<col>1</col>
<label> (/controls/radios/comm-ptt) </label>
<halign>left</halign>
</text>