This commit is contained in:
commit
1e34df2475
11 changed files with 1610 additions and 790 deletions
|
@ -784,6 +784,7 @@
|
|||
</fbw>
|
||||
<fmgc>
|
||||
<file>Aircraft/A320Family/Nasal/FMGC.nas</file>
|
||||
<file>Aircraft/A320Family/Nasal/FMGC-b.nas</file>
|
||||
</fmgc>
|
||||
<mcdu1>
|
||||
<file>Aircraft/A320Family/Nasal/MCDU/MCDU1.nas</file>
|
||||
|
|
|
@ -397,6 +397,7 @@
|
|||
</offsets>
|
||||
<condition>
|
||||
<and>
|
||||
<property>sim/current-view/internal</property>
|
||||
<greater-than-equals>
|
||||
<property>/systems/electrical/bus/ac1</property>
|
||||
<value>110</value>
|
||||
|
@ -750,6 +751,18 @@
|
|||
<object-name>alt-sel</object-name>
|
||||
<action>
|
||||
<button>0</button>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>/it-autoflight/input/vert</property>
|
||||
<value>8</value>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>setprop("/sim/sounde/btn1", 1);</script>
|
||||
</binding>
|
||||
</action>
|
||||
<action>
|
||||
<button>1</button>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
|
|
|
@ -2733,10 +2733,59 @@
|
|||
</font-resolution>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<name>mng-alt</name>
|
||||
<offsets>
|
||||
<x-m>0.0010</x-m>
|
||||
<y-m>0.0553</y-m>
|
||||
<z-m>0.0462</z-m>
|
||||
</offsets>
|
||||
<alignment>right-center</alignment>
|
||||
<axis-alignment>yz-plane</axis-alignment>
|
||||
<type type="string">text-value</type>
|
||||
<format type="string">%s</format>
|
||||
<property>/it-autoflight/internal/alt</property>
|
||||
<truncate type="bool">false</truncate>
|
||||
<font type="string">helvetica_bold.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.006</character-size>
|
||||
<font-resolution>
|
||||
<width type="int">32</width>
|
||||
<height type="int">32</height>
|
||||
</font-resolution>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<name>mng-alt-lower</name>
|
||||
<offsets>
|
||||
<x-m>0.0010</x-m>
|
||||
<y-m>0.0553</y-m>
|
||||
<z-m>-0.0462</z-m>
|
||||
</offsets>
|
||||
<alignment>right-center</alignment>
|
||||
<axis-alignment>yz-plane</axis-alignment>
|
||||
<type type="string">text-value</type>
|
||||
<format type="string">%s</format>
|
||||
<property>/it-autoflight/internal/alt</property>
|
||||
<truncate type="bool">false</truncate>
|
||||
<font type="string">helvetica_bold.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.006</character-size>
|
||||
<font-resolution>
|
||||
<width type="int">32</width>
|
||||
<height type="int">32</height>
|
||||
</font-resolution>
|
||||
</text>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>man-alt</object-name>
|
||||
<condition>
|
||||
<and>
|
||||
<greater-than-equals>
|
||||
<expression>
|
||||
<dif>
|
||||
|
@ -2746,6 +2795,11 @@
|
|||
</expression>
|
||||
<value>4300</value>
|
||||
</greater-than-equals>
|
||||
<not-equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</not-equals>
|
||||
</and>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
|
@ -2753,6 +2807,7 @@
|
|||
<type>select</type>
|
||||
<object-name>man-alt-lower</object-name>
|
||||
<condition>
|
||||
<and>
|
||||
<less-than-equals>
|
||||
<expression>
|
||||
<dif>
|
||||
|
@ -2762,6 +2817,55 @@
|
|||
</expression>
|
||||
<value>-4300</value>
|
||||
</less-than-equals>
|
||||
<not-equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</not-equals>
|
||||
</and>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>mng-alt</object-name>
|
||||
<condition>
|
||||
<and>
|
||||
<greater-than-equals>
|
||||
<expression>
|
||||
<dif>
|
||||
<property>/it-autoflight/internal/alt</property>
|
||||
<property>/instrumentation/altimeter/indicated-altitude-ft</property>
|
||||
</dif>
|
||||
</expression>
|
||||
<value>4300</value>
|
||||
</greater-than-equals>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</equals>
|
||||
</and>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>mng-alt-lower</object-name>
|
||||
<condition>
|
||||
<and>
|
||||
<less-than-equals>
|
||||
<expression>
|
||||
<dif>
|
||||
<property>/it-autoflight/internal/alt</property>
|
||||
<property>/instrumentation/altimeter/indicated-altitude-ft</property>
|
||||
</dif>
|
||||
</expression>
|
||||
<value>-4300</value>
|
||||
</less-than-equals>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</equals>
|
||||
</and>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
|
@ -2790,6 +2894,53 @@
|
|||
</transform>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>texmultiple</type>
|
||||
<object-name>target-alt-mng</object-name>
|
||||
<transform>
|
||||
<subtype>textranslate</subtype>
|
||||
<property>/it-autoflight/internal/mng-alt</property>
|
||||
<factor>0.000019141</factor>
|
||||
<axis>
|
||||
<y>-1</y>
|
||||
<x>0</x>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</transform>
|
||||
<transform>
|
||||
<subtype>textranslate</subtype>
|
||||
<property>/instrumentation/altimeter/indicated-altitude-ft</property>
|
||||
<factor>0.000019141</factor>
|
||||
<axis>
|
||||
<y>1</y>
|
||||
<x>0</x>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</transform>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>target-alt-sel</object-name>
|
||||
<condition>
|
||||
<not-equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</not-equals>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>target-alt-mng</object-name>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</equals>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<!-- VS Numbers -->
|
||||
|
||||
<text>
|
||||
|
@ -3135,6 +3286,8 @@
|
|||
<object-name>mng-spd-lower</object-name>
|
||||
<object-name>mng-mach</object-name>
|
||||
<object-name>mng-mach-lower</object-name>
|
||||
<object-name>mng-alt</object-name>
|
||||
<object-name>mng-alt-lower</object-name>
|
||||
<diffuse>
|
||||
<red>1</red>
|
||||
<green>0</green>
|
||||
|
|
|
@ -2733,10 +2733,59 @@
|
|||
</font-resolution>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<name>mng-alt</name>
|
||||
<offsets>
|
||||
<x-m>0.0010</x-m>
|
||||
<y-m>0.0553</y-m>
|
||||
<z-m>0.0462</z-m>
|
||||
</offsets>
|
||||
<alignment>right-center</alignment>
|
||||
<axis-alignment>yz-plane</axis-alignment>
|
||||
<type type="string">text-value</type>
|
||||
<format type="string">%s</format>
|
||||
<property>/it-autoflight/internal/alt</property>
|
||||
<truncate type="bool">false</truncate>
|
||||
<font type="string">helvetica_bold.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.006</character-size>
|
||||
<font-resolution>
|
||||
<width type="int">32</width>
|
||||
<height type="int">32</height>
|
||||
</font-resolution>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<name>mng-alt-lower</name>
|
||||
<offsets>
|
||||
<x-m>0.0010</x-m>
|
||||
<y-m>0.0553</y-m>
|
||||
<z-m>-0.0462</z-m>
|
||||
</offsets>
|
||||
<alignment>right-center</alignment>
|
||||
<axis-alignment>yz-plane</axis-alignment>
|
||||
<type type="string">text-value</type>
|
||||
<format type="string">%s</format>
|
||||
<property>/it-autoflight/internal/alt</property>
|
||||
<truncate type="bool">false</truncate>
|
||||
<font type="string">helvetica_bold.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.006</character-size>
|
||||
<font-resolution>
|
||||
<width type="int">32</width>
|
||||
<height type="int">32</height>
|
||||
</font-resolution>
|
||||
</text>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>man-alt</object-name>
|
||||
<condition>
|
||||
<and>
|
||||
<greater-than-equals>
|
||||
<expression>
|
||||
<dif>
|
||||
|
@ -2746,6 +2795,11 @@
|
|||
</expression>
|
||||
<value>4300</value>
|
||||
</greater-than-equals>
|
||||
<not-equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</not-equals>
|
||||
</and>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
|
@ -2753,6 +2807,7 @@
|
|||
<type>select</type>
|
||||
<object-name>man-alt-lower</object-name>
|
||||
<condition>
|
||||
<and>
|
||||
<less-than-equals>
|
||||
<expression>
|
||||
<dif>
|
||||
|
@ -2762,6 +2817,55 @@
|
|||
</expression>
|
||||
<value>-4300</value>
|
||||
</less-than-equals>
|
||||
<not-equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</not-equals>
|
||||
</and>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>mng-alt</object-name>
|
||||
<condition>
|
||||
<and>
|
||||
<greater-than-equals>
|
||||
<expression>
|
||||
<dif>
|
||||
<property>/it-autoflight/internal/alt</property>
|
||||
<property>/instrumentation/altimeter/indicated-altitude-ft</property>
|
||||
</dif>
|
||||
</expression>
|
||||
<value>4300</value>
|
||||
</greater-than-equals>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</equals>
|
||||
</and>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>mng-alt-lower</object-name>
|
||||
<condition>
|
||||
<and>
|
||||
<less-than-equals>
|
||||
<expression>
|
||||
<dif>
|
||||
<property>/it-autoflight/internal/alt</property>
|
||||
<property>/instrumentation/altimeter/indicated-altitude-ft</property>
|
||||
</dif>
|
||||
</expression>
|
||||
<value>-4300</value>
|
||||
</less-than-equals>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</equals>
|
||||
</and>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
|
@ -2790,6 +2894,53 @@
|
|||
</transform>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>texmultiple</type>
|
||||
<object-name>target-alt-mng</object-name>
|
||||
<transform>
|
||||
<subtype>textranslate</subtype>
|
||||
<property>/it-autoflight/internal/mng-alt</property>
|
||||
<factor>0.000019141</factor>
|
||||
<axis>
|
||||
<y>-1</y>
|
||||
<x>0</x>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</transform>
|
||||
<transform>
|
||||
<subtype>textranslate</subtype>
|
||||
<property>/instrumentation/altimeter/indicated-altitude-ft</property>
|
||||
<factor>0.000019141</factor>
|
||||
<axis>
|
||||
<y>1</y>
|
||||
<x>0</x>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</transform>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>target-alt-sel</object-name>
|
||||
<condition>
|
||||
<not-equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</not-equals>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>target-alt-mng</object-name>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</equals>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<!-- VS Numbers -->
|
||||
|
||||
<text>
|
||||
|
@ -3135,6 +3286,8 @@
|
|||
<object-name>mng-spd-lower</object-name>
|
||||
<object-name>mng-mach</object-name>
|
||||
<object-name>mng-mach-lower</object-name>
|
||||
<object-name>mng-alt</object-name>
|
||||
<object-name>mng-alt-lower</object-name>
|
||||
<diffuse>
|
||||
<red>1</red>
|
||||
<green>0</green>
|
||||
|
|
|
@ -2,7 +2,26 @@ AC3Db
|
|||
MATERIAL "ac3dmat1" rgb 1 1 1 amb 0 0 0 emis 0.658824 0.670588 0.67451 spec 0 0 0 shi 128 trans 0
|
||||
MATERIAL "white" rgb 1 1 1 amb 1 1 1 emis 0.798 0.798 0.798 spec 0 0 0 shi 0 trans 0
|
||||
OBJECT world
|
||||
kids 43
|
||||
kids 44
|
||||
OBJECT poly
|
||||
name "target-alt-mng"
|
||||
loc 0.000960576 -0.000264099 -0.0431903
|
||||
texture "trgt-alt-mng.png"
|
||||
crease 45.000000
|
||||
numvert 4
|
||||
0 0.0428304 -0.00623311
|
||||
0 0.0428304 0.00772078
|
||||
0 -0.0428304 0.00772078
|
||||
0 -0.0428304 -0.00623311
|
||||
numsurf 1
|
||||
SURF 0x30
|
||||
mat 0
|
||||
refs 4
|
||||
0 0.990386 0.217208
|
||||
1 0.022378 0.217208
|
||||
2 0.0223766 0.0507198
|
||||
3 0.990386 0.0507198
|
||||
kids 0
|
||||
OBJECT poly
|
||||
name "ap-mode-box"
|
||||
loc 0.000380651 0.0723146 -0.0618702
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 4.2 KiB |
1096
Nasal/FMGC-b.nas
Normal file
1096
Nasal/FMGC-b.nas
Normal file
File diff suppressed because it is too large
Load diff
745
Nasal/FMGC.nas
745
Nasal/FMGC.nas
|
@ -345,748 +345,3 @@ var ManagedSPD = maketimer(0.25, func {
|
|||
libraries.mcpSPDKnbPull();
|
||||
}
|
||||
});
|
||||
|
||||
#################################
|
||||
# IT-AUTOFLIGHT Based Autopilot #
|
||||
#################################
|
||||
|
||||
var APinit = func {
|
||||
setprop("/it-autoflight/custom/trk-fpa", 0);
|
||||
setprop("/it-autoflight/input/kts-mach", 0);
|
||||
setprop("/it-autoflight/input/ap1", 0);
|
||||
setprop("/it-autoflight/input/ap2", 0);
|
||||
setprop("/it-autoflight/input/athr", 0);
|
||||
setprop("/it-autoflight/input/fd1", 0);
|
||||
setprop("/it-autoflight/input/fd2", 0);
|
||||
setprop("/it-autoflight/input/hdg", 360);
|
||||
setprop("/it-autoflight/input/alt", 10000);
|
||||
setprop("/it-autoflight/input/vs", 0);
|
||||
setprop("/it-autoflight/input/fpa", 0);
|
||||
setprop("/it-autoflight/input/lat", 5);
|
||||
setprop("/it-autoflight/input/lat-arm", 0);
|
||||
setprop("/it-autoflight/input/vert", 7);
|
||||
setprop("/it-autoflight/input/bank-limit", 25);
|
||||
setprop("/it-autoflight/input/trk", 0);
|
||||
setprop("/it-autoflight/input/toga", 0);
|
||||
setprop("/it-autoflight/input/spd-managed", 0);
|
||||
setprop("/it-autoflight/output/ap1", 0);
|
||||
setprop("/it-autoflight/output/ap2", 0);
|
||||
setprop("/it-autoflight/output/athr", 0);
|
||||
setprop("/it-autoflight/output/fd1", 0);
|
||||
setprop("/it-autoflight/output/fd2", 0);
|
||||
setprop("/it-autoflight/output/loc-armed", 0);
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
setprop("/it-autoflight/output/thr-mode", 2);
|
||||
setprop("/it-autoflight/output/lat", 5);
|
||||
setprop("/it-autoflight/output/vert", 7);
|
||||
setprop("/it-autoflight/output/fma-pwr", 0);
|
||||
setprop("/it-autoflight/settings/use-backcourse", 0);
|
||||
setprop("/it-autoflight/internal/min-vs", -500);
|
||||
setprop("/it-autoflight/internal/max-vs", 500);
|
||||
setprop("/it-autoflight/internal/alt", 10000);
|
||||
setprop("/it-autoflight/internal/alt", 10000);
|
||||
setprop("/it-autoflight/internal/fpa", 0);
|
||||
setprop("/it-autoflight/internal/top-of-des-nm", 0);
|
||||
setprop("/it-autoflight/mode/thr", "PITCH");
|
||||
setprop("/it-autoflight/mode/arm", "HDG");
|
||||
setprop("/it-autoflight/mode/lat", "T/O");
|
||||
setprop("/it-autoflight/mode/vert", "T/O CLB");
|
||||
setprop("/it-autoflight/input/spd-kts", 100);
|
||||
setprop("/it-autoflight/input/spd-mach", 0.50);
|
||||
update_armst.start();
|
||||
thrustmode();
|
||||
}
|
||||
|
||||
# AP 1 Master System
|
||||
setlistener("/it-autoflight/input/ap1", func {
|
||||
var apmas = getprop("/it-autoflight/input/ap1");
|
||||
var ac_ess = getprop("/systems/electrical/bus/ac-ess");
|
||||
if (apmas == 0) {
|
||||
fmabox();
|
||||
setprop("/it-autoflight/output/ap1", 0);
|
||||
if (getprop("/it-autoflight/sound/enableapoffsound") == 1) {
|
||||
setprop("/it-autoflight/sound/apoffsound", 1);
|
||||
setprop("/it-autoflight/sound/enableapoffsound", 0);
|
||||
}
|
||||
} else if (apmas == 1 and ac_ess >= 110) {
|
||||
if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) {
|
||||
fmabox();
|
||||
setprop("/it-autoflight/output/ap1", 1);
|
||||
setprop("/it-autoflight/sound/enableapoffsound", 1);
|
||||
setprop("/it-autoflight/sound/apoffsound", 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
# AP 2 Master System
|
||||
setlistener("/it-autoflight/input/ap2", func {
|
||||
var apmas = getprop("/it-autoflight/input/ap2");
|
||||
var ac_ess = getprop("/systems/electrical/bus/ac-ess");
|
||||
if (apmas == 0) {
|
||||
fmabox();
|
||||
setprop("/it-autoflight/output/ap2", 0);
|
||||
if (getprop("/it-autoflight/sound/enableapoffsound2") == 1) {
|
||||
setprop("/it-autoflight/sound/apoffsound2", 1);
|
||||
setprop("/it-autoflight/sound/enableapoffsound2", 0);
|
||||
}
|
||||
} else if (apmas == 1 and ac_ess >= 110) {
|
||||
if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) {
|
||||
fmabox();
|
||||
setprop("/it-autoflight/output/ap2", 1);
|
||||
setprop("/it-autoflight/sound/enableapoffsound2", 1);
|
||||
setprop("/it-autoflight/sound/apoffsound2", 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
# AT Master System
|
||||
setlistener("/it-autoflight/input/athr", func {
|
||||
var atmas = getprop("/it-autoflight/input/athr");
|
||||
if (atmas == 0) {
|
||||
setprop("/it-autoflight/output/athr", 0);
|
||||
} else if (atmas == 1) {
|
||||
thrustmode();
|
||||
setprop("/it-autoflight/output/athr", 1);
|
||||
}
|
||||
});
|
||||
|
||||
# Flight Director 1 Master System
|
||||
setlistener("/it-autoflight/input/fd1", func {
|
||||
var fdmas = getprop("/it-autoflight/input/fd1");
|
||||
if (fdmas == 0) {
|
||||
fmabox();
|
||||
setprop("/it-autoflight/output/fd1", 0);
|
||||
} else if (fdmas == 1) {
|
||||
fmabox();
|
||||
setprop("/it-autoflight/output/fd1", 1);
|
||||
}
|
||||
});
|
||||
|
||||
# Flight Director 2 Master System
|
||||
setlistener("/it-autoflight/input/fd2", func {
|
||||
var fdmas = getprop("/it-autoflight/input/fd2");
|
||||
if (fdmas == 0) {
|
||||
fmabox();
|
||||
setprop("/it-autoflight/output/fd2", 0);
|
||||
} else if (fdmas == 1) {
|
||||
fmabox();
|
||||
setprop("/it-autoflight/output/fd2", 1);
|
||||
}
|
||||
});
|
||||
|
||||
# FMA Boxes and Mode
|
||||
var fmabox = func {
|
||||
var ap1 = getprop("/it-autoflight/output/ap1");
|
||||
var ap2 = getprop("/it-autoflight/output/ap2");
|
||||
var fd1 = getprop("/it-autoflight/output/fd1");
|
||||
var fd2 = getprop("/it-autoflight/output/fd2");
|
||||
if (!ap1 and !ap2 and !fd1 and !fd2) {
|
||||
setprop("/it-autoflight/input/trk", 0);
|
||||
setprop("/it-autoflight/input/lat", 3);
|
||||
setprop("/it-autoflight/input/vert", 1);
|
||||
setprop("/it-autoflight/input/vs", 0);
|
||||
setprop("/it-autoflight/output/fma-pwr", 0);
|
||||
} else {
|
||||
setprop("/it-autoflight/input/trk", 0);
|
||||
setprop("/it-autoflight/input/vs", 0);
|
||||
setprop("/it-autoflight/output/fma-pwr", 1);
|
||||
}
|
||||
}
|
||||
|
||||
# Master Lateral
|
||||
setlistener("/it-autoflight/input/lat", func {
|
||||
if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) {
|
||||
lateral();
|
||||
} else {
|
||||
lat_arm();
|
||||
}
|
||||
});
|
||||
|
||||
var lateral = func {
|
||||
var latset = getprop("/it-autoflight/input/lat");
|
||||
if (latset == 0) {
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
lnavwptt.stop();
|
||||
setprop("/it-autoflight/output/loc-armed", 0);
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
setprop("/it-autoflight/output/lat", 0);
|
||||
setprop("/it-autoflight/mode/lat", "HDG");
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
} else if (latset == 1) {
|
||||
if (getprop("/autopilot/route-manager/route/num") > 0 and getprop("/autopilot/route-manager/active") == 1) {
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
lnavwptt.start();
|
||||
setprop("/it-autoflight/output/loc-armed", 0);
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
setprop("/it-autoflight/output/lat", 1);
|
||||
setprop("/it-autoflight/mode/lat", "LNAV");
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
} else {
|
||||
gui.popupTip("Please make sure you have a route set, and that it is Activated!");
|
||||
}
|
||||
} else if (latset == 2) {
|
||||
if (getprop("/it-autoflight/output/lat") == 2) {
|
||||
# Do nothing because VOR/LOC is active
|
||||
} else {
|
||||
setprop("/instrumentation/nav[0]/signal-quality-norm", 0);
|
||||
setprop("/instrumentation/nav[1]/signal-quality-norm", 0);
|
||||
setprop("/it-autoflight/output/loc-armed", 1);
|
||||
setprop("/it-autoflight/mode/arm", "LOC");
|
||||
}
|
||||
} else if (latset == 3) {
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
lnavwptt.stop();
|
||||
setprop("/it-autoflight/output/loc-armed", 0);
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
var hdg5sec = int(getprop("/it-autoflight/internal/heading-5-sec-ahead")+0.5);
|
||||
setprop("/it-autoflight/input/hdg", hdg5sec);
|
||||
setprop("/it-autoflight/output/lat", 0);
|
||||
setprop("/it-autoflight/mode/lat", "HDG");
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
} else if (latset == 4) {
|
||||
lnavwptt.stop();
|
||||
setprop("/it-autoflight/output/lat", 4);
|
||||
setprop("/it-autoflight/mode/lat", "ALGN");
|
||||
} else if (latset == 5) {
|
||||
lnavwptt.stop();
|
||||
setprop("/it-autoflight/output/lat", 5);
|
||||
}
|
||||
}
|
||||
|
||||
var lat_arm = func {
|
||||
var latset = getprop("/it-autoflight/input/lat");
|
||||
if (latset == 0) {
|
||||
setprop("/it-autoflight/input/lat-arm", 0);
|
||||
setprop("/it-autoflight/mode/arm", "HDG");
|
||||
} else if (latset == 1) {
|
||||
if (getprop("/autopilot/route-manager/route/num") > 0 and getprop("/autopilot/route-manager/active") == 1) {
|
||||
setprop("/it-autoflight/input/lat-arm", 1);
|
||||
setprop("/it-autoflight/mode/arm", "LNV");
|
||||
} else {
|
||||
gui.popupTip("Please make sure you have a route set, and that it is Activated!");
|
||||
}
|
||||
} else if (latset == 3) {
|
||||
var hdgnow = int(getprop("/orientation/heading-magnetic-deg")+0.5);
|
||||
setprop("/it-autoflight/input/hdg", hdgnow);
|
||||
setprop("/it-autoflight/input/lat-arm", 0);
|
||||
setprop("/it-autoflight/mode/arm", "HDG");
|
||||
}
|
||||
}
|
||||
|
||||
# Master Vertical
|
||||
setlistener("/it-autoflight/input/vert", func {
|
||||
if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) {
|
||||
vertical();
|
||||
} else {
|
||||
vert_arm();
|
||||
}
|
||||
});
|
||||
|
||||
var vertical = func {
|
||||
var vertset = getprop("/it-autoflight/input/vert");
|
||||
if (vertset == 0) {
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
setprop("/it-autoflight/output/vert", 0);
|
||||
setprop("/it-autoflight/mode/vert", "ALT HLD");
|
||||
if (getprop("/it-autoflight/output/loc-armed")) {
|
||||
setprop("/it-autoflight/mode/arm", "LOC");
|
||||
} else {
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
}
|
||||
var altnow = int((getprop("/instrumentation/altimeter/indicated-altitude-ft")+50)/100)*100;
|
||||
setprop("/it-autoflight/input/alt", altnow);
|
||||
setprop("/it-autoflight/internal/alt", altnow);
|
||||
thrustmode();
|
||||
} else if (vertset == 1) {
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
var altinput = getprop("/it-autoflight/input/alt");
|
||||
setprop("/it-autoflight/internal/alt", altinput);
|
||||
var vsnow = int(getprop("/velocities/vertical-speed-fps")*0.6)*100;
|
||||
setprop("/it-autoflight/input/vs", vsnow);
|
||||
setprop("/it-autoflight/output/vert", 1);
|
||||
setprop("/it-autoflight/mode/vert", "V/S");
|
||||
if (getprop("/it-autoflight/output/loc-armed")) {
|
||||
setprop("/it-autoflight/mode/arm", "LOC");
|
||||
} else {
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
}
|
||||
thrustmode();
|
||||
} else if (vertset == 2) {
|
||||
if (getprop("/it-autoflight/output/lat") == 2) {
|
||||
# Do nothing because VOR/LOC is active
|
||||
} else {
|
||||
setprop("/instrumentation/nav[0]/signal-quality-norm", 0);
|
||||
setprop("/instrumentation/nav[1]/signal-quality-norm", 0);
|
||||
setprop("/it-autoflight/output/loc-armed", 1);
|
||||
}
|
||||
if ((getprop("/it-autoflight/output/vert") == 2) or (getprop("/it-autoflight/output/vert") == 6)) {
|
||||
# Do nothing because G/S or LAND or FLARE is active
|
||||
} else {
|
||||
setprop("/instrumentation/nav[0]/gs-rate-of-climb", 0);
|
||||
setprop("/it-autoflight/output/appr-armed", 1);
|
||||
setprop("/it-autoflight/mode/arm", "ILS");
|
||||
}
|
||||
} else if (vertset == 3) {
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
||||
var alt = getprop("/it-autoflight/internal/alt");
|
||||
var dif = calt - alt;
|
||||
var vsnow = getprop("/it-autoflight/internal/vert-speed-fpm");
|
||||
if (calt < alt) {
|
||||
setprop("/it-autoflight/internal/max-vs", vsnow);
|
||||
} else if (calt > alt) {
|
||||
setprop("/it-autoflight/internal/min-vs", vsnow);
|
||||
}
|
||||
minmaxtimer.start();
|
||||
thrustmode();
|
||||
setprop("/it-autoflight/output/vert", 0);
|
||||
setprop("/it-autoflight/mode/vert", "ALT CAP");
|
||||
} else if (vertset == 4) {
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
var altinput = getprop("/it-autoflight/input/alt");
|
||||
setprop("/it-autoflight/internal/alt", altinput);
|
||||
var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
||||
var alt = getprop("/it-autoflight/internal/alt");
|
||||
var dif = calt - alt;
|
||||
if (dif < 250 and dif > -250) {
|
||||
alt_on();
|
||||
} else {
|
||||
flch_on();
|
||||
}
|
||||
if (getprop("/it-autoflight/output/loc-armed")) {
|
||||
setprop("/it-autoflight/mode/arm", "LOC");
|
||||
} else {
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
}
|
||||
} else if (vertset == 5) {
|
||||
fpa_calc();
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
fpa_calct.start();
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
var altinput = getprop("/it-autoflight/input/alt");
|
||||
setprop("/it-autoflight/internal/alt", altinput);
|
||||
var fpanow = (int(10*getprop("/it-autoflight/internal/fpa")))*0.1;
|
||||
print(fpanow);
|
||||
setprop("/it-autoflight/input/fpa", fpanow);
|
||||
setprop("/it-autoflight/output/vert", 5);
|
||||
setprop("/it-autoflight/mode/vert", "FPA");
|
||||
if (getprop("/it-autoflight/output/loc-armed") == 1) {
|
||||
setprop("/it-autoflight/mode/arm", "LOC");
|
||||
} else {
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
}
|
||||
thrustmode();
|
||||
} else if (vertset == 6) {
|
||||
setprop("/it-autoflight/output/vert", 6);
|
||||
setprop("/it-autoflight/mode/vert", "LAND");
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
thrustmode();
|
||||
alandt.stop();
|
||||
alandt1.start();
|
||||
} else if (vertset == 7) {
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
setprop("/it-autoflight/output/vert", 7);
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
var altinput = getprop("/it-autoflight/input/alt");
|
||||
setprop("/it-autoflight/internal/alt", altinput);
|
||||
thrustmodet.start();
|
||||
}
|
||||
}
|
||||
|
||||
var vert_arm = func {
|
||||
var vertset = getprop("/it-autoflight/input/vert");
|
||||
if (vertset == 8) {
|
||||
# Do nothing right now
|
||||
} else {
|
||||
# Do nothing right now
|
||||
}
|
||||
}
|
||||
|
||||
# Helpers
|
||||
var toggle_trkfpa = func {
|
||||
var trkfpa = getprop("/it-autoflight/custom/trk-fpa");
|
||||
if (trkfpa == 0) {
|
||||
setprop("/it-autoflight/custom/trk-fpa", 1);
|
||||
if (getprop("/it-autoflight/output/vert") == 1) {
|
||||
setprop("/it-autoflight/input/vert", 5);
|
||||
}
|
||||
setprop("/it-autoflight/input/trk", 1);
|
||||
var hed = getprop("/it-autoflight/internal/heading-error-deg");
|
||||
if (hed >= -10 and hed <= 10 and getprop("/it-autoflight/output/lat") == 0) {
|
||||
setprop("/it-autoflight/input/lat", 3);
|
||||
}
|
||||
} else if (trkfpa == 1) {
|
||||
setprop("/it-autoflight/custom/trk-fpa", 0);
|
||||
if (getprop("/it-autoflight/output/vert") == 5) {
|
||||
setprop("/it-autoflight/input/vert", 1);
|
||||
}
|
||||
setprop("/it-autoflight/input/trk", 0);
|
||||
var hed = getprop("/it-autoflight/internal/heading-error-deg");
|
||||
if (hed >= -10 and hed <= 10 and getprop("/it-autoflight/output/lat") == 0) {
|
||||
setprop("/it-autoflight/input/lat", 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var lnavwpt = func {
|
||||
if (getprop("/autopilot/route-manager/route/num") > 0) {
|
||||
if (getprop("/autopilot/route-manager/wp/dist") <= 1.0) {
|
||||
var wptnum = getprop("/autopilot/route-manager/current-wp");
|
||||
if ((wptnum + 1) < getprop("/autopilot/route-manager/route/num")) {
|
||||
setprop("/autopilot/route-manager/current-wp", wptnum + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var flch_on = func {
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
setprop("/it-autoflight/output/vert", 4);
|
||||
thrustmodet.start();
|
||||
}
|
||||
var alt_on = func {
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
setprop("/it-autoflight/output/vert", 0);
|
||||
setprop("/it-autoflight/mode/vert", "ALT CAP");
|
||||
setprop("/it-autoflight/internal/max-vs", 500);
|
||||
setprop("/it-autoflight/internal/min-vs", -500);
|
||||
minmaxtimer.start();
|
||||
}
|
||||
|
||||
var fpa_calc = func {
|
||||
var VS = getprop("/velocities/vertical-speed-fps");
|
||||
var TAS = getprop("/velocities/uBody-fps");
|
||||
if (TAS < 10) TAS = 10;
|
||||
if (VS < -200) VS =-200;
|
||||
if (abs(VS/TAS) <= 1) {
|
||||
var FPangle = math.asin(VS/TAS);
|
||||
FPangle *=90;
|
||||
setprop("/it-autoflight/internal/fpa", FPangle);
|
||||
}
|
||||
}
|
||||
|
||||
setlistener("/it-autoflight/input/kts-mach", func {
|
||||
var ias = getprop("/instrumentation/airspeed-indicator/indicated-speed-kt");
|
||||
var mach = getprop("/instrumentation/airspeed-indicator/indicated-mach");
|
||||
if (getprop("/it-autoflight/input/kts-mach") == 0) {
|
||||
if (ias >= 100 and ias <= 360) {
|
||||
setprop("/it-autoflight/input/spd-kts", math.round(ias, 1));
|
||||
} else if (ias < 100) {
|
||||
setprop("/it-autoflight/input/spd-kts", 100);
|
||||
} else if (ias > 360) {
|
||||
setprop("/it-autoflight/input/spd-kts", 360);
|
||||
}
|
||||
} else if (getprop("/it-autoflight/input/kts-mach") == 1) {
|
||||
if (mach >= 0.50 and mach <= 0.95) {
|
||||
setprop("/it-autoflight/input/spd-kts", math.round(mach, 0.001));
|
||||
} else if (mach < 0.50) {
|
||||
setprop("/it-autoflight/input/spd-kts", 0.50);
|
||||
} else if (mach > 0.95) {
|
||||
setprop("/it-autoflight/input/spd-kts", 0.95);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
# Takeoff Modes
|
||||
# Lat Active
|
||||
var latarms = func {
|
||||
if (getprop("/position/gear-agl-ft") >= 20) {
|
||||
if (getprop("/it-autoflight/input/lat-arm") == 1) {
|
||||
setprop("/it-autoflight/input/lat", getprop("/it-autoflight/input/lat-arm"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# TOGA
|
||||
setlistener("/it-autoflight/input/toga", func {
|
||||
if (getprop("/it-autoflight/input/toga") == 1) {
|
||||
setprop("/it-autoflight/input/vert", 7);
|
||||
vertical();
|
||||
setprop("/it-autoflight/output/loc-armed", 0);
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
setprop("/it-autoflight/input/toga", 0);
|
||||
togasel();
|
||||
}
|
||||
});
|
||||
|
||||
var togasel = func {
|
||||
if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) {
|
||||
var iasnow = int(getprop("/instrumentation/airspeed-indicator/indicated-speed-kt")+0.5);
|
||||
setprop("/it-autoflight/input/spd-kts", iasnow);
|
||||
setprop("/it-autoflight/input/kts-mach", 0);
|
||||
setprop("/it-autoflight/mode/vert", "G/A CLB");
|
||||
setprop("/it-autoflight/input/lat", 3);
|
||||
} else {
|
||||
setprop("/it-autoflight/input/lat", 5);
|
||||
lateral();
|
||||
setprop("/it-autoflight/mode/lat", "T/O");
|
||||
setprop("/it-autoflight/mode/vert", "T/O CLB");
|
||||
}
|
||||
}
|
||||
|
||||
setlistener("/it-autoflight/mode/vert", func {
|
||||
var vertm = getprop("/it-autoflight/mode/vert");
|
||||
if (vertm == "T/O CLB") {
|
||||
reduct.start();
|
||||
} else {
|
||||
reduct.stop();
|
||||
}
|
||||
});
|
||||
|
||||
setlistener("/it-autoflight/mode/lat", func {
|
||||
var vertm = getprop("/it-autoflight/mode/lat");
|
||||
if (vertm == "T/O") {
|
||||
latarmt.start();
|
||||
} else {
|
||||
latarmt.stop();
|
||||
}
|
||||
});
|
||||
|
||||
var toga_reduc = func {
|
||||
if (getprop("/position/gear-agl-ft") >= getprop("/it-autoflight/settings/reduc-agl-ft")) {
|
||||
setprop("/it-autoflight/input/vert", 4);
|
||||
}
|
||||
}
|
||||
|
||||
# Altitude Capture and FPA Timer Logic
|
||||
setlistener("/it-autoflight/output/vert", func {
|
||||
var vertm = getprop("/it-autoflight/output/vert");
|
||||
if (vertm == 1) {
|
||||
altcaptt.start();
|
||||
fpa_calct.stop();
|
||||
} else if (vertm == 4) {
|
||||
altcaptt.start();
|
||||
fpa_calct.stop();
|
||||
} else if (vertm == 5) {
|
||||
altcaptt.start();
|
||||
} else if (vertm == 7) {
|
||||
altcaptt.start();
|
||||
fpa_calct.stop();
|
||||
} else if (vertm == 8) {
|
||||
altcaptt.stop();
|
||||
fpa_calct.stop();
|
||||
} else {
|
||||
altcaptt.stop();
|
||||
fpa_calct.stop();
|
||||
}
|
||||
});
|
||||
|
||||
# Altitude Capture
|
||||
var altcapt = func {
|
||||
var vsnow = getprop("/it-autoflight/internal/vert-speed-fpm");
|
||||
if ((vsnow >= 0 and vsnow < 500) or (vsnow < 0 and vsnow > -500)) {
|
||||
setprop("/it-autoflight/internal/captvs", 100);
|
||||
setprop("/it-autoflight/internal/captvsneg", -100);
|
||||
} else if ((vsnow >= 500 and vsnow < 1000) or (vsnow < -500 and vsnow > -1000)) {
|
||||
setprop("/it-autoflight/internal/captvs", 200);
|
||||
setprop("/it-autoflight/internal/captvsneg", -200);
|
||||
} else if ((vsnow >= 1000 and vsnow < 1500) or (vsnow < -1000 and vsnow > -1500)) {
|
||||
setprop("/it-autoflight/internal/captvs", 300);
|
||||
setprop("/it-autoflight/internal/captvsneg", -300);
|
||||
} else if ((vsnow >= 1500 and vsnow < 2000) or (vsnow < -1500 and vsnow > -2000)) {
|
||||
setprop("/it-autoflight/internal/captvs", 400);
|
||||
setprop("/it-autoflight/internal/captvsneg", -400);
|
||||
} else if ((vsnow >= 2000 and vsnow < 3000) or (vsnow < -2000 and vsnow > -3000)) {
|
||||
setprop("/it-autoflight/internal/captvs", 600);
|
||||
setprop("/it-autoflight/internal/captvsneg", -600);
|
||||
} else if ((vsnow >= 3000 and vsnow < 4000) or (vsnow < -3000 and vsnow > -4000)) {
|
||||
setprop("/it-autoflight/internal/captvs", 900);
|
||||
setprop("/it-autoflight/internal/captvsneg", -900);
|
||||
} else if ((vsnow >= 4000 and vsnow < 5000) or (vsnow < -4000 and vsnow > -5000)) {
|
||||
setprop("/it-autoflight/internal/captvs", 1200);
|
||||
setprop("/it-autoflight/internal/captvsneg", -1200);
|
||||
} else if ((vsnow >= 5000) or (vsnow < -5000)) {
|
||||
setprop("/it-autoflight/internal/captvs", 1500);
|
||||
setprop("/it-autoflight/internal/captvsneg", -1500);
|
||||
}
|
||||
var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
||||
var alt = getprop("/it-autoflight/internal/alt");
|
||||
var dif = calt - alt;
|
||||
if (dif < getprop("/it-autoflight/internal/captvs") and dif > getprop("/it-autoflight/internal/captvsneg")) {
|
||||
if (vsnow > 0 and dif < 0) {
|
||||
setprop("/it-autoflight/input/vert", 3);
|
||||
setprop("/it-autoflight/output/thr-mode", 0);
|
||||
} else if (vsnow < 0 and dif > 0) {
|
||||
setprop("/it-autoflight/input/vert", 3);
|
||||
setprop("/it-autoflight/output/thr-mode", 0);
|
||||
}
|
||||
}
|
||||
var altinput = getprop("/it-autoflight/input/alt");
|
||||
setprop("/it-autoflight/internal/alt", altinput);
|
||||
}
|
||||
|
||||
# Min and Max Pitch Reset
|
||||
var minmax = func {
|
||||
var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
||||
var alt = getprop("/it-autoflight/internal/alt");
|
||||
var dif = calt - alt;
|
||||
if (dif < 50 and dif > -50) {
|
||||
setprop("/it-autoflight/internal/max-vs", 500);
|
||||
setprop("/it-autoflight/internal/min-vs", -500);
|
||||
var vertmode = getprop("/it-autoflight/output/vert");
|
||||
if (vertmode == 1 or vertmode == 2 or vertmode == 4 or vertmode == 5 or vertmode == 6 or vertmode == 7) {
|
||||
# Do not change the vertical mode because we are not trying to capture altitude.
|
||||
} else {
|
||||
setprop("/it-autoflight/mode/vert", "ALT HLD");
|
||||
}
|
||||
minmaxtimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
# Thrust Mode Selector
|
||||
var thrustmode = func {
|
||||
var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
||||
var alt = getprop("/it-autoflight/internal/alt");
|
||||
var vertm = getprop("/it-autoflight/output/vert");
|
||||
if (vertm == 4) {
|
||||
if (calt < alt) {
|
||||
setprop("/it-autoflight/output/thr-mode", 2);
|
||||
setprop("/it-autoflight/mode/thr", " PITCH");
|
||||
setprop("/it-autoflight/mode/vert", "SPD CLB");
|
||||
} else if (calt > alt) {
|
||||
setprop("/it-autoflight/output/thr-mode", 1);
|
||||
setprop("/it-autoflight/mode/thr", " PITCH");
|
||||
setprop("/it-autoflight/mode/vert", "SPD DES");
|
||||
} else {
|
||||
setprop("/it-autoflight/output/thr-mode", 0);
|
||||
setprop("/it-autoflight/mode/thr", "THRUST");
|
||||
setprop("/it-autoflight/input/vert", 3);
|
||||
}
|
||||
} else if (vertm == 7) {
|
||||
setprop("/it-autoflight/output/thr-mode", 2);
|
||||
setprop("/it-autoflight/mode/thr", " PITCH");
|
||||
} else {
|
||||
setprop("/it-autoflight/output/thr-mode", 0);
|
||||
setprop("/it-autoflight/mode/thr", "THRUST");
|
||||
thrustmodet.stop();
|
||||
}
|
||||
}
|
||||
|
||||
# ILS and Autoland
|
||||
# LOC and G/S arming
|
||||
var update_arms = func {
|
||||
update_locarmelec();
|
||||
update_apparmelec();
|
||||
}
|
||||
|
||||
var update_locarmelec = func {
|
||||
var loca = getprop("/it-autoflight/output/loc-armed");
|
||||
if (loca) {
|
||||
locarmcheck();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
var update_apparmelec = func {
|
||||
var appra = getprop("/it-autoflight/output/appr-armed");
|
||||
if (appra) {
|
||||
apparmcheck();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
var locarmcheck = func {
|
||||
var locdefl = getprop("instrumentation/nav[0]/heading-needle-deflection-norm");
|
||||
var locdefl_b = getprop("instrumentation/nav[1]/heading-needle-deflection-norm");
|
||||
if ((locdefl < 0.9233) and (getprop("instrumentation/nav[0]/signal-quality-norm") > 0.99) and (getprop("/FMGC/internal/loc-source") == "NAV0")) {
|
||||
make_loc_active();
|
||||
} else if ((locdefl_b < 0.9233) and (getprop("instrumentation/nav[1]/signal-quality-norm") > 0.99) and (getprop("/FMGC/internal/loc-source") == "NAV1")) {
|
||||
make_loc_active();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
var make_loc_active = func {
|
||||
setprop("/it-autoflight/output/loc-armed", 0);
|
||||
setprop("/it-autoflight/output/lat", 2);
|
||||
setprop("/it-autoflight/mode/lat", "LOC");
|
||||
if (getprop("/it-autoflight/output/appr-armed") == 1) {
|
||||
# Do nothing because G/S is armed
|
||||
} else {
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
}
|
||||
}
|
||||
|
||||
var apparmcheck = func {
|
||||
var signal = getprop("/instrumentation/nav[0]/gs-needle-deflection-norm");
|
||||
if ((signal <= -0.000000001) and (getprop("/FMGC/internal/loc-source") == "NAV0") and (getprop("/it-autoflight/output/lat") == 2)) {
|
||||
make_appr_active();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
var make_appr_active = func {
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
setprop("/it-autoflight/output/vert", 2);
|
||||
setprop("/it-autoflight/mode/vert", "G/S");
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
alandt.start();
|
||||
thrustmode();
|
||||
}
|
||||
|
||||
# Autoland Stage 1 Logic (Land)
|
||||
var aland = func {
|
||||
var ap1 = getprop("/it-autoflight/output/ap1");
|
||||
var ap2 = getprop("/it-autoflight/output/ap2");
|
||||
if (getprop("/position/gear-agl-ft") <= 100) {
|
||||
setprop("/it-autoflight/input/lat", 4);
|
||||
setprop("/it-autoflight/input/vert", 6);
|
||||
}
|
||||
}
|
||||
|
||||
var aland1 = func {
|
||||
var aglal = getprop("/position/gear-agl-ft");
|
||||
if (aglal <= 50 and aglal > 5) {
|
||||
setprop("/it-autoflight/mode/vert", "FLARE");
|
||||
}
|
||||
var gear1 = getprop("/gear/gear[1]/wow");
|
||||
var gear2 = getprop("/gear/gear[2]/wow");
|
||||
if (gear1 == 1 or gear2 == 1) {
|
||||
setprop("/it-autoflight/input/ap1", 0);
|
||||
setprop("/it-autoflight/input/ap2", 0);
|
||||
alandt1.stop();
|
||||
}
|
||||
}
|
||||
|
||||
# Autoland Stage 2 Logic (Rollout)
|
||||
# Not yet working, planned.
|
||||
|
||||
# VNAV
|
||||
|
||||
# For Canvas Nav Display.
|
||||
setlistener("/it-autoflight/input/hdg", func {
|
||||
setprop("/autopilot/settings/heading-bug-deg", getprop("/it-autoflight/input/hdg"));
|
||||
});
|
||||
|
||||
setlistener("/it-autoflight/internal/alt", func {
|
||||
setprop("/autopilot/settings/target-altitude-ft", getprop("/it-autoflight/internal/alt"));
|
||||
});
|
||||
|
||||
# Timers
|
||||
var update_armst = maketimer(0.5, update_arms);
|
||||
var altcaptt = maketimer(0.5, altcapt);
|
||||
var thrustmodet = maketimer(0.5, thrustmode);
|
||||
var minmaxtimer = maketimer(0.5, minmax);
|
||||
var alandt = maketimer(0.5, aland);
|
||||
var alandt1 = maketimer(0.5, aland1);
|
||||
var reduct = maketimer(0.5, toga_reduc);
|
||||
var latarmt = maketimer(0.5, latarms);
|
||||
var fpa_calct = maketimer(0.1, fpa_calc);
|
||||
var lnavwptt = maketimer(1, lnavwpt);
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
# Airbus PFD FMA
|
||||
# Joshua Davidson (it0uchpods/411)
|
||||
|
||||
setprop("/FMGC/internal/cruise-ft", 10000);
|
||||
setprop("/it-autoflight/internal/alt", 10000);
|
||||
|
||||
# Speed or Mach?
|
||||
var speedmach = func {
|
||||
if ((getprop("/it-autoflight/output/vert") == 4) or (getprop("/it-autoflight/output/vert") == 6) or (getprop("/it-autoflight/output/vert") == 7)) {
|
||||
if ((getprop("/it-autoflight/output/vert") == 4) or (getprop("/it-autoflight/output/vert") == 7) or (getprop("/it-autoflight/output/vert") == 8)) {
|
||||
if (getprop("/it-autoflight/output/fd1") == 0 and getprop("/it-autoflight/output/fd2") == 0 and getprop("/it-autoflight/output/ap1") == 0 and getprop("/it-autoflight/output/ap2") == 0) {
|
||||
speedmach_b();
|
||||
} else {
|
||||
|
@ -82,6 +85,7 @@ setlistener("/it-autoflight/mode/vert", func {
|
|||
var newvert = getprop("/modes/pfd/fma/pitch-mode");
|
||||
var newvertarm = getprop("/modes/pfd/fma/pitch-mode2-armed");
|
||||
if (vert == "ALT HLD") {
|
||||
altvert();
|
||||
if (newvert != "ALT") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "ALT");
|
||||
}
|
||||
|
@ -89,6 +93,7 @@ setlistener("/it-autoflight/mode/vert", func {
|
|||
setprop("/modes/pfd/fma/pitch-mode2-armed", " ");
|
||||
}
|
||||
} else if (vert == "ALT CAP") {
|
||||
altvert();
|
||||
if (newvert != "ALT*") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "ALT*");
|
||||
}
|
||||
|
@ -152,9 +157,69 @@ setlistener("/it-autoflight/mode/vert", func {
|
|||
if (newvertarm != "ALT") {
|
||||
setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT");
|
||||
}
|
||||
} else if (vert == "MNG HLD") {
|
||||
if (newvert != "ALT") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "ALT");
|
||||
}
|
||||
if (newvertarm != " ") {
|
||||
setprop("/modes/pfd/fma/pitch-mode2-armed", " ");
|
||||
}
|
||||
} else if (vert == "MNG CAP") {
|
||||
if (newvert != "ALT*") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "ALT*");
|
||||
}
|
||||
if (newvertarm != " ") {
|
||||
setprop("/modes/pfd/fma/pitch-mode2-armed", " ");
|
||||
}
|
||||
} else if (vert == "MNG CLB") {
|
||||
if (newvert != "CLB") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "CLB");
|
||||
}
|
||||
if (newvertarm != "ALT") {
|
||||
setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT");
|
||||
}
|
||||
} else if (vert == "MNG DES") {
|
||||
if (newvert != "DES") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "DES");
|
||||
}
|
||||
if (newvertarm != "ALT") {
|
||||
setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT");
|
||||
}
|
||||
}
|
||||
altvert();
|
||||
});
|
||||
|
||||
var altvert = func {
|
||||
var FMGCalt = getprop("/FMGC/internal/cruise-ft");
|
||||
var MCPalt = getprop("/it-autoflight/internal/alt");
|
||||
var ALTdif = abs(FMGCalt - MCPalt);
|
||||
var vert = getprop("/it-autoflight/mode/vert");
|
||||
var newvert = getprop("/modes/pfd/fma/pitch-mode");
|
||||
if (ALTdif <= 20) {
|
||||
if (vert == "ALT HLD") {
|
||||
if (newvert != "ALT CRZ") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "ALT CRZ");
|
||||
}
|
||||
} else if (vert == "ALT CAP") {
|
||||
if (newvert != "ALT CRZ*") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "ALT CRZ*");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (vert == "ALT HLD") {
|
||||
if (newvert != "ALT") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "ALT");
|
||||
}
|
||||
} else if (vert == "ALT CAP") {
|
||||
if (newvert != "ALT*") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "ALT*");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setlistener("/FMGC/internal/cruise-ft", altvert);
|
||||
|
||||
# Arm HDG or NAV
|
||||
setlistener("/it-autoflight/mode/arm", func {
|
||||
var arm = getprop("/it-autoflight/mode/arm");
|
||||
|
|
|
@ -16,8 +16,23 @@
|
|||
<property>/it-autoflight/internal/altitude-5-sec-ahead</property>
|
||||
</input>
|
||||
<reference>
|
||||
<condition>
|
||||
<not-equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</not-equals>
|
||||
</condition>
|
||||
<property>/it-autoflight/internal/alt</property>
|
||||
</reference>
|
||||
<reference>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<property>/it-autoflight/internal/mng-alt</property>
|
||||
</reference>
|
||||
<gain>-8</gain>
|
||||
<output>
|
||||
<property>/it-autoflight/internal/target-fpm</property>
|
||||
|
@ -102,6 +117,16 @@
|
|||
<property>/it-autoflight/output/vert</property>
|
||||
<value>7</value>
|
||||
</equals>
|
||||
<and>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert-mng</property>
|
||||
<value>4</value>
|
||||
</equals>
|
||||
</and>
|
||||
</or>
|
||||
</condition>
|
||||
</enable>
|
||||
|
@ -149,10 +174,10 @@
|
|||
<config>
|
||||
<Kp>
|
||||
<condition>
|
||||
<equals>
|
||||
<not-equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>4</value>
|
||||
</equals>
|
||||
<value>7</value>
|
||||
</not-equals>
|
||||
</condition>
|
||||
<value>-50</value>
|
||||
</Kp>
|
||||
|
@ -273,6 +298,10 @@
|
|||
<property>/it-autoflight/output/vert</property>
|
||||
<value>7</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</equals>
|
||||
</or>
|
||||
<or>
|
||||
<equals>
|
||||
|
@ -301,10 +330,22 @@
|
|||
</input>
|
||||
<reference>
|
||||
<condition>
|
||||
<or>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>0</value>
|
||||
</equals>
|
||||
<and>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert-mng</property>
|
||||
<value>0</value>
|
||||
</equals>
|
||||
</and>
|
||||
</or>
|
||||
</condition>
|
||||
<property>/it-autoflight/internal/target-fpm</property>
|
||||
<scale>0.16667</scale>
|
||||
|
@ -330,6 +371,16 @@
|
|||
<property>/it-autoflight/output/vert</property>
|
||||
<value>7</value>
|
||||
</equals>
|
||||
<and>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert</property>
|
||||
<value>8</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>/it-autoflight/output/vert-mng</property>
|
||||
<value>4</value>
|
||||
</equals>
|
||||
</and>
|
||||
</or>
|
||||
</condition>
|
||||
<property>/it-autoflight/internal/target-fpm-b</property>
|
||||
|
|
|
@ -29,6 +29,20 @@
|
|||
<output>instrumentation/pfd/sel-alt-diff</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>Target alt diff (managed)</name>
|
||||
<type>gain</type>
|
||||
<update-interval-secs type="double">0.05</update-interval-secs>
|
||||
<gain>1.0</gain>
|
||||
<input>
|
||||
<property>/it-autoflight/internal/mng-alt</property>
|
||||
</input>
|
||||
<reference>
|
||||
<property>instrumentation/altimeter/indicated-altitude-ft</property>
|
||||
</reference>
|
||||
<output>instrumentation/pfd/mng-alt-diff</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<name>Heading Deg</name>
|
||||
<type>gain</type>
|
||||
|
|
Reference in a new issue