Sim: Refactor FCU AP Panel

This commit is contained in:
Joshua Davidson 2019-02-24 17:06:53 -05:00
parent 824eb1dca9
commit d25ae2b73c
8 changed files with 490 additions and 705 deletions

View file

@ -1081,17 +1081,7 @@
<desc>Autothrottle Disconnect</desc>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/output/athr") == 1) {
libraries.athrOff("soft");
setprop("/ECAM/warnings/master-caution-light", 1);
} else {
if (getprop("/it-autoflight/output/athr-warning") == 1) {
setprop("/it-autoflight/output/athr-warning", 0);
setprop("/ECAM/warnings/master-caution-light", 0);
}
}
</script>
<script>libraries.APPanel.ATDiscSoft();</script>
</binding>
</key>
<key n="6">
@ -1330,18 +1320,7 @@
<desc>Autopilot Disconnect</desc>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/output/ap1") == 1 or getprop("/it-autoflight/output/ap2") == 1) {
libraries.apOff("soft", 0);
} else {
if (getprop("/it-autoflight/sound/apoffsound") == 1 or getprop("/it-autoflight/sound/apoffsound2") == 1) {
setprop("/it-autoflight/sound/apoffsound", 0);
setprop("/it-autoflight/sound/apoffsound2", 0);
}
setprop("/it-autoflight/output/ap-warning", 0);
setprop("/ECAM/warnings/master-warning-light", 0);
}
</script>
<script>libraries.APPanel.APDiscSoft();</script>
</binding>
</key>
<key n="70">

View file

