Added VHF3 to the RMPs and fixed a few issues

Signed-off-by: merspieler <merspieler@airmail.cc>
This commit is contained in:
merspieler 2018-09-27 16:28:18 +02:00
parent be5aee8fef
commit 8f47d3c037
4 changed files with 340 additions and 28 deletions

View file

@ -9,10 +9,9 @@
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_vhf1 = props.globals.getNode("/instrumentation/comm[0]/frequencies/selected-mhz");
var act_vhf2 = props.globals.getNode("/instrumentation/comm[1]/frequencies/selected-mhz");
var act_vhf3 = props.globals.initNode("/instrumentation/comm[2]/frequencies/selected-mhz", 0);
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");
@ -76,17 +75,16 @@ var update_active_vhf = func(vhf) {
}
}
} 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);
# }
# }
if(sel1 == "vhf3" or sel2 == "vhf3") {
var act = sprintf("%3.3f", act_vhf3.getValue());
if(sel1 == "vhf3") {
act_display_rmp1.setValue(act);
}
if(sel2 == "vhf3") {
act_display_rmp2.setValue(act);
}
}
}
};
@ -159,19 +157,13 @@ var transfer = func(rmp_no) {
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);
});
@ -197,15 +189,15 @@ setlistener("/systems/radio/rmp[1]/vhf3-standby", func {
});
setlistener("/systems/radio/rmp[2]/vhf1-standby", func {
update_stby_vhf(0, 1);
update_stby_vhf(2, 1);
});
setlistener("/systems/radio/rmp[2]/vhf2-standby", func {
update_stby_vhf(0, 2);
update_stby_vhf(2, 2);
});
setlistener("/systems/radio/rmp[2]/vhf3-standby", func {
update_stby_vhf(0, 3);
update_stby_vhf(2, 3);
});
setlistener("/instrumentation/comm[0]/frequencies/selected-mhz", func {
@ -216,10 +208,9 @@ 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("/instrumentation/comm[2]/frequencies/selected-mhz", func {
update_active_vhf(3);
});
setlistener("/systems/radio/rmp[0]/sel_chan", func {
update_chan_sel(0);

View file

@ -318,6 +318,12 @@
<property>systems/radio/rmp[0]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<not>
<equals>
<property>systems/radio/rmp[0]/vhf3-standby</property>
<value>0</value>
</equals>
</not>
</and>
</condition>
<command>property-adjust</command>
@ -455,6 +461,12 @@
<property>systems/radio/rmp[0]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<not>
<equals>
<property>systems/radio/rmp[0]/vhf3-standby</property>
<value>0</value>
</equals>
</not>
</and>
</condition>
<command>property-adjust</command>
@ -594,6 +606,12 @@
<property>systems/radio/rmp[0]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<not>
<equals>
<property>systems/radio/rmp[0]/vhf3-standby</property>
<value>0</value>
</equals>
</not>
</and>
</condition>
<command>property-adjust</command>
@ -730,6 +748,12 @@
<property>systems/radio/rmp[0]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<not>
<equals>
<property>systems/radio/rmp[0]/vhf3-standby</property>
<value>0</value>
</equals>
</not>
</and>
</condition>
<command>property-adjust</command>
@ -1366,6 +1390,18 @@
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
<not>
<and>
<equals>
<property>systems/radio/rmp[0]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<equals>
<property>instrumentation/comm[2]/frequencies/selected-mhz</property>
<value>0</value>
</equals>
</and>
</not>
</and>
</condition>
</animation>
@ -1395,6 +1431,61 @@
</font-resolution>
</text>
<!-- VHF3 Data Mode-->
<animation>
<type>select</type>
<object-name>rmp1-active-vhf3-data</object-name>
<condition>
<and>
<not-equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</not-equals>
<equals>
<property>controls/radio/rmp[0]/on</property>
<value>1</value>
</equals>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
<equals>
<property>systems/radio/rmp[0]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<equals>
<property>instrumentation/comm[2]/frequencies/selected-mhz</property>
<value>0</value>
</equals>
</and>
</condition>
</animation>
<text>
<name>rmp1-active-vhf3-data</name>
<offsets>
<x-m>-0.22190</x-m>
<y-m>-0.21549</y-m>
<z-m>-0.12613</z-m>
<heading-deg>90</heading-deg>
</offsets>
<alignment>center-center</alignment>
<axis-alignment>xy-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">data</format>
<property>autopilot/servicable</property>
<truncate type="bool">false</truncate>
<font type="string">led.txf</font>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.008</character-size>
<font-resolution>
<width type="int">32</width>
<height type="int">32</height>
</font-resolution>
</text>
<!-- Test Illumination-->
<animation>
<type>select</type>
@ -1450,6 +1541,18 @@
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
<not>
<and>
<equals>
<property>systems/radio/rmp[0]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<equals>
<property>systems/radio/rmp[0]/vhf3-standby</property>
<value>0</value>
</equals>
</and>
</not>
</and>
</condition>
</animation>
@ -1479,6 +1582,61 @@
</font-resolution>
</text>
<!-- VHF3 Data Mode-->
<animation>
<type>select</type>
<object-name>rmp1-standby-vhf3-data</object-name>
<condition>
<and>
<not-equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</not-equals>
<equals>
<property>controls/radio/rmp[0]/on</property>
<value>1</value>
</equals>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
<equals>
<property>systems/radio/rmp[0]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<equals>
<property>systems/radio/rmp[0]/vhf3-standby</property>
<value>0</value>
</equals>
</and>
</condition>
</animation>
<text>
<name>rmp1-standby-vhf3-data</name>
<offsets>
<x-m>-0.22190</x-m>
<y-m>-0.14896</y-m>
<z-m>-0.12613</z-m>
<heading-deg>90</heading-deg>
</offsets>
<alignment>center-center</alignment>
<axis-alignment>xy-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">data</format>
<property>autopilot/servicable</property>
<truncate type="bool">false</truncate>
<font type="string">led.txf</font>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.008</character-size>
<font-resolution>
<width type="int">32</width>
<height type="int">32</height>
</font-resolution>
</text>
<!-- Test Illumination-->
<animation>
<type>select</type>

View file

@ -318,6 +318,12 @@
<property>systems/radio/rmp[1]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<not>
<equals>
<property>systems/radio/rmp[1]/vhf3-standby</property>
<value>0</value>
</equals>
</not>
</and>
</condition>
<command>property-adjust</command>
@ -455,6 +461,12 @@
<property>systems/radio/rmp[1]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<not>
<equals>
<property>systems/radio/rmp[1]/vhf3-standby</property>
<value>0</value>
</equals>
</not>
</and>
</condition>
<command>property-adjust</command>
@ -594,6 +606,12 @@
<property>systems/radio/rmp[1]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<not>
<equals>
<property>systems/radio/rmp[1]/vhf3-standby</property>
<value>0</value>
</equals>
</not>
</and>
</condition>
<command>property-adjust</command>
@ -730,6 +748,12 @@
<property>systems/radio/rmp[1]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<not>
<equals>
<property>systems/radio/rmp[1]/vhf3-standby</property>
<value>0</value>
</equals>
</not>
</and>
</condition>
<command>property-adjust</command>
@ -1366,6 +1390,18 @@
<property>systems/electrical/bus/dc2</property>
<value>25</value>
</greater-than-equals>
<not>
<and>
<equals>
<property>systems/radio/rmp[1]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<equals>
<property>instrumentation/comm[2]/frequencies/selected-mhz</property>
<value>0</value>
</equals>
</and>
</not>
</and>
</condition>
</animation>
@ -1395,6 +1431,61 @@
</font-resolution>
</text>
<!-- VHF3 Data Mode-->
<animation>
<type>select</type>
<object-name>rmp2-active-vhf3-data</object-name>
<condition>
<and>
<not-equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</not-equals>
<equals>
<property>controls/radio/rmp[1]/on</property>
<value>1</value>
</equals>
<greater-than-equals>
<property>systems/electrical/bus/dc2</property>
<value>25</value>
</greater-than-equals>
<equals>
<property>systems/radio/rmp[1]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<equals>
<property>instrumentation/comm[2]/frequencies/selected-mhz</property>
<value>0</value>
</equals>
</and>
</condition>
</animation>
<text>
<name>rmp2-active-vhf3-data</name>
<offsets>
<x-m>-0.22190</x-m>
<y-m>-0.21549</y-m>
<z-m>-0.12613</z-m>
<heading-deg>90</heading-deg>
</offsets>
<alignment>center-center</alignment>
<axis-alignment>xy-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">data</format>
<property>autopilot/servicable</property>
<truncate type="bool">false</truncate>
<font type="string">led.txf</font>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.008</character-size>
<font-resolution>
<width type="int">32</width>
<height type="int">32</height>
</font-resolution>
</text>
<!-- Test Illumination-->
<animation>
<type>select</type>
@ -1450,6 +1541,18 @@
<property>systems/electrical/bus/dc2</property>
<value>25</value>
</greater-than-equals>
<not>
<and>
<equals>
<property>systems/radio/rmp[1]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<equals>
<property>systems/radio/rmp[1]/vhf3-standby</property>
<value>0</value>
</equals>
</and>
</not>
</and>
</condition>
</animation>
@ -1479,6 +1582,61 @@
</font-resolution>
</text>
<!-- VHF3 Data Mode-->
<animation>
<type>select</type>
<object-name>rmp2-standby-vhf3-data</object-name>
<condition>
<and>
<not-equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</not-equals>
<equals>
<property>controls/radio/rmp[1]/on</property>
<value>1</value>
</equals>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
<equals>
<property>systems/radio/rmp[1]/sel_chan</property>
<value type="string">vhf3</value>
</equals>
<equals>
<property>systems/radio/rmp[1]/vhf3-standby</property>
<value>0</value>
</equals>
</and>
</condition>
</animation>
<text>
<name>rmp2-standby-vhf3-data</name>
<offsets>
<x-m>-0.22190</x-m>
<y-m>-0.14896</y-m>
<z-m>-0.12613</z-m>
<heading-deg>90</heading-deg>
</offsets>
<alignment>center-center</alignment>
<axis-alignment>xy-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">data</format>
<property>autopilot/servicable</property>
<truncate type="bool">false</truncate>
<font type="string">led.txf</font>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.008</character-size>
<font-resolution>
<width type="int">32</width>
<height type="int">32</height>
</font-resolution>
</text>
<!-- Test Illumination-->
<animation>
<type>select</type>

View file

@ -76,6 +76,11 @@ file, these values will be used (they are hardcoded).
<number>1</number>
</comm-radio>
<comm-radio>
<name>comm</name>
<number>2</number>
</comm-radio>
<dme>
<name>dme</name>
<number>0</number>