1
0
Fork 0

FMGC: Fix DH/MDA system and make sounds work properly and fix overlap

This commit is contained in:
Josh Davidson 2020-04-20 18:14:32 -04:00 committed by Jonathan Redpath
parent 66cedaa032
commit b69c83a545
6 changed files with 303 additions and 79 deletions

View file

@ -1367,6 +1367,11 @@
</voice>
</mk-viii>
<pfd n="0">
<hundred-above type="int">99999</hundred-above>
<minimums type="int">99999</minimums>
</pfd>
<radar-altimeter n="0">
<antenna>
<x-offset-m type="double">-1</x-offset-m>

View file

@ -136,6 +136,8 @@ var vr_set = props.globals.getNode("FMGC/internal/vr-set", 1);
var v2 = props.globals.getNode("FMGC/internal/v2", 1);
var v2_set = props.globals.getNode("FMGC/internal/v2-set", 1);
var flap_config = props.globals.getNode("controls/flight/flap-lever", 1);
var hundredAbove = props.globals.getNode("/instrumentation/pfd/hundred-above", 1);
var minimum = props.globals.getNode("/instrumentation/pfd/minimums", 1);
# Create Nodes:
var vs_needle = props.globals.initNode("/instrumentation/pfd/vs-needle", 0.0, "DOUBLE");
@ -172,8 +174,6 @@ var altFlash2 = props.globals.initNode("/instrumentation/pfd/flash-indicators/al
var amberFlash1 = props.globals.initNode("/instrumentation/pfd/flash-indicators/amber-flash-1", 0, "BOOL");
var amberFlash2 = props.globals.initNode("/instrumentation/pfd/flash-indicators/amber-flash-2", 0, "BOOL");
var dhFlash = props.globals.initNode("/instrumentation/pfd/flash-indicators/dh-flash", 0, "BOOL");
var hundredAbove = props.globals.initNode("/instrumentation/pfd/hundred-above", 99999, "INT");
var minimum = props.globals.initNode("/instrumentation/pfd/minimum", 99999, "INT");
var canvas_PFD_base = {
init: func(canvas_group, file) {

View file

@ -1,41 +1,41 @@
# Copyright (c) 2020 Matthew Maring (hayden2000)
# APPR PERF
var ldg_config_3_set = props.globals.getNode("FMGC/internal/ldg-config-3-set", 1);
var ldg_config_f_set = props.globals.getNode("FMGC/internal/ldg-config-f-set", 1);
var ldg_config_3_set = props.globals.getNode("/FMGC/internal/ldg-config-3-set", 1);
var ldg_config_f_set = props.globals.getNode("/FMGC/internal/ldg-config-f-set", 1);
var perfAPPRInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = getprop("/MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/dest-qnh", -1);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/dest-qnh", -1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (num(scratchpad) != nil and (scratchpad >= 28.06 and scratchpad <= 31.01) or (scratchpad >= 745 and scratchpad <= 1050)) {
# doesn't support accidental temp input yet
setprop("FMGC/internal/dest-qnh", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/dest-qnh", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else if (key == "L2") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/dest-temp", -999);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/dest-temp", -999);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (num(scratchpad) != nil and scratchpad >= -99 and scratchpad < 99) {
setprop("FMGC/internal/dest-temp", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/dest-temp", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else if (key == "L3") {
var tfs = size(scratchpad);
if (scratchpad == "CLR") {
setprop("FMGC/internal/dest-mag", -1);
setprop("FMGC/internal/dest-wind", -1);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/dest-mag", -1);
setprop("/FMGC/internal/dest-wind", -1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (tfs >= 3 and tfs <= 7 and find("/", scratchpad) != -1) {
var weather = split("/", scratchpad);
var mag = int(weather[0]);
@ -44,9 +44,9 @@ var perfAPPRInput = func(key, i) {
var winds = size(weather[1]);
if (mags >= 1 and mags <= 3 and winds >= 1 and winds <= 3) {
if (mag != nil and wind != nil and mag >= 0 and mag <= 360 and wind >= 0 and wind <= 200) {
setprop("FMGC/internal/dest-mag", weather[0]);
setprop("FMGC/internal/dest-wind", weather[1]);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/dest-mag", weather[0]);
setprop("/FMGC/internal/dest-wind", weather[1]);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateARPT();
} else {
notAllowed(i);
@ -59,77 +59,77 @@ var perfAPPRInput = func(key, i) {
}
} else if (key == "L4") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/trans-alt", 18000);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/trans-alt", 18000);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 50000) {
setprop("FMGC/internal/trans-alt", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/trans-alt", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else if (key == "L5") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/vapp-speed-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/vapp-speed-set", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 200) {
setprop("FMGC/internal/vapp-speed-set", 1);
setprop("FMGC/internal/computed-speeds/vapp_appr", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/vapp-speed-set", 1);
setprop("/FMGC/internal/computed-speeds/vapp_appr", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else if (key == "L6") {
setprop("MCDU[" ~ i ~ "]/page", "PERFDES");
setprop("/MCDU[" ~ i ~ "]/page", "PERFDES");
} else if (key == "R2") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/baro", 99999);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (int(scratchpad) != nil and scratchpad >= getprop("FMGC/internal/ldg-elev") and scratchpad <= 5000 + getprop("FMGC/internal/ldg-elev")) {
if (getprop("FMGC/internal/radio-no") == 0) {
setprop("FMGC/internal/radio", 99999);
setprop("/FMGC/internal/baro", 99999);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (int(scratchpad) != nil and scratchpad >= getprop("/FMGC/internal/ldg-elev") and scratchpad <= 5000 + getprop("/FMGC/internal/ldg-elev")) {
if (getprop("/FMGC/internal/radio-no") == 0) {
setprop("/FMGC/internal/radio", 99999);
}
setprop("FMGC/internal/baro", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/baro", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else if (key == "R3") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/radio", 99999);
setprop("FMGC/internal/radio-no", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/radio", 99999);
setprop("/FMGC/internal/radio-no", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (scratchpad == "NO") {
setprop("FMGC/internal/radio", 99999);
setprop("FMGC/internal/radio-no", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/radio", 99999);
setprop("/FMGC/internal/radio-no", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 700) {
setprop("FMGC/internal/baro", 99999);
setprop("FMGC/internal/radio-no", 0);
setprop("FMGC/internal/radio", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/baro", 99999);
setprop("/FMGC/internal/radio-no", 0);
setprop("/FMGC/internal/radio", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else if (key == "R4") {
if (scratchpad == "" and ldg_config_f_set.getValue() == 1 and ldg_config_3_set.getValue() == 0) {
setprop("FMGC/internal/ldg-config-3-set", 1);
setprop("FMGC/internal/ldg-config-f-set", 0);
setprop("/FMGC/internal/ldg-config-3-set", 1);
setprop("/FMGC/internal/ldg-config-f-set", 0);
} else {
notAllowed(i);
}
} else if (key == "R5") {
if (scratchpad == "" and ldg_config_3_set.getValue() == 1 and ldg_config_f_set.getValue() == 0) {
setprop("FMGC/internal/ldg-config-3-set", 0);
setprop("FMGC/internal/ldg-config-f-set", 1);
setprop("/FMGC/internal/ldg-config-3-set", 0);
setprop("/FMGC/internal/ldg-config-f-set", 1);
} else {
notAllowed(i);
}
} else if (key == "R6") {
setprop("MCDU[" ~ i ~ "]/page", "PERFGA");
setprop("/MCDU[" ~ i ~ "]/page", "PERFGA");
}
}

View file

@ -3,9 +3,9 @@
# Copyright (c) 2020 Josh Davidson (Octal450)
print("-----------------------------------------------------------------------------");
print("Copyright (c) 2016-2019 Joshua Davidson (Octal450)");
print("-----------------------------------------------------------------------------");
print("--------------------------------------------------");
print("Copyright (c) 2016-2020 Joshua Davidson (Octal450)");
print("--------------------------------------------------");
setprop("sim/replay/was-active", 0);

View file

@ -169,6 +169,14 @@
<property>/instrumentation/mk-viii/inputs/discretes/gpws-inhibit</property>
<value>0</value>
</equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>2500</value>
</not-equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>2400</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>2500</value>
@ -203,6 +211,14 @@
<property>/instrumentation/mk-viii/inputs/discretes/gpws-inhibit</property>
<value>0</value>
</equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>2000</value>
</not-equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>1900</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>2000</value>
@ -237,6 +253,14 @@
<property>/instrumentation/mk-viii/inputs/discretes/gpws-inhibit</property>
<value>0</value>
</equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>1000</value>
</not-equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>900</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>1000</value>
@ -271,6 +295,14 @@
<property>/instrumentation/mk-viii/inputs/discretes/gpws-inhibit</property>
<value>0</value>
</equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>500</value>
</not-equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>400</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>500</value>
@ -305,6 +337,14 @@
<property>/instrumentation/mk-viii/inputs/discretes/gpws-inhibit</property>
<value>0</value>
</equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>400</value>
</not-equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>300</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>400</value>
@ -339,6 +379,14 @@
<property>/instrumentation/mk-viii/inputs/discretes/gpws-inhibit</property>
<value>0</value>
</equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>300</value>
</not-equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>200</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>300</value>
@ -373,6 +421,14 @@
<property>/instrumentation/mk-viii/inputs/discretes/gpws-inhibit</property>
<value>0</value>
</equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>200</value>
</not-equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>100</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>200</value>
@ -407,6 +463,14 @@
<property>/instrumentation/mk-viii/inputs/discretes/gpws-inhibit</property>
<value>0</value>
</equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>100</value>
</not-equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>0</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>100</value>
@ -441,6 +505,10 @@
<property>/instrumentation/mk-viii/inputs/discretes/gpws-inhibit</property>
<value>0</value>
</equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>50</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>50</value>
@ -475,6 +543,10 @@
<property>/instrumentation/mk-viii/inputs/discretes/gpws-inhibit</property>
<value>0</value>
</equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>40</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>40</value>
@ -509,6 +581,10 @@
<property>/instrumentation/mk-viii/inputs/discretes/gpws-inhibit</property>
<value>0</value>
</equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>30</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>30</value>
@ -543,6 +619,10 @@
<property>/instrumentation/mk-viii/inputs/discretes/gpws-inhibit</property>
<value>0</value>
</equals>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>20</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>20</value>
@ -581,6 +661,10 @@
<property>/controls/flight/flaps</property>
<value>0.640</value>
</greater-than>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>10</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>10</value>
@ -629,6 +713,10 @@
<property>/controls/flight/flaps</property>
<value>0.640</value>
</greater-than>
<not-equals>
<property>/instrumentation/pfd/minimums-no-gpws-alt</property>
<value>5</value>
</not-equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<value>5</value>
@ -672,17 +760,12 @@
<value>0</value>
</equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<property>/instrumentation/pfd/hundred-above</property>
<property>/instrumentation/pfd/minimums-ref-alt</property>
<property>/instrumentation/pfd/minimums-plus-100</property>
</less-than-equals>
<greater-than>
<property>/position/gear-agl-ft</property>
<expression>
<difference>
<property>/instrumentation/pfd/hundred-above</property>
<value>50</value>
</difference>
</expression>
<property>/instrumentation/pfd/minimums-ref-alt</property>
<property>/instrumentation/pfd/minimums-plus-50</property>
</greater-than>
<less-than>
<property>/position/gear-agl-ft-2-sec</property>
@ -711,17 +794,12 @@
<value>0</value>
</equals>
<less-than-equals>
<property>/position/gear-agl-ft</property>
<property>/instrumentation/pfd/minimum</property>
<property>/instrumentation/pfd/minimums-ref-alt</property>
<property>/instrumentation/pfd/minimums</property>
</less-than-equals>
<greater-than>
<property>/position/gear-agl-ft</property>
<expression>
<difference>
<property>/instrumentation/pfd/minimum</property>
<value>50</value>
</difference>
</expression>
<property>/instrumentation/pfd/minimums-ref-alt</property>
<property>/instrumentation/pfd/minimums-minus-50</property>
</greater-than>
<less-than>
<property>/position/gear-agl-ft-2-sec</property>

View file

@ -1212,4 +1212,145 @@
<output>/instrumentation/ddrmi/flag-2</output>
<filter-time>0.64</filter-time>
</filter>
<!-- Minimums stuff -->
<filter>
<name>Minimums Selector</name>
<type>gain</type>
<gain>1.0</gain>
<update-interval-secs type="double">0.1</update-interval-secs>
<input>
<condition>
<not-equals>
<property>/FMGC/internal/baro</property>
<value>99999</value>
</not-equals>
</condition>
<property>/instrumentation/altimeter/indicated-altitude-ft</property>
</input>
<input>/position/gear-agl-ft</input>
<output>/instrumentation/pfd/minimums-ref-alt</output>
</filter>
<filter>
<name>Minimums Selector</name>
<type>gain</type>
<gain>1.0</gain>
<update-interval-secs type="double">0.1</update-interval-secs>
<input>
<condition>
<not-equals>
<property>/FMGC/internal/radio</property>
<value>99999</value>
</not-equals>
</condition>
<property>/FMGC/internal/radio</property>
</input>
<input>
<condition>
<not-equals>
<property>/FMGC/internal/baro</property>
<value>99999</value>
</not-equals>
</condition>
<expression> <!-- A bit ehhh, but avoids huge mess in A320-common-sound.xml -->
<product>
<floor>
<sum>
<div>
<sum> <!-- Calculate offseted radio value -->
<difference>
<property>/position/gear-agl-ft</property>
<property>/instrumentation/altimeter/indicated-altitude-ft</property>
</difference>
<property>/FMGC/internal/baro</property>
</sum>
<value>25</value>
</div>
<value>0.5</value> <!-- Make floor round it -->
</sum>
</floor>
<value>25</value>
</product>
</expression>
</input>
<input>99999</input>
<output>/instrumentation/pfd/minimums-no-gpws-alt</output>
</filter>
<filter>
<name>Minimums Selector</name>
<type>gain</type>
<gain>1.0</gain>
<update-interval-secs type="double">0.1</update-interval-secs>
<input>
<condition>
<not-equals>
<property>/FMGC/internal/radio</property>
<value>99999</value>
</not-equals>
</condition>
<property>/FMGC/internal/radio</property>
</input>
<input>
<condition>
<not-equals>
<property>/FMGC/internal/baro</property>
<value>99999</value>
</not-equals>
</condition>
<property>/FMGC/internal/baro</property>
</input>
<input>99999</input>
<output>/instrumentation/pfd/minimums</output>
</filter>
<filter>
<name>Minimums Minus 50</name>
<type>gain</type>
<gain>1.0</gain>
<update-interval-secs type="double">0.1</update-interval-secs>
<input>
<expression>
<difference>
<property>/instrumentation/pfd/minimums</property>
<value>50</value>
</difference>
</expression>
</input>
<output>/instrumentation/pfd/minimums-minus-50</output>
</filter>
<filter>
<name>Minimums Plus 50</name>
<type>gain</type>
<gain>1.0</gain>
<update-interval-secs type="double">0.1</update-interval-secs>
<input>
<expression>
<sum>
<property>/instrumentation/pfd/minimums</property>
<value>50</value>
</sum>
</expression>
</input>
<output>/instrumentation/pfd/minimums-plus-50</output>
</filter>
<filter>
<name>Minimums Plus 100</name>
<type>gain</type>
<gain>1.0</gain>
<update-interval-secs type="double">0.1</update-interval-secs>
<input>
<expression>
<sum>
<property>/instrumentation/pfd/minimums</property>
<value>100</value>
</sum>
</expression>
</input>
<output>/instrumentation/pfd/minimums-plus-100</output>
</filter>
</PropertyList>