@ -2196,14 +2196,11 @@
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<condition>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
</condition>
<command>property-toggle</command>
<property>it-autoflight/input/fd1</property>
<command>nasal</command>
<script>
libraries.APPanel.FD1();
setprop("/sim/sounde/btn1", 1);
</script>
</binding>
</action>
</animation>
@ -2301,14 +2298,11 @@
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<condition>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
</condition>
<command>property-toggle</command>
<property>it-autoflight/input/fd2</property>
<command>nasal</command>
<script>
libraries.APPanel.FD2();
setprop("/sim/sounde/btn1", 1);
</script>
</binding>
</action>
</animation>
@ -3716,10 +3710,8 @@
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>it-autoflight/input/kts-mach</property>
<value>0</value>
<value>1</value>
<command>nasal</command>
<script>libraries.APPanel.IASMach();</script>
</binding>
<binding>
<command>nasal</command>
@ -3736,9 +3728,7 @@
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
libraries.mcpSPDKnbPush();
</script>
<script>libraries.APPanel.SPDPush();</script>
</binding>
<binding>
<command>nasal</command>
@ -3750,9 +3740,7 @@
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
libraries.mcpSPDKnbPull();
</script>
<script>libraries.APPanel.SPDPull();</script>
</binding>
<binding>
<command>nasal</command>
@ -3763,42 +3751,8 @@
<button>3</button>
<repeatable>true</repeatable>
<binding>
<condition>
<and>
<equals>
<property>it-autoflight/input/kts-mach</property>
<value>0</value>
</equals>
<equals>
<property>it-autoflight/input/spd-managed</property>
<value>0</value>
</equals>
</and>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/spd-kts</property>
<step>1</step>
<min>100</min>
<max>350</max>
</binding>
<binding>
<condition>
<and>
<equals>
<property>it-autoflight/input/kts-mach</property>
<value>1</value>
</equals>
<equals>
<property>it-autoflight/input/spd-managed</property>
<value>0</value>
</equals>
</and>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/spd-mach</property>
<step>0.001</step>
<min>0.50</min>
<max>0.82</max>
<command>nasal</command>
<script>libraries.APPanel.SPDAdjust(1);</script>
</binding>
<binding>
<command>property-adjust</command>
@ -3813,42 +3767,8 @@
<button>4</button>
<repeatable>true</repeatable>
<binding>
<condition>
<and>
<equals>
<property>it-autoflight/input/kts-mach</property>
<value>0</value>
</equals>
<equals>
<property>it-autoflight/input/spd-managed</property>
<value>0</value>
</equals>
</and>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/spd-kts</property>
<step>-1</step>
<min>100</min>
<max>350</max>
</binding>
<binding>
<condition>
<and>
<equals>
<property>it-autoflight/input/kts-mach</property>
<value>1</value>
</equals>
<equals>
<property>it-autoflight/input/spd-managed</property>
<value>0</value>
</equals>
</and>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/spd-mach</property>
<step>-0.001</step>
<min>0.50</min>
<max>0.82</max>
<command>nasal</command>
<script>libraries.APPanel.SPDAdjust(-1);</script>
</binding>
<binding>
<command>property-adjust</command>
@ -3869,7 +3789,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>libraries.mcpHDGKnbPush();</script>
<script>libraries.APPanel.HDGPush();</script>
</binding>
<binding>
<command>nasal</command>
@ -3881,7 +3801,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>libraries.mcpHDGKnbPull();</script>
<script>libraries.APPanel.HDGPull();</script>
</binding>
<binding>
<command>nasal</command>
@ -3892,28 +3812,8 @@
<button>3</button>
<repeatable>true</repeatable>
<binding>
<condition>
<not-equals>
<property>it-autoflight/output/lat</property>
<value>0</value>
</not-equals>
</condition>
<command>nasal</command>
<script>libraries.hdgInput();</script>
</binding>
<binding>
<condition>
<equals>
<property>it-autoflight/custom/show-hdg</property>
<value>1</value>
</equals>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/hdg</property>
<step>1</step>
<min>1</min>
<max>361</max>
<wrap>true</wrap>
<script>libraries.APPanel.HDGAdjust(1);</script>
</binding>
<binding>
<command>property-adjust</command>
@ -3928,28 +3828,8 @@
<button>4</button>
<repeatable>true</repeatable>
<binding>
<condition>
<not-equals>
<property>it-autoflight/output/lat</property>
<value>0</value>
</not-equals>
</condition>
<command>nasal</command>
<script>libraries.hdgInput();</script>
</binding>
<binding>
<condition>
<equals>
<property>it-autoflight/custom/show-hdg</property>
<value>1</value>
</equals>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/hdg</property>
<step>-1</step>
<min>1</min>
<max>361</max>
<wrap>true</wrap>
<script>libraries.APPanel.HDGAdjust(-1);</script>
</binding>
<binding>
<command>property-adjust</command>
@ -3969,9 +3849,8 @@
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>it-autoflight/input/lat</property>
<value>2</value>
<command>nasal</command>
<script>libraries.APPanel.LOCButton();</script>
</binding>
<binding>
<command>nasal</command>
@ -4024,9 +3903,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>
fmgc.toggle_trkfpa();
</script>
<script>libraries.APPanel.TRKFPA();</script>
</binding>
<binding>
<command>nasal</command>
@ -4041,18 +3918,11 @@
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>setprop("/sim/sounde/btn1", 1);</script>
</binding>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/input/ap1") == 0) {
setprop("it-autoflight/input/ap1", 1);
} else {
libraries.apOff("hard", 1);
}
libraries.APPanel.AP1();
setprop("/sim/sounde/btn1", 1);
</script>
</binding>
</action>
@ -4080,18 +3950,11 @@
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>nasal</command>
<script>setprop("/sim/sounde/btn1", 1);</script>
</binding>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/input/ap2") == 0) {
setprop("it-autoflight/input/ap2", 1);
} else {
libraries.apOff("hard", 2);
}
libraries.APPanel.AP2();
setprop("/sim/sounde/btn1", 1);
</script>
</binding>
</action>
@ -4119,18 +3982,11 @@
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>setprop("/sim/sounde/btn1", 1);</script>
</binding>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/input/athr") == 0) {
setprop("it-autoflight/input/athr", 1);
} else {
libraries.athrOff("hard");
}
libraries.APPanel.ATHR();
setprop("/sim/sounde/btn1", 1);
</script>
</binding>
</action>
@ -4155,27 +4011,24 @@
<animation>
<type>pick</type>
<object-name>alt-sel</object-name>
<!--action>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>it-autoflight/input/vert</property>
<value>8</value>
<command>nasal</command>
<script>libraries.APPanel.ALTPull();</script>
</binding>
<binding>
<command>nasal</command>
<script>setprop("/sim/sounde/btn1", 1);</script>
</binding>
</action-->
</action>
<action>
<button>0</button>
<button>1</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>it-autoflight/input/vert</property>
<value>4</value>
<command>nasal</command>
<script>libraries.APPanel.ALTPush();</script>
</binding>
<binding>
<command>nasal</command>
@ -4186,30 +4039,8 @@
<button>3</button>
<repeatable>true</repeatable>
<binding>
<condition>
<equals>
<property>it-autoflight/config/altitude-dial-mode</property>
<value>0</value>
</equals>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/alt</property>
<step>100</step>
<min>0</min>
<max>50000</max>
</binding>
<binding>
<condition>
<equals>
<property>it-autoflight/config/altitude-dial-mode</property>
<value>1</value>
</equals>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/alt</property>
<step>1000</step>
<min>0</min>
<max>50000</max>
<command>nasal</command>
<script>libraries.APPanel.ALTAdjust(1);</script>
</binding>
<binding>
<command>property-adjust</command>
@ -4224,30 +4055,8 @@
<button>4</button>
<repeatable>true</repeatable>
<binding>
<condition>
<equals>
<property>it-autoflight/config/altitude-dial-mode</property>
<value>0</value>
</equals>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/alt</property>
<step>-100</step>
<min>0</min>
<max>50000</max>
</binding>
<binding>
<condition>
<equals>
<property>it-autoflight/config/altitude-dial-mode</property>
<value>1</value>
</equals>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/alt</property>
<step>-1000</step>
<min>0</min>
<max>50000</max>
<command>nasal</command>
<script>libraries.APPanel.ALTAdjust(-1);</script>
</binding>
<binding>
<command>property-adjust</command>
@ -4267,10 +4076,8 @@
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-cycle</command>
<command>property-toggle</command>
<property>it-autoflight/config/altitude-dial-mode</property>
<value>0</value>
<value>1</value>
</binding>
<binding>
<command>nasal</command>
@ -4286,48 +4093,8 @@
<button>0</button>
<repeatable>false</repeatable>
<binding>
<condition>
<equals>
<property>it-autoflight/custom/trk-fpa</property>
<value>0</value>
</equals>
</condition>
<command>property-assign</command>
<property>it-autoflight/input/vert</property>
<value>1</value>
</binding>
<binding>
<condition>
<equals>
<property>it-autoflight/custom/trk-fpa</property>
<value>0</value>
</equals>
</condition>
<command>property-assign</command>
<property>it-autoflight/input/vs</property>
<value>0</value>
</binding>
<binding>
<condition>
<equals>
<property>it-autoflight/custom/trk-fpa</property>
<value>1</value>
</equals>
</condition>
<command>property-assign</command>
<property>it-autoflight/input/vert</property>
<value>5</value>
</binding>
<binding>
<condition>
<equals>
<property>it-autoflight/custom/trk-fpa</property>
<value>1</value>
</equals>
</condition>
<command>property-assign</command>
<property>it-autoflight/input/fpa</property>
<value>0.0</value>
<command>nasal</command>
<script>libraries.APPanel.VSPush();</script>
</binding>
<binding>
<command>nasal</command>
@ -4339,13 +4106,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/custom/trk-fpa") == 0) {
setprop("/it-autoflight/input/vert", 1);
} else if (getprop("/it-autoflight/custom/trk-fpa") == 1) {
setprop("/it-autoflight/input/vert", 5);
}
</script>
<script>libraries.APPanel.VSPull();</script>
</binding>
<binding>
<command>nasal</command>
@ -4357,37 +4118,7 @@
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/output/vert") != 1 and getprop("/it-autoflight/custom/trk-fpa") == 0) {
setprop("/it-autoflight/input/vert", 1);
} else if (getprop("/it-autoflight/output/vert") != 5 and getprop("/it-autoflight/custom/trk-fpa") == 1) {
setprop("/it-autoflight/input/vert", 5);
}
</script>
</binding>
<binding>
<condition>
<equals>
<property>it-autoflight/output/vert</property>
<value>1</value>
</equals>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/vs</property>
<step>100</step>
<max>8000</max>
</binding>
<binding>
<condition>
<equals>
<property>it-autoflight/output/vert</property>
<value>5</value>
</equals>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/fpa</property>
<step>0.1</step>
<max>20.9</max>
<script>libraries.APPanel.VSAdjust(1);</script>
</binding>
<binding>
<command>property-adjust</command>
@ -4403,37 +4134,7 @@
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/output/vert") != 1 and getprop("/it-autoflight/custom/trk-fpa") == 0) {
setprop("/it-autoflight/input/vert", 1);
} else if (getprop("/it-autoflight/output/vert") != 5 and getprop("/it-autoflight/custom/trk-fpa") == 1) {
setprop("/it-autoflight/input/vert", 5);
}
</script>
</binding>
<binding>
<condition>
<equals>
<property>it-autoflight/output/vert</property>
<value>1</value>
</equals>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/vs</property>
<step>-100</step>
<min>-6000</min>
</binding>
<binding>
<condition>
<equals>
<property>it-autoflight/output/vert</property>
<value>5</value>
</equals>
</condition>
<command>property-adjust</command>
<property>it-autoflight/input/fpa</property>
<step>-0.1</step>
<min>-20.9</min>
<script>libraries.APPanel.VSAdjust(-1);</script>
</binding>
<binding>
<command>property-adjust</command>
@ -4453,9 +4154,8 @@
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>it-autoflight/input/vert</property>
<value>2</value>
<command>nasal</command>
<script>libraries.APPanel.APPRButton();</script>
</binding>
<binding>
<command>nasal</command>

View file

@ -379,7 +379,7 @@ setlistener("/flight-management/control/capture-leg", func(n) {
}, 0, 0);
var showNd = func(nd = nil) {
if(nd == nil) nd = "main";
var dlg = canvas.Window.new([512, 512], "dialog");
if (nd == nil) nd = "main";
var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1);
dlg.setCanvas(nd_display[nd]);
}

View file

@ -614,6 +614,12 @@ var vertical = func {
}
}
var disarmGS = func {
alandt.stop();
alandt1.stop();
setprop("/it-autoflight/output/appr-armed", 0);
}
# Helpers
var toggle_trkfpa = func {
var trkfpa = getprop("/it-autoflight/custom/trk-fpa");

View file

@ -164,66 +164,372 @@ var CVR_test = func {
}
}
var mcpSPDKnbPull = func {
setprop("/it-autoflight/input/spd-managed", 0);
fmgc.ManagedSPD.stop();
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-mach", math.round(mach, 0.001));
} else if (mach < 0.50) {
setprop("/it-autoflight/input/spd-mach", 0.50);
} else if (mach > 0.95) {
setprop("/it-autoflight/input/spd-mach", 0.95);
}
}
}
var ktsMach = props.globals.getNode("/it-autoflight/input/kts-mach", 1);
var iasSet = props.globals.getNode("/it-autoflight/input/spd-kts", 1);
var machSet = props.globals.getNode("/it-autoflight/input/spd-mach", 1);
var hdgSet = props.globals.getNode("/it-autoflight/input/hdg", 1);
var altSet = props.globals.getNode("/it-autoflight/input/alt", 1);
var altSetMode = props.globals.getNode("/it-autoflight/config/altitude-dial-mode", 1);
var vsSet = props.globals.getNode("/it-autoflight/input/vs", 1);
var fpaSet = props.globals.getNode("/it-autoflight/input/fpa", 1);
var iasNow = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-speed-kt", 1);
var machNow = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-mach", 1);
var spdManaged = props.globals.getNode("/it-autoflight/input/spd-managed", 1);
var showHDG = props.globals.getNode("/it-autoflight/custom/show-hdg", 1);
var trkfpaSW = props.globals.getNode("/it-autoflight/custom/trk-fpa", 1);
var latMode = props.globals.getNode("/it-autoflight/output/lat", 1);
var vertMode = props.globals.getNode("/it-autoflight/output/vert", 1);
var locArm = props.globals.getNode("/it-autoflight/output/loc-armed", 1);
var apprArm = props.globals.getNode("/it-autoflight/output/appr-armed", 1);
var dcEss = props.globals.getNode("/systems/electrical/bus/dc-ess", 1);
var fd1 = props.globals.getNode("/it-autoflight/output/fd1", 1);
var fd2 = props.globals.getNode("/it-autoflight/output/fd2", 1);
var ap1 = props.globals.getNode("/it-autoflight/output/ap1", 1);
var ap2 = props.globals.getNode("/it-autoflight/output/ap2", 1);
var athr = props.globals.getNode("/it-autoflight/output/athr", 1);
var mcpSPDKnbPush = func {
if (getprop("/FMGC/internal/cruise-lvl-set") == 1 and getprop("/FMGC/internal/cost-index-set") == 1) {
setprop("/it-autoflight/input/spd-managed", 1);
fmgc.ManagedSPD.start();
}
}
var mcpHDGKnbPull = func {
if (getprop("/it-autoflight/output/fd1") == 1 or getprop("/it-autoflight/output/fd2") == 1 or getprop("/it-autoflight/output/ap1") == 1 or getprop("/it-autoflight/output/ap2") == 1) {
var latmode = getprop("/it-autoflight/output/lat");
var showhdg = getprop("/it-autoflight/custom/show-hdg");
if (latmode == 0 or showhdg == 0) {
setprop("/it-autoflight/input/lat", 3);
setprop("/it-autoflight/custom/show-hdg", 1);
var APPanel = {
AP1: func() {
if (dcEss.getValue() >= 25) {
if (!ap1.getBoolValue()) {
setprop("it-autoflight/input/ap1", 1);
} else {
libraries.apOff("hard", 1);
}
}
},
AP2: func() {
if (dcEss.getValue() >= 25) {
if (!ap2.getBoolValue()) {
setprop("it-autoflight/input/ap2", 1);
} else {
libraries.apOff("hard", 2);
}
}
},
ATHR: func() {
if (dcEss.getValue() >= 25) {
if (!athr.getBoolValue()) {
setprop("it-autoflight/input/athr", 1);
} else {
libraries.athrOff("hard");
}
}
},
FD1: func() {
if (dcEss.getValue() >= 25) {
if (!fd1.getBoolValue()) {
setprop("it-autoflight/input/fd1", 1);
} else {
setprop("it-autoflight/input/fd1", 0);
}
}
},
FD2: func() {
if (dcEss.getValue() >= 25) {
if (!fd2.getBoolValue()) {
setprop("it-autoflight/input/fd2", 1);
} else {
setprop("it-autoflight/input/fd2", 0);
}
}
},
APDiscSoft: func() {
if (ap1.getBoolValue() or ap2.getBoolValue()) {
libraries.apOff("soft", 0);
} else {
setprop("/it-autoflight/input/lat", 0);
setprop("/it-autoflight/custom/show-hdg", 1);
if (getprop("/it-autoflight/sound/apoffsound") == 1 or getprop("/it-autoflight/sound/apoffsound2") == 1) {
setprop("/it-autoflight/sound/apoffsound", 0);
setprop("/it-autoflight/sound/apoffsound2", 0);
}
setprop("/it-autoflight/output/ap-warning", 0);
setprop("/ECAM/warnings/master-warning-light", 0);
}
}
}
},
ATDiscSoft: func() {
if (athr.getBoolValue()) {
libraries.athrOff("soft");
setprop("/ECAM/warnings/master-caution-light", 1);
} else {
if (getprop("/it-autoflight/output/athr-warning") == 1) {
setprop("/it-autoflight/output/athr-warning", 0);
setprop("/ECAM/warnings/master-caution-light", 0);
}
}
},
IASMach: func() {
if (dcEss.getValue() >= 25) {
if (ktsMach.getBoolValue()) {
ktsMach.setBoolValue(0);
} else {
ktsMach.setBoolValue(1);
}
}
},
SPDPush: func() {
if (dcEss.getValue() >= 25) {
if (getprop("/FMGC/internal/cruise-lvl-set") == 1 and getprop("/FMGC/internal/cost-index-set") == 1) {
spdManaged.setBoolValue(1);
fmgc.ManagedSPD.start();
}
}
},
SPDPull: func() {
if (dcEss.getValue() >= 25) {
spdManaged.setBoolValue(0);
fmgc.ManagedSPD.stop();
var ias = iasNow.getValue();
var mach = machNow.getValue();
if (!ktsMach.getBoolValue()) {
if (ias >= 100 and ias <= 350) {
iasSet.setValue(math.round(ias));
} else if (ias < 100) {
iasSet.setValue(100);
} else if (ias > 350) {
iasSet.setValue(350);
}
} else if (ktsMach.getBoolValue()) {
if (mach >= 0.50 and mach <= 0.82) {
machSet.setValue(math.round(mach, 0.001));
} else if (mach < 0.50) {
machSet.setValue(0.50);
} else if (mach > 0.82) {
machSet.setValue(0.82);
}
}
}
},
SPDAdjust: func(d) {
if (dcEss.getValue() >= 25) {
if (!spdManaged.getBoolValue()) {
if (ktsMach.getBoolValue()) {
var machTemp = machSet.getValue();
if (d == 1) {
machTemp = math.round(machTemp + 0.001, 0.001); # Kill floating point error
} else if (d == -1) {
machTemp = math.round(machTemp - 0.001, 0.001); # Kill floating point error
} else if (d == 10) {
machTemp = math.round(machTemp + 0.01, 0.01); # Kill floating point error
} else if (d == -10) {
machTemp = math.round(machTemp - 0.01, 0.01); # Kill floating point error
}
if (machTemp < 0.50) {
machSet.setValue(0.50);
} else if (machTemp > 0.82) {
machSet.setValue(0.82);
} else {
machSet.setValue(machTemp);
}
} else {
var iasTemp = iasSet.getValue();
if (d == 1) {
iasTemp = iasTemp + 1;
} else if (d == -1) {
iasTemp = iasTemp - 1;
} else if (d == 10) {
iasTemp = iasTemp + 10;
} else if (d == -10) {
iasTemp = iasTemp - 10;
}
if (iasTemp < 100) {
iasSet.setValue(100);
} else if (iasTemp > 350) {
iasSet.setValue(350);
} else {
iasSet.setValue(iasTemp);
}
}
}
}
},
HDGPush: func() {
if (fd1.getBoolValue() or fd2.getBoolValue() or ap1.getBoolValue() or ap2.getBoolValue()) {
setprop("/it-autoflight/input/lat", 1);
}
},
HDGPull: func() {
if (fd1.getBoolValue() or fd2.getBoolValue() or ap1.getBoolValue() or ap2.getBoolValue()) {
if (latMode.getValue() == 0 or !showHDG.getBoolValue()) {
setprop("/it-autoflight/input/lat", 3);
showHDG.setBoolValue(1);
} else {
setprop("/it-autoflight/input/lat", 0);
showHDG.setBoolValue(1);
}
}
},
HDGAdjust: func(d) {
if (dcEss.getValue() >= 25) {
if (latMode.getValue() != 0) {
hdgInput();
}
if (showHDG.getBoolValue()) {
var hdgTemp = hdgSet.getValue();
if (d == 1) {
hdgTemp = hdgTemp + 1;
} else if (d == -1) {
hdgTemp = hdgTemp - 1;
} else if (d == 10) {
hdgTemp = hdgTemp + 10;
} else if (d == -10) {
hdgTemp = hdgTemp - 10;
}
if (hdgTemp < 0.5) {
hdgSet.setValue(hdgTemp + 360);
} else if (hdgTemp >= 360.5) {
hdgSet.setValue(hdgTemp - 360);
} else {
hdgSet.setValue(hdgTemp);
}
}
}
},
LOCButton: func() {
if (dcEss.getValue() >= 25) {
var vertTemp = vertMode.getValue();
if ((locArm.getBoolValue() or latMode.getValue() == 2) and !apprArm.getBoolValue() and vertTemp != 2 and vertTemp != 6) {
setprop("/it-autoflight/input/lat", 0);
} else {
setprop("/it-autoflight/input/lat", 2);
if (apprArm.getBoolValue() or vertTemp == 2) {
fmgc.disarmGS();
}
}
}
},
TRKFPA: func() {
if (dcEss.getValue() >= 25) {
fmgc.toggle_trkfpa();
}
},
ALTPush: func() {
if (dcEss.getValue() >= 25) {
# setprop("/it-autoflight/input/vert", 8); # He don't work yet m8
}
},
ALTPull: func() {
if (dcEss.getValue() >= 25) {
setprop("/it-autoflight/input/vert", 4);
}
},
ALTAdjust: func(d) {
if (dcEss.getValue() >= 25) {
var altTemp = altSet.getValue();
if (d == 1) {
if (altSetMode.getBoolValue()) {
altTemp = altTemp + 1000;
} else {
altTemp = altTemp + 100;
}
} else if (d == -1) {
if (altSetMode.getBoolValue()) {
altTemp = altTemp - 1000;
} else {
altTemp = altTemp - 100;
}
} else if (d == 2) {
altTemp = altTemp + 100;
} else if (d == -2) {
altTemp = altTemp - 100;
} else if (d == 10) {
altTemp = altTemp + 1000;
} else if (d == -10) {
altTemp = altTemp - 1000;
}
if (altTemp < 0) {
altSet.setValue(0);
} else if (altTemp > 50000) {
altSet.setValue(50000);
} else {
altSet.setValue(altTemp);
}
}
},
VSPush: func() {
if (dcEss.getValue() >= 25) {
if (trkfpaSW.getBoolValue()) {
setprop("/it-autoflight/input/vert", 5);
setprop("/it-autoflight/input/fpa", 0);
} else {
setprop("/it-autoflight/input/vert", 1);
setprop("/it-autoflight/input/vs", 0);
}
}
},
VSPull: func() {
if (dcEss.getValue() >= 25) {
if (trkfpaSW.getBoolValue()) {
setprop("/it-autoflight/input/vert", 5);
} else {
setprop("/it-autoflight/input/vert", 1);
}
}
},
VSAdjust: func(d) {
if (dcEss.getValue() >= 25) {
if (vertMode.getValue() == 1) {
var vsTemp = vsSet.getValue();
if (d == 1) {
vsTemp = vsTemp + 100;
} else if (d == -1) {
vsTemp = vsTemp - 100;
} else if (d == 10) {
vsTemp = vsTemp + 1000;
} else if (d == -10) {
vsTemp = vsTemp - 1000;
}
if (vsTemp < -6000) {
vsSet.setValue(-6000);
} else if (vsTemp > 6000) {
vsSet.setValue(6000);
} else {
vsSet.setValue(vsTemp);
}
} else if (vertMode.getValue() == 5) {
var fpaTemp = fpaSet.getValue();
if (d == 1) {
fpaTemp = math.round(fpaTemp + 0.1, 0.1);
} else if (d == -1) {
fpaTemp = math.round(fpaTemp - 0.1, 0.1);
} else if (d == 10) {
fpaTemp = fpaTemp + 1;
} else if (d == -10) {
fpaTemp = fpaTemp - 1;
}
if (fpaTemp < -9.9) {
fpaSet.setValue(-9.9);
} else if (fpaTemp > 9.9) {
fpaSet.setValue(9.9);
} else {
fpaSet.setValue(fpaTemp);
}
}
if ((vertMode.getValue() != 1 and !trkfpaSW.getBoolValue()) or (vertMode.getValue() != 5 and trkfpaSW.getBoolValue())) {
me.VSPull();
}
}
},
APPRButton: func() {
if (dcEss.getValue() >= 25) {
var vertTemp = vertMode.getValue();
if ((locArm.getBoolValue() or latMode.getValue() == 2) and (apprArm.getBoolValue() or vertTemp == 2 or vertTemp == 6)) {
setprop("/it-autoflight/input/lat", 0);
me.VSPull();
} else {
setprop("/it-autoflight/input/vert", 2);
}
}
},
};
var hdgInput = func {
var latmode = getprop("/it-autoflight/output/lat");
if (latmode != 0) {
setprop("/it-autoflight/custom/show-hdg", 1);
if (latMode.getValue() != 0) {
showHDG.setBoolValue(1);
var hdgnow = getprop("/it-autoflight/input/hdg");
setprop("/modes/fcu/hdg-time", getprop("/sim/time/elapsed-sec"));
}
}
var mcpHDGKnbPush = func {
if (getprop("/it-autoflight/output/fd1") == 1 or getprop("/it-autoflight/output/fd2") == 1 or getprop("/it-autoflight/output/ap1") == 1 or getprop("/it-autoflight/output/ap2") == 1) {
setprop("/it-autoflight/input/lat", 1);
}
}
var toggleSTD = func {
var Std = getprop("/modes/altimeter/std");
if (Std == 1) {

View file

@ -728,10 +728,10 @@
<gain>1.0</gain>
<input>
<condition>
<greater-than>
<greater-than-equals>
<property>/it-autoflight/internal/heading-predicted-cmd</property>
<value>360</value>
</greater-than>
<value>360.5</value>
</greater-than-equals>
</condition>
<expression>
<dif>

View file

@ -4,7 +4,6 @@
<!-- IT-AUTOFLIGHT Autopilot Control Dialog -->
<PropertyList>
<name>autopilot</name>
@ -39,13 +38,7 @@
<pref-width>43</pref-width>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/input/athr") == 0) {
setprop("it-autoflight/input/athr", 1);
} else {
libraries.athrOff("hard");
}
</script>
<script>libraries.APPanel.ATHR();</script>
</binding>
</button>
<button>
@ -53,13 +46,7 @@
<pref-width>43</pref-width>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/input/ap1") == 0) {
setprop("it-autoflight/input/ap1", 1);
} else {
libraries.apOff("hard", 1);
}
</script>
<script>libraries.APPanel.AP1();</script>
</binding>
</button>
<button>
@ -67,29 +54,23 @@
<pref-width>43</pref-width>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/input/ap2") == 0) {
setprop("it-autoflight/input/ap2", 1);
} else {
libraries.apOff("hard", 2);
}
</script>
<script>libraries.APPanel.AP2();</script>
</binding>
</button>
<button>
<legend>FD1</legend>
<pref-width>43</pref-width>
<binding>
<command>property-toggle</command>
<property>/it-autoflight/input/fd1</property>
<command>nasal</command>
<script>libraries.APPanel.FD1();</script>
</binding>
</button>
<button>
<legend>FD2</legend>
<pref-width>43</pref-width>
<binding>
<command>property-toggle</command>
<property>/it-autoflight/input/fd2</property>
<command>nasal</command>
<script>libraries.APPanel.FD2();</script>
</binding>
</button>
</group>
@ -102,16 +83,7 @@
<pref-width>119</pref-width>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/input/athr") == 1) {
libraries.athrOff("soft");
} else {
if (getprop("/it-autoflight/output/athr-warning") == 1) {
setprop("/it-autoflight/output/athr-warning", 0);
setprop("/ECAM/warnings/master-caution-light", 0);
}
}
</script>
<script>libraries.APPanel.ATDiscSoft();</script>
</binding>
</button>
<button>
@ -119,18 +91,7 @@
<pref-width>119</pref-width>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/input/ap1") == 1 or getprop("/it-autoflight/input/ap1") == 2) {
libraries.apOff("soft", 0);
} else {
if (getprop("/it-autoflight/sound/apoffsound") == 1 or getprop("/it-autoflight/sound/apoffsound2") == 1) {
setprop("/it-autoflight/sound/apoffsound", 0);
setprop("/it-autoflight/sound/apoffsound2", 0);
}
setprop("/it-autoflight/output/ap-warning", 0);
setprop("/ECAM/warnings/master-warning-light", 0);
}
</script>
<script>libraries.APPanel.APDiscSoft();</script>
</binding>
</button>
</group>
@ -359,9 +320,7 @@
<pref-width>65</pref-width>
<binding>
<command>nasal</command>
<script>
libraries.mcpSPDKnbPush();
</script>
<script>libraries.APPanel.SPDPush();</script>
</binding>
</button>
@ -370,19 +329,15 @@
<pref-width>65</pref-width>
<binding>
<command>nasal</command>
<script>
libraries.mcpSPDKnbPull();
</script>
<script>libraries.APPanel.SPDPull();</script>
</binding>
</button>
<button>
<legend>Speed/Mach</legend>
<binding>
<command>property-cycle</command>
<property>/it-autoflight/input/kts-mach</property>
<value>0</value>
<value>1</value>
<command>nasal</command>
<script>libraries.APPanel.IASMach();</script>
</binding>
</button>
@ -416,12 +371,8 @@
</and>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/spd-kts</property>
<min>100</min>
<max>350</max>
<step>-10</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.SPDAdjust(-10);</script>
</binding>
</button>
<button>
@ -443,12 +394,8 @@
</and>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/spd-kts</property>
<min>100</min>
<max>350</max>
<step>-1</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.SPDAdjust(-1);</script>
</binding>
</button>
@ -470,9 +417,6 @@
</equals>
</and>
</enable>
<binding>
<command>dialog-apply</command>
</binding>
</input>
<button>
@ -494,12 +438,8 @@
</and>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/spd-kts</property>
<min>100</min>
<max>350</max>
<step>1</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.SPDAdjust(1);</script>
</binding>
</button>
<button>
@ -522,12 +462,8 @@
</and>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/spd-kts</property>
<min>100</min>
<max>350</max>
<step>10</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.SPDAdjust(10);</script>
</binding>
</button>
@ -561,12 +497,8 @@
</and>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/spd-mach</property>
<min>0.50</min>
<max>0.82</max>
<step>-0.01</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.SPDAdjust(-10);</script>
</binding>
</button>
<button>
@ -588,12 +520,8 @@
</and>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/spd-mach</property>
<min>0.50</min>
<max>0.82</max>
<step>-0.001</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.SPDAdjust(-1);</script>
</binding>
</button>
@ -615,9 +543,6 @@
</equals>
</and>
</enable>
<binding>
<command>dialog-apply</command>
</binding>
</input>
<button>
@ -639,12 +564,8 @@
</and>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/spd-mach</property>
<min>0.50</min>
<max>0.82</max>
<step>0.001</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.SPDAdjust(1);</script>
</binding>
</button>
<button>
@ -667,12 +588,8 @@
</and>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/spd-mach</property>
<min>0.50</min>
<max>0.82</max>
<step>0.01</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.SPDAdjust(10);</script>
</binding>
</button>
@ -700,7 +617,7 @@
<pref-width>75</pref-width>
<binding>
<command>nasal</command>
<script>libraries.mcpHDGKnbPush();</script>
<script>libraries.APPanel.HDGPush();</script>
</binding>
</button>
@ -709,7 +626,7 @@
<pref-width>75</pref-width>
<binding>
<command>nasal</command>
<script>libraries.mcpHDGKnbPull();</script>
<script>libraries.APPanel.HDGPull();</script>
</binding>
</button>
@ -717,9 +634,8 @@
<legend>LOC</legend>
<pref-width>75</pref-width>
<binding>
<command>property-assign</command>
<property>/it-autoflight/input/lat</property>
<value>2</value>
<command>nasal</command>
<script>libraries.APPanel.LOCButton();</script>
</binding>
</button>
</group>
@ -746,12 +662,8 @@
</equals>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/hdg</property>
<min>1</min>
<max>361</max>
<step>-10</step>
<wrap>true</wrap>
<command>nasal</command>
<script>libraries.APPanel.HDGAdjust(-10);</script>
</binding>
</button>
<button>
@ -767,12 +679,8 @@
</equals>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/hdg</property>
<min>1</min>
<max>361</max>
<step>-1</step>
<wrap>true</wrap>
<command>nasal</command>
<script>libraries.APPanel.HDGAdjust(-1);</script>
</binding>
</button>
@ -788,9 +696,6 @@
<value>1</value>
</equals>
</enable>
<binding>
<command>dialog-apply</command>
</binding>
</input>
<button>
@ -806,12 +711,8 @@
</equals>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/hdg</property>
<min>1</min>
<max>361</max>
<step>1</step>
<wrap>true</wrap>
<command>nasal</command>
<script>libraries.APPanel.HDGAdjust(1);</script>
</binding>
</button>
<button>
@ -828,12 +729,8 @@
</equals>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/hdg</property>
<min>1</min>
<max>361</max>
<step>10</step>
<wrap>true</wrap>
<command>nasal</command>
<script>libraries.APPanel.HDGAdjust(10);</script>
</binding>
</button>
</group>
@ -900,48 +797,8 @@
<legend>V/S Push</legend>
<pref-width>75</pref-width>
<binding>
<condition>
<equals>
<property>/it-autoflight/custom/trk-fpa</property>
<value>0</value>
</equals>
</condition>
<command>property-assign</command>
<property>/it-autoflight/input/vert</property>
<value>1</value>
</binding>
<binding>
<condition>
<equals>
<property>/it-autoflight/custom/trk-fpa</property>
<value>0</value>
</equals>
</condition>
<command>property-assign</command>
<property>/it-autoflight/input/vs</property>
<value>0</value>
</binding>
<binding>
<condition>
<equals>
<property>/it-autoflight/custom/trk-fpa</property>
<value>1</value>
</equals>
</condition>
<command>property-assign</command>
<property>/it-autoflight/input/vert</property>
<value>5</value>
</binding>
<binding>
<condition>
<equals>
<property>/it-autoflight/custom/trk-fpa</property>
<value>1</value>
</equals>
</condition>
<command>property-assign</command>
<property>/it-autoflight/input/fpa</property>
<value>0.0</value>
<command>nasal</command>
<script>libraries.APPanel.VSPush();</script>
</binding>
</button>
@ -950,13 +807,7 @@
<pref-width>75</pref-width>
<binding>
<command>nasal</command>
<script>
if (getprop("/it-autoflight/custom/trk-fpa") == 0) {
setprop("/it-autoflight/input/vert", 1);
} else if (getprop("/it-autoflight/custom/trk-fpa") == 1) {
setprop("/it-autoflight/input/vert", 5);
}
</script>
<script>libraries.APPanel.VSPull();</script>
</binding>
</button>
@ -964,9 +815,8 @@
<pref-width>75</pref-width>
<legend>APPR</legend>
<binding>
<command>property-assign</command>
<property>/it-autoflight/input/vert</property>
<value>2</value>
<command>nasal</command>
<script>libraries.APPanel.APPRButton();</script>
</binding>
</button>
</group>
@ -987,12 +837,8 @@
<pref-height>25</pref-height>
<legend>&lt;&lt;</legend>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/alt</property>
<min>0</min>
<max>50000</max>
<step>-1000</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.ALTAdjust(-10);</script>
</binding>
</button>
<button>
@ -1002,12 +848,8 @@
<pref-height>25</pref-height>
<legend>&lt;</legend>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/alt</property>
<min>0</min>
<max>50000</max>
<step>-100</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.ALTAdjust(-2);</script>
</binding>
</button>
@ -1029,12 +871,8 @@
<pref-height>25</pref-height>
<legend>&gt;</legend>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/alt</property>
<min>0</min>
<max>50000</max>
<step>100</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.ALTAdjust(2);</script>
</binding>
</button>
<button>
@ -1045,12 +883,8 @@
<pref-height>25</pref-height>
<legend>&gt;&gt;</legend>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/alt</property>
<min>0</min>
<max>50000</max>
<step>1000</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.ALTAdjust(10);</script>
</binding>
</button>
</group>
@ -1077,12 +911,8 @@
</equals>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/vs</property>
<min>-6000</min>
<max>6000</max>
<step>-1000</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.VSAdjust(-10);</script>
</binding>
</button>
<button>
@ -1098,12 +928,8 @@
</equals>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/vs</property>
<min>-6000</min>
<max>6000</max>
<step>-100</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.VSAdjust(-1);</script>
</binding>
</button>
@ -1119,9 +945,6 @@
<value>1</value>
</equals>
</enable>
<binding>
<command>dialog-apply</command>
</binding>
</input>
<button>
@ -1137,12 +960,8 @@
</equals>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/vs</property>
<min>-6000</min>
<max>6000</max>
<step>100</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.VSAdjust(1);</script>
</binding>
</button>
<button>
@ -1159,12 +978,8 @@
</equals>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/vs</property>
<min>-6000</min>
<max>6000</max>
<step>1000</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.VSAdjust(10);</script>
</binding>
</button>
</group>
@ -1191,12 +1006,8 @@
</equals>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/fpa</property>
<min>-9.9</min>
<max>9.9</max>
<step>-1</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.VSAdjust(-10);</script>
</binding>
</button>
<button>
@ -1212,12 +1023,8 @@
</equals>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/fpa</property>
<min>-9.9</min>
<max>9.9</max>
<step>-0.1</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.VSAdjust(-1);</script>
</binding>
</button>
@ -1233,9 +1040,6 @@
<value>5</value>
</equals>
</enable>
<binding>
<command>dialog-apply</command>
</binding>
</input>
<button>
@ -1251,12 +1055,8 @@
</equals>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/fpa</property>
<min>-9.9</min>
<max>9.9</max>
<step>0.1</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.VSAdjust(1);</script>
</binding>
</button>
<button>
@ -1273,12 +1073,8 @@
</equals>
</enable>
<binding>
<command>property-adjust</command>
<property>/it-autoflight/input/fpa</property>
<min>-9.9</min>
<max>9.9</max>
<step>1</step>
<wrap>false</wrap>
<command>nasal</command>
<script>libraries.APPanel.VSAdjust(10);</script>
</binding>
</button>
</group>
@ -1315,9 +1111,7 @@
<pref-width>120</pref-width>
<binding>
<command>nasal</command>
<script>
fmgc.toggle_trkfpa();
</script>
<script>libraries.APPanel.TRKFPA();</script>
</binding>
</button>

View file

@ -1 +1 @@
4767
4770