1
0
Fork 0

Merge branch 'dev' into pneumatics

This commit is contained in:
legoboyvdlp R 2020-05-22 20:53:54 +01:00
commit 5cc1eeb1c1
54 changed files with 4395 additions and 2802 deletions

View file

@ -4089,12 +4089,10 @@
<file>Aircraft/A320-family/Nasal/Libraries/property-tree-setup.nas</file>
</pts>
<libraries>
<file>Aircraft/A320-family/Nasal/ECAM/ECAM-main.nas</file>
<file>Aircraft/A320-family/Nasal/Libraries/libraries.nas</file>
<file>Aircraft/A320-family/Nasal/Libraries/buttons.nas</file>
<file>Aircraft/A320-family/Nasal/Libraries/shake.nas</file>
<file>Aircraft/A320-family/Nasal/Libraries/zoom-views.nas</file>
<file>Aircraft/A320-family/Nasal/Libraries/efis.nas</file>
</libraries>
<acconfig>
<file>Aircraft/A320-family/AircraftConfig/acconfig.nas</file>
@ -4115,14 +4113,28 @@
<file>Aircraft/A320-family/Nasal/Systems/ADIRS/ADR.nas</file>
<file>Aircraft/A320-family/Nasal/Panels/SwitchingPanel.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/Comm/HF.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/fire.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/brakes.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/brakesystem.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/tyresmoke.nas</file>
<file>Aircraft/A320-family/Nasal/Instruments/clock.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/fire.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/ground_services.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/icing.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/payload.nas</file>
<file>Aircraft/A320-family/Nasal/Panels/clock.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/tyresmoke.nas</file>
</systems>
<ecam>
<file>Aircraft/A320-family/Nasal/ECAM/ECAM-main.nas</file>
<file>Aircraft/A320-family/Nasal/ECAM/ECAM-controller.nas</file>
<file>Aircraft/A320-family/Nasal/ECAM/ECAM-logic.nas</file>
<file>Aircraft/A320-family/Nasal/ECAM/ECAM-messages.nas</file>
<file>Aircraft/A320-family/Nasal/ECAM/ECAM-phases.nas</file>
</ecam>
<effects>
<file>Aircraft/A320-family/Nasal/Effects/light-manager.nas</file>
<file>Aircraft/A320-family/Nasal/Effects/effects.nas</file>
<file>Aircraft/A320-family/Nasal/Effects/thunder-effects.nas</file>
</effects>
<fadec>
<file>Aircraft/A320-family/Nasal/Systems/FADEC/fadec-common.nas</file>
</fadec>
@ -4131,8 +4143,10 @@
</fbw>
<fcu>
<file>Aircraft/A320-family/Nasal/FMGC/FCU.nas</file>
<file>Aircraft/A320-family/Nasal/Panels/efis.nas</file>
</fcu>
<fmgc>
<file>Aircraft/A320-family/Nasal/FMGC/flightplan-waypoints.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/flightplan.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/FMGC.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/FMGC-b.nas</file>
@ -4147,6 +4161,7 @@
<file>Aircraft/A320-family/Nasal/MCDU/ARRIVAL.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/AIRWAYS.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/CLOSESTAIRPORT.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/HOLD.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/F-PLN.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/MCDU.nas</file>
@ -4169,6 +4184,7 @@
<file>Aircraft/A320-family/Nasal/MCDU/DATA.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/STATUS.nas</file>
</mcdu>
<!-- Canvas -->
<canvas_pfd>
<file>Aircraft/A320-family/Models/Instruments/PFD/PFD.nas</file>
</canvas_pfd>
@ -4185,12 +4201,7 @@
<canvas_mcdu>
<file>Aircraft/A320-family/Models/Instruments/MCDU/MCDU.nas</file>
</canvas_mcdu>
<ecam>
<file>Aircraft/A320-family/Nasal/ECAM/ECAM-controller.nas</file>
<file>Aircraft/A320-family/Nasal/ECAM/ECAM-logic.nas</file>
<file>Aircraft/A320-family/Nasal/ECAM/ECAM-messages.nas</file>
<file>Aircraft/A320-family/Nasal/ECAM/ECAM-phases.nas</file>
</ecam>
<!-- Autopush -->
<autopush>
<file>Aircraft/A320-family/Nasal/Autopush/autopush.nas</file>
</autopush>
@ -4203,6 +4214,7 @@
<autopush_route>
<file>Aircraft/A320-family/Nasal/Autopush/autopush_route.nas</file>
</autopush_route>
<!-- Panels -->
<rmp>
<file>Aircraft/A320-family/Nasal/Panels/rmp.nas</file>
</rmp>

View file

@ -4,8 +4,8 @@ Have at least following versions installed:
* FlightGear 2019.2.0 or newer
## Install using ZIP Snapshot
[Download](https://github.com/legoboyvdlp/A320-family/archive/master.zip) the zip file.
Use your prefered archive utility to unzip the archive.
[Download](https://github.com/legoboyvdlp/A320-family/archive/dev.zip) the zip file.
Use your preferred archive utility to unzip the archive.
Move the unpacked directory to your aircraft directory. This can be FGData/Aircraft, or a custom directory you've specified.
Rename the directory to `A320-family`.

View file

@ -11,61 +11,35 @@
<condition>
<and>
<or>
<greater-than-equals>
<expression>
<sum>
<product>
<property>environment/relative-humidity</property>
<value>0.1</value>
</product>
<property>systems/navigation/adr/output/aoa-1</property>
</sum>
</expression>
<value>13.5</value>
</greater-than-equals>
<greater-than-equals>
<expression>
<sum>
<product>
<property>environment/relative-humidity</property>
<value>0.1</value>
</product>
<property>systems/navigation/adr/output/aoa-2</property>
</sum>
</expression>
<value>13.5</value>
</greater-than-equals>
<greater-than-equals>
<expression>
<sum>
<product>
<property>environment/relative-humidity</property>
<value>0.1</value>
</product>
<property>systems/navigation/adr/output/aoa-3</property>
</sum>
</expression>
<value>13.5</value>
</greater-than-equals>
</or>
<greater-than-equals>
<expression>
<sum>
<product>
<property>environment/relative-humidity</property>
<value>0.075</value>
</product>
<property>fdm/jsbsim/aero/alpha-deg</property>
</sum>
</expression>
<value>13.5</value>
</greater-than-equals>
<greater-than>
<property>velocities/groundspeed-kt</property>
<value>100</value>
</greater-than>
<less-than>
</greater-than>
<less-than>
<property>velocities/groundspeed-kt</property>
<value>210</value>
</less-than>
<greater-than>
</less-than>
<greater-than>
<property>environment/relative-humidity</property>
<value>50</value>
</greater-than>
<less-than-equals>
</greater-than>
<less-than-equals>
<property>environment/temperature-degc</property>
<value>28</value>
</less-than-equals>
<greater-than>
</less-than-equals>
<greater-than>
<property>position/altitude-agl-ft</property>
<value>0</value>
</greater-than>
@ -73,20 +47,10 @@
<property>position/altitude-agl-ft</property>
<value>8000</value>
</less-than>
<or>
<greater-than>
<property>systems/navigation/adr/output/aoa-1</property>
<value>0</value>
</greater-than>
<greater-than>
<property>systems/navigation/adr/output/aoa-2</property>
<value>0</value>
</greater-than>
<greater-than>
<property>systems/navigation/adr/output/aoa-3</property>
<value>0</value>
</greater-than>
</or>
<greater-than>
<property>fdm/jsbsim/aero/alpha-deg</property>
<value>0</value>
</greater-than>
</and>
</condition>
@ -109,49 +73,49 @@
</vertex>
</placer>
<shooter>
<theta-min-deg>
<!-- <expression>
<shooter>
<theta-min-deg>
<!-- <expression>
<sum>
<value>70</value>
<property>systems/navigation/adr/output/aoa-1</property>
</sum>
</expression> -->
<value>90</value>
</theta-min-deg>
<theta-max-deg>
<!-- <expression>
<value>70</value>
<property>systems/navigation/adr/output/aoa-1</property>
</sum>
</expression> -->
<value>90</value>
</theta-min-deg>
<theta-max-deg>
<!-- <expression>
<sum>
<value>110</value>
<property>systems/navigation/adr/output/aoa-1</property>
</sum>
</expression> -->
<value>90</value>
</theta-max-deg>
<phi-min-deg>90</phi-min-deg>
<phi-max-deg>90</phi-max-deg>
<speed-mps>
<!-- <expression>
<product>
<property>velocities/groundspeed-kt</property>
<value>-1</value>
</product>
</expression> -->
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-max-deg-sec>180</x-max-deg-sec>
<x-min-deg-sec>180</x-min-deg-sec>
<y-max-deg-sec>180</y-max-deg-sec>
<y-min-deg-sec>-180</y-min-deg-sec>
<z-max-deg-sec>-180</z-max-deg-sec>
<z-min-deg-sec>-180</z-min-deg-sec>
</rotation-speed>
</shooter>
<value>110</value>
<property>systems/navigation/adr/output/aoa-1</property>
</sum>
</expression> -->
<value>90</value>
</theta-max-deg>
<phi-min-deg>90</phi-min-deg>
<phi-max-deg>90</phi-max-deg>
<speed-mps>
<!-- <expression>
<product>
<property>velocities/groundspeed-kt</property>
<value>-1</value>
</product>
</expression> -->
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-max-deg-sec>180</x-max-deg-sec>
<x-min-deg-sec>180</x-min-deg-sec>
<y-max-deg-sec>180</y-max-deg-sec>
<y-min-deg-sec>-180</y-min-deg-sec>
<z-max-deg-sec>-180</z-max-deg-sec>
<z-min-deg-sec>-180</z-min-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<counter>
<particles-per-sec>
<expression>
<product>
<value>4</value>
@ -159,13 +123,13 @@
</product>
</expression>
<spread>10</spread>
</particles-per-sec>
</counter>
</particles-per-sec>
</counter>
<align>billboard</align>
<align>billboard</align>
<particle>
<start>
<particle>
<start>
<color>
<red>
<expression>
@ -203,8 +167,8 @@
<size>
<value>1.5</value>
</size>
</start>
<end>
</start>
<end>
<color>
<red>
<expression>
@ -239,22 +203,22 @@
</expression>
</alpha>
</color>
<size>
<value>2</value>
</size>
</end>
<life-sec>
<value>0.00001</value>
</life-sec>
<mass-kg>0.025</mass-kg>
<radius-m>0.175</radius-m>
</particle>
<size>
<value>2</value>
</size>
</end>
<life-sec>
<value>0.00001</value>
</life-sec>
<mass-kg>0.025</mass-kg>
<radius-m>0.175</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity>true</gravity>
<wind>true</wind>
</program>
<program>
<fluid>air</fluid>
<gravity>true</gravity>
<wind>true</wind>
</program>
</particlesystem>

View file

@ -11,61 +11,35 @@
<condition>
<and>
<or>
<greater-than-equals>
<expression>
<sum>
<product>
<property>environment/relative-humidity</property>
<value>0.1</value>
</product>
<property>systems/navigation/adr/output/aoa-1</property>
</sum>
</expression>
<value>13.5</value>
</greater-than-equals>
<greater-than-equals>
<expression>
<sum>
<product>
<property>environment/relative-humidity</property>
<value>0.1</value>
</product>
<property>systems/navigation/adr/output/aoa-2</property>
</sum>
</expression>
<value>13.5</value>
</greater-than-equals>
<greater-than-equals>
<expression>
<sum>
<product>
<property>environment/relative-humidity</property>
<value>0.1</value>
</product>
<property>systems/navigation/adr/output/aoa-3</property>
</sum>
</expression>
<value>13.5</value>
</greater-than-equals>
</or>
<greater-than-equals>
<expression>
<sum>
<product>
<property>environment/relative-humidity</property>
<value>0.075</value>
</product>
<property>fdm/jsbsim/aero/alpha-deg</property>
</sum>
</expression>
<value>13.5</value>
</greater-than-equals>
<greater-than>
<property>velocities/groundspeed-kt</property>
<value>100</value>
</greater-than>
<less-than>
</greater-than>
<less-than>
<property>velocities/groundspeed-kt</property>
<value>210</value>
</less-than>
<greater-than>
</less-than>
<greater-than>
<property>environment/relative-humidity</property>
<value>50</value>
</greater-than>
<less-than-equals>
</greater-than>
<less-than-equals>
<property>environment/temperature-degc</property>
<value>28</value>
</less-than-equals>
<greater-than>
</less-than-equals>
<greater-than>
<property>position/altitude-agl-ft</property>
<value>0</value>
</greater-than>
@ -73,20 +47,10 @@
<property>position/altitude-agl-ft</property>
<value>8000</value>
</less-than>
<or>
<greater-than>
<property>systems/navigation/adr/output/aoa-1</property>
<value>0</value>
</greater-than>
<greater-than>
<property>systems/navigation/adr/output/aoa-2</property>
<value>0</value>
</greater-than>
<greater-than>
<property>systems/navigation/adr/output/aoa-3</property>
<value>0</value>
</greater-than>
</or>
<greater-than>
<property>fdm/jsbsim/aero/alpha-deg</property>
<value>0</value>
</greater-than>
</and>
</condition>
@ -109,49 +73,49 @@
</vertex>
</placer>
<shooter>
<theta-min-deg>
<!-- <expression>
<shooter>
<theta-min-deg>
<!-- <expression>
<sum>
<value>70</value>
<property>systems/navigation/adr/output/aoa-1</property>
</sum>
</expression> -->
<value>90</value>
</theta-min-deg>
<theta-max-deg>
<!-- <expression>
<value>70</value>
<property>systems/navigation/adr/output/aoa-1</property>
</sum>
</expression> -->
<value>90</value>
</theta-min-deg>
<theta-max-deg>
<!-- <expression>
<sum>
<value>110</value>
<property>systems/navigation/adr/output/aoa-1</property>
</sum>
</expression> -->
<value>90</value>
</theta-max-deg>
<phi-min-deg>90</phi-min-deg>
<phi-max-deg>90</phi-max-deg>
<speed-mps>
<!-- <expression>
<product>
<property>velocities/groundspeed-kt</property>
<value>-1</value>
</product>
</expression> -->
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-max-deg-sec>180</x-max-deg-sec>
<x-min-deg-sec>180</x-min-deg-sec>
<y-max-deg-sec>180</y-max-deg-sec>
<y-min-deg-sec>-180</y-min-deg-sec>
<z-max-deg-sec>-180</z-max-deg-sec>
<z-min-deg-sec>-180</z-min-deg-sec>
</rotation-speed>
</shooter>
<value>110</value>
<property>systems/navigation/adr/output/aoa-1</property>
</sum>
</expression> -->
<value>90</value>
</theta-max-deg>
<phi-min-deg>90</phi-min-deg>
<phi-max-deg>90</phi-max-deg>
<speed-mps>
<!-- <expression>
<product>
<property>velocities/groundspeed-kt</property>
<value>-1</value>
</product>
</expression> -->
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-max-deg-sec>180</x-max-deg-sec>
<x-min-deg-sec>180</x-min-deg-sec>
<y-max-deg-sec>180</y-max-deg-sec>
<y-min-deg-sec>-180</y-min-deg-sec>
<z-max-deg-sec>-180</z-max-deg-sec>
<z-min-deg-sec>-180</z-min-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<counter>
<particles-per-sec>
<expression>
<product>
<value>4</value>
@ -159,13 +123,13 @@
</product>
</expression>
<spread>10</spread>
</particles-per-sec>
</counter>
</particles-per-sec>
</counter>
<align>billboard</align>
<align>billboard</align>
<particle>
<start>
<particle>
<start>
<color>
<red>
<expression>
@ -203,8 +167,8 @@
<size>
<value>1.5</value>
</size>
</start>
<end>
</start>
<end>
<color>
<red>
<expression>
@ -239,22 +203,22 @@
</expression>
</alpha>
</color>
<size>
<value>2</value>
</size>
</end>
<life-sec>
<value>0.00001</value>
</life-sec>
<mass-kg>0.025</mass-kg>
<radius-m>0.175</radius-m>
</particle>
<size>
<value>2</value>
</size>
</end>
<life-sec>
<value>0.00001</value>
</life-sec>
<mass-kg>0.025</mass-kg>
<radius-m>0.175</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity>true</gravity>
<wind>true</wind>
</program>
<program>
<fluid>air</fluid>
<gravity>true</gravity>
<wind>true</wind>
</program>
</particlesystem>

View file

@ -806,17 +806,10 @@
<animation>
<type>rotate</type>
<object-name>atc_stby</object-name>
<factor>-35</factor>
<offset-deg>70</offset-deg>
<center>
<x-m>0.01146</x-m>
<y-m>0.213663</y-m>
<z-m>-0.13086</z-m>
</center>
<factor>35</factor>
<offset-deg>-70</offset-deg>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
<object-name>atc_stby.axis</object-name>
</axis>
<property>controls/atc/mode-knob</property>
</animation>
@ -2030,7 +2023,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.ECAMControlPanel.sysPageBtn("sts");</script>
<script>ecam.ECAMControlPanel.sysPageBtn("sts");</script>
</binding>
</action>
</animation>
@ -2049,7 +2042,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.ECAMControlPanel.sysPageBtn("apu");</script>
<script>ecam.ECAMControlPanel.sysPageBtn("apu");</script>
</binding>
</action>
</animation>
@ -2068,7 +2061,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.ECAMControlPanel.sysPageBtn("bleed");</script>
<script>ecam.ECAMControlPanel.sysPageBtn("bleed");</script>
</binding>
</action>
</animation>
@ -2087,7 +2080,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.ECAMControlPanel.sysPageBtn("press");</script>
<script>ecam.ECAMControlPanel.sysPageBtn("press");</script>
</binding>
</action>
</animation>
@ -2106,7 +2099,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.ECAMControlPanel.sysPageBtn("elec");</script>
<script>ecam.ECAMControlPanel.sysPageBtn("elec");</script>
</binding>
</action>
</animation>
@ -2125,7 +2118,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.ECAMControlPanel.sysPageBtn("hyd");</script>
<script>ecam.ECAMControlPanel.sysPageBtn("hyd");</script>
</binding>
</action>
</animation>
@ -2144,7 +2137,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.ECAMControlPanel.sysPageBtn("fuel");</script>
<script>ecam.ECAMControlPanel.sysPageBtn("fuel");</script>
</binding>
</action>
</animation>
@ -2163,7 +2156,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.ECAMControlPanel.sysPageBtn("eng");</script>
<script>ecam.ECAMControlPanel.sysPageBtn("eng");</script>
</binding>
</action>
</animation>
@ -2182,7 +2175,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.ECAMControlPanel.sysPageBtn("cond");</script>
<script>ecam.ECAMControlPanel.sysPageBtn("cond");</script>
</binding>
</action>
</animation>
@ -2201,7 +2194,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.ECAMControlPanel.sysPageBtn("door");</script>
<script>ecam.ECAMControlPanel.sysPageBtn("door");</script>
</binding>
</action>
</animation>
@ -2220,7 +2213,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.ECAMControlPanel.sysPageBtn("wheel");</script>
<script>ecam.ECAMControlPanel.sysPageBtn("wheel");</script>
</binding>
</action>
</animation>
@ -2239,7 +2232,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.ECAMControlPanel.sysPageBtn("fctl");</script>
<script>ecam.ECAMControlPanel.sysPageBtn("fctl");</script>
</binding>
</action>
</animation>
@ -2509,16 +2502,14 @@
</condition>
<command>nasal</command>
<script>
libraries.ECAMControlPanel.rclBtn();
ecam.ECAMControlPanel.rclBtn();
ecam.FWC.Btn.recall.setValue(1);
</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
ecam.FWC.Btn.recall.setValue(0);
</script>
<script>ecam.FWC.Btn.recall.setValue(0);</script>
</binding>
</mod-up>
</action>
@ -2540,16 +2531,14 @@
</condition>
<command>nasal</command>
<script>
libraries.ECAMControlPanel.clrBtn();
ecam.ECAMControlPanel.clrBtn();
ecam.FWC.Btn.clr.setValue(1);
</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
ecam.FWC.Btn.clr.setValue(0);
</script>
<script>ecam.FWC.Btn.clr.setValue(0);</script>
</binding>
</mod-up>
</action>
@ -3273,9 +3262,9 @@
<command>nasal</command>
<script>
if (getprop("instrumentation/efis/inputs/CSTR") != 1) {
libraries.cpt_efis_btns("cstr");
fcu.cpt_efis_btns("cstr");
} else {
libraries.cpt_efis_btns("off");
fcu.cpt_efis_btns("off");
}
setprop("sim/sounde/btn1", 1);
</script>
@ -3315,9 +3304,9 @@
<command>nasal</command>
<script>
if (getprop("instrumentation/efis[1]/inputs/CSTR") != 1) {
libraries.fo_efis_btns("cstr");
fcu.fo_efis_btns("cstr");
} else {
libraries.fo_efis_btns("off");
fcu.fo_efis_btns("off");
}
setprop("sim/sounde/btn1", 1);
</script>
@ -3357,9 +3346,9 @@
<command>nasal</command>
<script>
if (getprop("instrumentation/efis/inputs/wpt") != 1) {
libraries.cpt_efis_btns("wpt");
fcu.cpt_efis_btns("wpt");
} else {
libraries.cpt_efis_btns("off");
fcu.cpt_efis_btns("off");
}
setprop("sim/sounde/btn1", 1);
</script>
@ -3399,9 +3388,9 @@
<command>nasal</command>
<script>
if (getprop("instrumentation/efis[1]/inputs/wpt") != 1) {
libraries.fo_efis_btns("wpt");
fcu.fo_efis_btns("wpt");
} else {
libraries.fo_efis_btns("off");
fcu.fo_efis_btns("off");
}
setprop("sim/sounde/btn1", 1);
</script>
@ -3441,9 +3430,9 @@
<command>nasal</command>
<script>
if (getprop("instrumentation/efis/inputs/VORD") != 1) {
libraries.cpt_efis_btns("vord");
fcu.cpt_efis_btns("vord");
} else {
libraries.cpt_efis_btns("off");
fcu.cpt_efis_btns("off");
}
setprop("sim/sounde/btn1", 1);
</script>
@ -3483,9 +3472,9 @@
<command>nasal</command>
<script>
if (getprop("instrumentation/efis[1]/inputs/VORD") != 1) {
libraries.fo_efis_btns("vord");
fcu.fo_efis_btns("vord");
} else {
libraries.fo_efis_btns("off");
fcu.fo_efis_btns("off");
}
setprop("sim/sounde/btn1", 1);
</script>
@ -3525,9 +3514,9 @@
<command>nasal</command>
<script>
if (getprop("instrumentation/efis/inputs/NDB") != 1) {
libraries.cpt_efis_btns("ndb");
fcu.cpt_efis_btns("ndb");
} else {
libraries.cpt_efis_btns("off");
fcu.cpt_efis_btns("off");
}
setprop("sim/sounde/btn1", 1);
</script>
@ -3567,9 +3556,9 @@
<command>nasal</command>
<script>
if (getprop("instrumentation/efis[1]/inputs/NDB") != 1) {
libraries.fo_efis_btns("ndb");
fcu.fo_efis_btns("ndb");
} else {
libraries.fo_efis_btns("off");
fcu.fo_efis_btns("off");
}
setprop("sim/sounde/btn1", 1);
</script>
@ -3609,9 +3598,9 @@
<command>nasal</command>
<script>
if (getprop("instrumentation/efis/inputs/arpt") != 1) {
libraries.cpt_efis_btns("arpt");
fcu.cpt_efis_btns("arpt");
} else {
libraries.cpt_efis_btns("off");
fcu.cpt_efis_btns("off");
}
setprop("sim/sounde/btn1", 1);
</script>
@ -3651,9 +3640,9 @@
<command>nasal</command>
<script>
if (getprop("instrumentation/efis[1]/inputs/arpt") != 1) {
libraries.fo_efis_btns("arpt");
fcu.fo_efis_btns("arpt");
} else {
libraries.fo_efis_btns("off");
fcu.fo_efis_btns("off");
}
setprop("sim/sounde/btn1", 1);
</script>
@ -3686,7 +3675,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>libraries.setCptND(1);</script>
<script>fcu.setCptND(1);</script>
</binding>
</action>
<action>
@ -3695,7 +3684,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>libraries.setCptND(-1);</script>
<script>fcu.setCptND(-1);</script>
</binding>
</action>
</animation>
@ -3724,7 +3713,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>libraries.setFoND(1);</script>
<script>fcu.setFoND(1);</script>
</binding>
</action>
<action>
@ -3733,7 +3722,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>libraries.setFoND(-1);</script>
<script>fcu.setFoND(-1);</script>
</binding>
</action>
</animation>
@ -3762,7 +3751,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>libraries.setNDRange(0, 1);</script>
<script>fcu.setNDRange(0, 1);</script>
</binding>
</action>
<action>
@ -3771,7 +3760,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>libraries.setNDRange(0, -1);</script>
<script>fcu.setNDRange(0, -1);</script>
</binding>
</action>
</animation>
@ -3801,7 +3790,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>libraries.setNDRange(1, 1);</script>
<script>fcu.setNDRange(1, 1);</script>
</binding>
</action>
<action>
@ -3810,7 +3799,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>libraries.setNDRange(1, -1);</script>
<script>fcu.setNDRange(1, -1);</script>
</binding>
</action>
</animation>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -854,6 +854,31 @@
</action>
</animation>
<animation>
<type>pick</type>
<object-name>airport</object-name>
<action>
<button>0</button>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>mcdu.pagebutton("airport", 0);</script>
<condition>
<and>
<greater-than-equals>
<property>systems/electrical/bus/ac-1</property>
<value>110</value>
</greater-than-equals>
<greater-than>
<property>controls/lighting/DU/mcdu1</property>
<value>0.01</value>
</greater-than>
</and>
</condition>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>left</object-name>

View file

@ -854,6 +854,31 @@
</action>
</animation>
<animation>
<type>pick</type>
<object-name>airport</object-name>
<action>
<button>0</button>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>mcdu.pagebutton("airport", 1);</script>
<condition>
<and>
<greater-than-equals>
<property>systems/electrical/bus/ac-2</property>
<value>110</value>
</greater-than-equals>
<greater-than>
<property>controls/lighting/DU/mcdu2</property>
<value>0.01</value>
</greater-than>
</and>
</condition>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>left</object-name>

View file

@ -33,12 +33,12 @@
units="px"
inkscape:snap-global="false"
showguides="false"
inkscape:current-layer="IRSINIT"
inkscape:current-layer="Simple_Center"
inkscape:window-maximized="0"
inkscape:window-y="23"
inkscape:window-x="0"
inkscape:cy="938.61658"
inkscape:cx="1070.6893"
inkscape:cy="626.44135"
inkscape:cx="714.79832"
inkscape:zoom="1.7842543"
showgrid="true"
id="namedview371"
@ -279,6 +279,32 @@
x="520.20905"
id="tspan4286"
sodipodi:role="line">TEXT</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:12px;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="521.16608"
y="421.81097"
id="Simple_C3B"
transform="scale(0.991516,1.0085566)"
inkscape:label="#text4244"><tspan
sodipodi:role="line"
id="tspan4248-3"
x="521.16608"
y="421.81097"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke-width:1px">TEXT</tspan></text>
<text
inkscape:label="#text4244"
transform="scale(0.991516,1.0085566)"
id="Simple_C4B"
y="539.16522"
x="521.16608"
style="font-style:normal;font-weight:normal;font-size:12px;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke-width:1px"
y="539.16522"
x="521.16608"
id="tspan4252-9"
sodipodi:role="line">TEXT</tspan></text>
</g>
<text
inkscape:label="#text4244"

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 143 KiB

View file

@ -6,7 +6,7 @@ var __self__ = caller(0)[0];
canvas.SymbolLayer.Controller.add(name, __self__);
canvas.SymbolLayer.add(name, {
parents: [canvas.MultiSymbolLayer],
parents: [MultiSymbolLayer],
type: name, # Symbol type
df_controller: __self__, # controller to use by default -- this one
df_options: { # default configuration options

View file

@ -6,7 +6,7 @@ var __self__ = caller(0)[0];
canvas.SymbolLayer.Controller.add(name, __self__);
canvas.SymbolLayer.add(name, {
parents: [canvas.MultiSymbolLayer],
parents: [MultiSymbolLayer],
type: name, # Symbol type
df_controller: __self__, # controller to use by default -- this one
df_options: { # default configuration options

View file

@ -69,7 +69,6 @@ var alt_inhg = props.globals.getNode("/instrumentation/altimeter/setting-inhg",
var target_altitude = props.globals.getNode("/autopilot/settings/target-altitude-ft", 1);
var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1);
var altitude_pfd = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft-pfd", 1);
var trans_alt = props.globals.getNode("/FMGC/internal/trans-alt", 1);
var alt_diff = props.globals.getNode("/instrumentation/pfd/alt-diff", 1);
var ground_diff = props.globals.getNode("/instrumentation/pfd/ground-diff", 1);
var landing_diff = props.globals.getNode("/instrumentation/pfd/landing-diff", 1);
@ -645,7 +644,7 @@ var canvas_PFD_base = {
me["QNH"].hide();
me["QNH_setting"].hide();
if (altitude.getValue() < trans_alt.getValue() and FMGCphase.getValue() == '4') {
if (altitude.getValue() < fmgc.FMGCInternal.transAlt and FMGCphase.getValue() == '4') {
if (qnh_going == 0) {
qnh_going = 1;
}
@ -670,7 +669,7 @@ var canvas_PFD_base = {
me["QNH_std"].hide();
me["QNH_box"].hide();
if (altitude.getValue() >= trans_alt.getValue() and FMGCphase.getValue() == '2') {
if (altitude.getValue() >= fmgc.FMGCInternal.transAlt and FMGCphase.getValue() == '2') {
if (qnh_going == 0) {
qnh_going = 1;
}
@ -695,7 +694,7 @@ var canvas_PFD_base = {
} else if (alt_inhg_mode.getValue() == 1) {
if (altitude.getValue() >= trans_alt.getValue() and FMGCphase.getValue() == '2') {
if (altitude.getValue() >= fmgc.FMGCInternal.transAlt and FMGCphase.getValue() == '2') {
if (qnh_going == 0) {
qnh_going = 1;
}

View file

@ -151,7 +151,7 @@ var warning = {
},
callPage: func() {
if (me.sdPage == "nil" or me.hasCalled == 1) { return; }
libraries.SystemDisplay.failCall(me.sdPage);
ecam.SystemDisplay.failCall(me.sdPage);
me.hasCalled = 1;
}
};
@ -383,7 +383,7 @@ var ECAM_controller = {
}
if (statusFlag == 1 and lines[0].getValue() == "") {
libraries.SystemDisplay.manCall("sts");
ecam.SystemDisplay.manCall("sts");
statusFlag = 0;
}
},

View file

@ -2033,13 +2033,13 @@ var messages_right_memo = func {
land_asap_a.active = 0;
}
if (libraries.ap_active == 1 and apWarn.getValue() == 1) {
if (ecam.ap_active == 1 and apWarn.getValue() == 1) {
ap_off.active = 1;
} else {
ap_off.active = 0;
}
if (libraries.athr_active == 1 and athrWarn.getValue() == 1) {
if (ecam.athr_active == 1 and athrWarn.getValue() == 1) {
athr_off.active = 1;
} else {
athr_off.active = 0;

View file

@ -102,7 +102,7 @@ var FCUController = {
if (me.FCUworking and fbw.FBW.activeLaw.getValue() == 0) {
if (!ap1.getBoolValue()) {
ap1Input.setValue(1);
libraries.apWarnNode.setValue(0);
ecam.apWarnNode.setValue(0);
} else {
apOff("hard", 1);
}
@ -489,7 +489,7 @@ var updateActiveFMGC = func {
# Autopilot Disconnection
var apOff = func(type, side) {
if ((ap1Input.getValue() and (side == 1 or side == 0)) or (ap2Input.getValue() and (side == 2 or side == 0))) {
libraries.doApWarn(type);
ecam.doApWarn(type);
}
if (side == 0) {
@ -509,7 +509,7 @@ var athrOff = func(type) {
fadec.lockThr();
}
athrInput.setValue(0);
libraries.doAthrWarn(type);
ecam.doAthrWarn(type);
}
}

View file

@ -403,12 +403,9 @@ var ITAF = {
if (FPLN.wpFlyFrom < 0) {
FPLN.wpFlyFrom = 0;
}
FPLN.currentCourse = getprop("/FMGC/flightplan[2]/wp[" ~ FPLN.wpFlyFrom ~ "]/course"); # Best left at getprop
FPLN.currentCourse = fmgc.wpCourse[2][FPLN.wpFlyFrom].getValue();
FPLN.wpFlyTo = FPLN.currentWPTemp + 1;
if (FPLN.wpFlyTo < 0) {
FPLN.wpFlyTo = 0;
}
FPLN.nextCourse = getprop("/FMGC/flightplan[2]/wp[" ~ FPLN.wpFlyTo ~ "]/course"); # Best left at getprop
FPLN.nextCourse = fmgc.wpCourse[2][FPLN.wpFlyTo].getValue();
FPLN.maxBankLimit = Internal.bankLimit.getValue();
FPLN.deltaAngle = math.abs(geo.normdeg180(FPLN.currentCourse - FPLN.nextCourse));
@ -430,7 +427,7 @@ var ITAF = {
Internal.lnavAdvanceNm.setValue(FPLN.turnDist);
# Advance logic done by flightplan controller
if (FPLN.wp0Dist.getValue() <= FPLN.turnDist) {
if (FPLN.wp0Dist.getValue() <= FPLN.turnDist and !Gear.wow1.getBoolValue()) {
flightPlanController.autoSequencing();
}
}

View file

@ -1,7 +1,7 @@
# A3XX FMGC/Autoflight
# Joshua Davidson (Octal450) and Jonathan Redpath (legoboyvdlp)
# Copyright (c) 2020 Josh Davidson (Octal450)
# Copyright (c) 2020 Josh Davidson (Octal450) and Matthew Maring (mattmaring)
##################
# Init Functions #
@ -97,47 +97,54 @@ var thr1 = 0;
var thr2 = 0;
var altsel = 0;
var crzFl = 0;
setprop("FMGC/internal/maxspeed", 0);
setprop("FMGC/internal/minspeed", 0);
setprop("/FMGC/internal/maxspeed", 0);
setprop("/FMGC/internal/minspeed", 0);
setprop("position/gear-agl-ft", 0);
setprop("FMGC/internal/mng-spd", 157);
setprop("FMGC/internal/mng-spd-cmd", 157);
setprop("FMGC/internal/mng-kts-mach", 0);
setprop("FMGC/internal/mach-switchover", 0);
setprop("/FMGC/internal/mng-spd", 157);
setprop("/FMGC/internal/mng-spd-cmd", 157);
setprop("/FMGC/internal/mng-kts-mach", 0);
setprop("/FMGC/internal/mach-switchover", 0);
setprop("it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway
setprop("it-autoflight/internal/vert-speed-fpm", 0);
setprop("it-autoflight/output/fma-pwr", 0);
setprop("instrumentation/nav[0]/nav-id", "XXX");
setprop("instrumentation/nav[1]/nav-id", "XXX");
setprop("FMGC/internal/ils1-mcdu", "XXX/999.99");
setprop("FMGC/internal/ils2-mcdu", "XXX/999.99");
setprop("FMGC/internal/vor1-mcdu", "XXX/999.99");
setprop("FMGC/internal/vor2-mcdu", "999.99/XXX");
setprop("FMGC/internal/adf1-mcdu", "XXX/999.99");
setprop("FMGC/internal/adf2-mcdu", "999.99/XXX");
setprop("/FMGC/internal/ils1-mcdu", "XXX/999.99");
setprop("/FMGC/internal/ils2-mcdu", "XXX/999.99");
setprop("/FMGC/internal/vor1-mcdu", "XXX/999.99");
setprop("/FMGC/internal/vor2-mcdu", "999.99/XXX");
setprop("/FMGC/internal/adf1-mcdu", "XXX/999.99");
setprop("/FMGC/internal/adf2-mcdu", "999.99/XXX");
setprop("gear/gear[0]/wow-fmgc", 1);
var FMGCinit = func {
setprop("FMGC/status/to-state", 0);
setprop("FMGC/status/phase", "0"); # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done
setprop("FMGC/internal/maxspeed", 338);
setprop("FMGC/internal/mng-spd", 157);
setprop("FMGC/internal/mng-spd-cmd", 157);
setprop("FMGC/internal/mng-kts-mach", 0);
setprop("FMGC/internal/mach-switchover", 0);
setprop("/FMGC/status/to-state", 0);
setprop("/FMGC/status/phase", 0); # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done
setprop("/FMGC/internal/maxspeed", 338);
setprop("/FMGC/internal/mng-spd", 157);
setprop("/FMGC/internal/mng-spd-cmd", 157);
setprop("/FMGC/internal/mng-kts-mach", 0);
setprop("/FMGC/internal/mach-switchover", 0);
setprop("it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway
setprop("FMGC/internal/decel", 0);
setprop("FMGC/internal/loc-source", "NAV0");
setprop("FMGC/internal/optalt", 0);
setprop("FMGC/internal/landing-time", -99);
setprop("FMGC/internal/align1-time", -99);
setprop("FMGC/internal/align2-time", -99);
setprop("FMGC/internal/align3-time", -99);
setprop("/FMGC/internal/decel", 0);
setprop("/FMGC/internal/loc-source", "NAV0");
setprop("/FMGC/internal/optalt", 0);
setprop("/FMGC/internal/landing-time", -99);
setprop("/FMGC/internal/align1-time", -99);
setprop("/FMGC/internal/align2-time", -99);
setprop("/FMGC/internal/align3-time", -99);
setprop("/FMGC/internal/block-fuel-time", -99);
setprop("/FMGC/internal/fuel-pred-time", -99);
masterFMGC.start();
various.start();
various2.start();
}
var FMGCInternal = {
transAlt: 18000,
transAltSet: 0,
};
############
# FBW Trim #
############
@ -174,6 +181,199 @@ setlistener("/FMGC/internal/cruise-ft", func {
setprop("autopilot/route-manager/cruise/altitude-ft", getprop("/FMGC/internal/cruise-ft"));
});
########
# FUEL #
########
# Calculations maintained at https://github.com/mattmaring/A320-family-fuel-model
# Copyright (c) 2020 Matthew Maring (mattmaring)
#
var updateFuel = func {
# Check engine status
if (num(getprop("/engines/engine[0]/n1-actual")) > 0 or num(getprop("/engines/engine[1]/n1-actual")) > 0) {
setprop("/FMGC/internal/block", sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)));
}
# Calculate (final) holding fuel
if (getprop("/FMGC/internal/final-fuel-set")) {
final_fuel = 1000 * getprop("/FMGC/internal/final-fuel");
zfw = 1000 * getprop("/FMGC/internal/zfw");
final_time = final_fuel / (2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903)); # x2 for 2 engines
if (final_time < 0) {
final_time = 0;
} else if (final_time > 480) {
final_time = 480;
}
if (num(final_time) >= 60) {
final_min = int(math.mod(final_time, 60));
final_hour = int((final_time - final_min) / 60);
setprop("/FMGC/internal/final-time", sprintf("%02d", final_hour) ~ sprintf("%02d", final_min));
} else {
setprop("/FMGC/internal/final-time", sprintf("%04d", final_time));
}
} else {
if (!getprop("/FMGC/internal/final-time-set")) {
setprop("/FMGC/internal/final-time", "0030");
}
final_time = int(getprop("/FMGC/internal/final-time"));
if (final_time >= 100) {
final_time = final_time - 100 + 60; # can't be set above 90 (0130)
}
zfw = 1000 * getprop("/FMGC/internal/zfw");
final_fuel = final_time * 2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903); # x2 for 2 engines
if (final_fuel < 0) {
final_fuel = 0;
} else if (final_fuel > 80000) {
final_fuel = 80000;
}
setprop("/FMGC/internal/final-fuel", final_fuel / 1000);
}
# Calculate alternate fuel
if (!getprop("/FMGC/internal/alt-fuel-set") and getprop("/FMGC/internal/alt-set")) {
#calc
} else if (getprop("/FMGC/internal/alt-fuel-set") and getprop("/FMGC/internal/alt-set")) {
#dummy calc for now
alt_fuel = 1000 * num(getprop("/FMGC/internal/alt-fuel"));
zfw = 1000 * getprop("/FMGC/internal/zfw");
alt_time = alt_fuel / (2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903)); # x2 for 2 engines
if (alt_time < 0) {
alt_time = 0;
} else if (alt_time > 480) {
alt_time = 480;
}
if (num(alt_time) >= 60) {
alt_min = int(math.mod(alt_time, 60));
alt_hour = int((alt_time - alt_min) / 60);
setprop("/FMGC/internal/alt-time", sprintf("%02d", alt_hour) ~ sprintf("%02d", alt_min));
} else {
setprop("/FMGC/internal/alt-time", sprintf("%04d", alt_time));
}
} else if (!getprop("/FMGC/internal/alt-fuel-set")) {
setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000");
}
# Calculate min dest fob (final + alternate)
if (!getprop("/FMGC/internal/min-dest-fob-set")) {
setprop("/FMGC/internal/min-dest-fob", num(getprop("/FMGC/internal/alt-fuel") + getprop("/FMGC/internal/final-fuel")));
}
if (getprop("/FMGC/internal/zfw-set")) {
setprop("/FMGC/internal/lw", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/alt-fuel") + getprop("/FMGC/internal/final-fuel")));
}
# Calculate trip fuel
if (getprop("/FMGC/internal/tofrom-set") and getprop("/FMGC/internal/cruise-lvl-set") and getprop("/FMGC/internal/cruise-temp-set") and getprop("/FMGC/internal/zfw-set")) {
crz = getprop("/FMGC/internal/cruise-fl");
temp = getprop("/FMGC/internal/cruise-temp");
dist = flightPlanController.arrivalDist;
wind = getprop("/FMGC/internal/trip-wind");
wind_value = getprop("/FMGC/internal/trip-wind-value");
if (find("HD", wind) != -1 or find("-", wind) != -1 or find("H", wind) != -1) {
wind_value = wind_value * -1;
}
dist = dist - (dist * wind_value * 0.002);
#trip_fuel = 4.003e+02 + (dist * -5.399e+01) + (dist * dist * -7.322e-02) + (dist * dist * dist * 1.091e-05) + (dist * dist * dist * dist * 2.962e-10) + (dist * dist * dist * dist * dist * -1.178e-13) + (dist * dist * dist * dist * dist * dist * 6.322e-18) + (crz * 5.387e+01) + (dist * crz * 1.583e+00) + (dist * dist * crz * 7.695e-04) + (dist * dist * dist * crz * -1.057e-07) + (dist * dist * dist * dist * crz * 1.138e-12) + (dist * dist * dist * dist * dist * crz * 1.736e-16) + (crz * crz * -1.171e+00) + (dist * crz * crz * -1.219e-02) + (dist * dist * crz * crz * -2.879e-06) + (dist * dist * dist * crz * crz * 3.115e-10) + (dist * dist * dist * dist * crz * crz * -4.093e-15) + (crz * crz * crz * 9.160e-03) + (dist * crz * crz * crz * 4.311e-05) + (dist * dist * crz * crz * crz * 4.532e-09) + (dist * dist * dist * crz * crz * crz * -2.879e-13) + (crz * crz * crz * crz * -3.338e-05) + (dist * crz * crz * crz * crz * -7.340e-08) + (dist * dist * crz * crz * crz * crz * -2.494e-12) + (crz * crz * crz * crz * crz * 5.849e-08) + (dist * crz * crz * crz * crz * crz * 4.898e-11) + (crz * crz * crz * crz * crz * crz * -3.999e-11);
trip_fuel = 4.018e+02 + (dist*3.575e+01) + (dist*dist*-4.260e-02) + (dist*dist*dist*-1.446e-05) + (dist*dist*dist*dist*4.101e-09) + (dist*dist*dist*dist*dist*-6.753e-13) + (dist*dist*dist*dist*dist*dist*5.074e-17) + (crz*-2.573e+01) + (dist*crz*-1.583e-01) + (dist*dist*crz*8.147e-04) + (dist*dist*dist*crz*4.485e-08) + (dist*dist*dist*dist*crz*-7.656e-12) + (dist*dist*dist*dist*dist*crz*4.503e-16) + (crz*crz*4.427e-01) + (dist*crz*crz*-1.137e-03) + (dist*dist*crz*crz*-4.409e-06) + (dist*dist*dist*crz*crz*-3.345e-11) + (dist*dist*dist*dist*crz*crz*4.985e-15) + (crz*crz*crz*-2.471e-03) + (dist*crz*crz*crz*1.223e-05) + (dist*dist*crz*crz*crz*9.660e-09) + (dist*dist*dist*crz*crz*crz*-2.127e-14) + (crz*crz*crz*crz*5.714e-06) + (dist*crz*crz*crz*crz*-3.546e-08) + (dist*dist*crz*crz*crz*crz*-7.536e-12) + (crz*crz*crz*crz*crz*-4.061e-09) + (dist*crz*crz*crz*crz*crz*3.355e-11) + (crz*crz*crz*crz*crz*crz*-1.451e-12);
if (trip_fuel < 400) {
trip_fuel = 400;
} else if (trip_fuel > 80000) {
trip_fuel = 80000;
}
# cruize temp correction
trip_fuel = trip_fuel + (0.033 * (temp - 15 + (2 * crz / 10)) * flightPlanController.arrivalDist);
trip_time = 9.095e-02 + (dist*-3.968e-02) + (dist*dist*4.302e-04) + (dist*dist*dist*2.005e-07) + (dist*dist*dist*dist*-6.876e-11) + (dist*dist*dist*dist*dist*1.432e-14) + (dist*dist*dist*dist*dist*dist*-1.177e-18) + (crz*7.348e-01) + (dist*crz*3.310e-03) + (dist*dist*crz*-8.700e-06) + (dist*dist*dist*crz*-4.214e-10) + (dist*dist*dist*dist*crz*5.652e-14) + (dist*dist*dist*dist*dist*crz*-6.379e-18) + (crz*crz*-1.449e-02) + (dist*crz*crz*-7.508e-06) + (dist*dist*crz*crz*4.529e-08) + (dist*dist*dist*crz*crz*3.699e-13) + (dist*dist*dist*dist*crz*crz*8.466e-18) + (crz*crz*crz*1.108e-04) + (dist*crz*crz*crz*-4.126e-08) + (dist*dist*crz*crz*crz*-9.645e-11) + (dist*dist*dist*crz*crz*crz*-1.544e-16) + (crz*crz*crz*crz*-4.123e-07) + (dist*crz*crz*crz*crz*1.831e-10) + (dist*dist*crz*crz*crz*crz*7.438e-14) + (crz*crz*crz*crz*crz*7.546e-10) + (dist*crz*crz*crz*crz*crz*-1.921e-13) + (crz*crz*crz*crz*crz*crz*-5.453e-13);
if (trip_time < 10) {
trip_time = 10;
} else if (trip_time > 480) {
trip_time = 480;
}
# if (low air conditioning) {
# trip_fuel = trip_fuel * 0.995;
#}
# if (total anti-ice) {
# trip_fuel = trip_fuel * 1.045;
#} else if (engine anti-ice) {
# trip_fuel = trip_fuel * 1.02;
#}
zfw = getprop("/FMGC/internal/zfw");
landing_weight_correction = 9.951e+00 + (dist*-2.064e+00) + (dist*dist*2.030e-03) + (dist*dist*dist*8.179e-08) + (dist*dist*dist*dist*-3.941e-11) + (dist*dist*dist*dist*dist*2.443e-15) + (crz*2.771e+00) + (dist*crz*3.067e-02) + (dist*dist*crz*-1.861e-05) + (dist*dist*dist*crz*2.516e-10) + (dist*dist*dist*dist*crz*5.452e-14) + (crz*crz*-4.483e-02) + (dist*crz*crz*-1.645e-04) + (dist*dist*crz*crz*5.212e-08) + (dist*dist*dist*crz*crz*-8.721e-13) + (crz*crz*crz*2.609e-04) + (dist*crz*crz*crz*3.898e-07) + (dist*dist*crz*crz*crz*-4.617e-11) + (crz*crz*crz*crz*-6.488e-07) + (dist*crz*crz*crz*crz*-3.390e-10) + (crz*crz*crz*crz*crz*5.835e-10);
trip_fuel = trip_fuel + (landing_weight_correction * (getprop("/FMGC/internal/lw") * 1000 - 121254.24421) / 2204.622622);
if (trip_fuel < 400) {
trip_fuel = 400;
} else if (trip_fuel > 80000) {
trip_fuel = 80000;
}
setprop("/FMGC/internal/trip-fuel", trip_fuel / 1000);
if (num(trip_time) >= 60) {
trip_min = int(math.mod(trip_time, 60));
trip_hour = int((trip_time - trip_min) / 60);
setprop("/FMGC/internal/trip-time", sprintf("%02d", trip_hour) ~ sprintf("%02d", trip_min));
} else {
setprop("/FMGC/internal/trip-time", sprintf("%04d", trip_time));
}
} else {
setprop("/FMGC/internal/trip-fuel", 0.0);
setprop("/FMGC/internal/trip-time", "0000");
}
# Calculate reserve fuel
if (getprop("/FMGC/internal/rte-rsv-set")) {
if (num(getprop("/FMGC/internal/trip-fuel")) == 0.0) {
setprop("/FMGC/internal/rte-percent", 0.0);
} else {
if (num(getprop("/FMGC/internal/rte-rsv") / getprop("/FMGC/internal/trip-fuel") * 100.0) <= 15.0) {
setprop("/FMGC/internal/rte-percent", num(getprop("/FMGC/internal/rte-rsv") / getprop("/FMGC/internal/trip-fuel") * 100.0));
} else {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value
}
}
} else if (getprop("/FMGC/internal/rte-percent-set")) {
setprop("/FMGC/internal/rte-rsv", num(getprop("/FMGC/internal/trip-fuel") * getprop("/FMGC/internal/rte-percent") / 100.0));
} else {
if (num(getprop("/FMGC/internal/trip-fuel")) == 0.0) {
setprop("/FMGC/internal/rte-percent", 5.0);
} else {
setprop("/FMGC/internal/rte-rsv", num(getprop("/FMGC/internal/trip-fuel") * getprop("/FMGC/internal/rte-percent") / 100.0));
}
}
# Calcualte extra fuel
if (getprop("/FMGC/internal/block-set")) {
extra_fuel = 1000 * num(getprop("/FMGC/internal/block") - getprop("/FMGC/internal/trip-fuel") - getprop("/FMGC/internal/min-dest-fob") - getprop("/FMGC/internal/taxi-fuel") - getprop("/FMGC/internal/rte-rsv"));
setprop("/FMGC/internal/extra-fuel", extra_fuel / 1000);
lw = 1000 * getprop("/FMGC/internal/lw");
extra_time = extra_fuel / (2.0 * ((lw*lw*-2e-10) + (lw*0.0003) + 2.8903)); # x2 for 2 engines
if (extra_time < 0) {
extra_time = 0;
} else if (extra_time > 480) {
extra_time = 480;
}
if (num(extra_time) >= 60) {
extra_min = int(math.mod(extra_time, 60));
extra_hour = int((extra_time - extra_min) / 60);
setprop("/FMGC/internal/extra-time", sprintf("%02d", extra_hour) ~ sprintf("%02d", extra_min));
} else {
setprop("/FMGC/internal/extra-time", sprintf("%04d", extra_time));
}
if (getprop("/FMGC/internal/extra-fuel") > -0.1 and getprop("/FMGC/internal/extra-fuel") < 0.1) {
setprop("/FMGC/internal/extra-fuel", 0.0);
}
} else {
setprop("/FMGC/internal/block", num(getprop("/FMGC/internal/alt-fuel") + getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/trip-fuel") + getprop("/FMGC/internal/rte-rsv") + getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/block-set", 1);
}
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
}
############################
# Flight Phase and Various #
############################
@ -194,6 +394,7 @@ var masterFMGC = maketimer(0.2, func {
phase = getprop("/FMGC/status/phase");
state1 = getprop("/systems/thrust/state1");
state2 = getprop("/systems/thrust/state2");
gear0 = getprop("/gear/gear[0]/wow");
wowl = getprop("/gear/gear[1]/wow");
wowr = getprop("/gear/gear[2]/wow");
targetalt = getprop("/it-autoflight/internal/alt");
@ -213,9 +414,6 @@ var masterFMGC = maketimer(0.2, func {
newvertarm = getprop("/modes/pfd/fma/pitch-mode2-armed");
thr1 = getprop("/controls/engines/engine[0]/throttle-pos");
thr2 = getprop("/controls/engines/engine[1]/throttle-pos");
gear0 = getprop("/gear/gear[0]/wow");
state1 = getprop("/systems/thrust/state1");
state2 = getprop("/systems/thrust/state2");
altSel = getprop("/it-autoflight/input/alt");
crzFl = getprop("/FMGC/internal/cruise-fl");
@ -224,39 +422,39 @@ var masterFMGC = maketimer(0.2, func {
}
if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == " " and gear0 == 1 and phase == 1) { # rejected takeoff
setprop("FMGC/status/phase", 0);
setprop("/FMGC/status/phase", 0);
setprop("systems/pressurization/mode", "GN");
}
if (gear0 == 1 and phase == 0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) {
setprop("FMGC/status/phase", 1);
setprop("/FMGC/status/phase", 1);
setprop("systems/pressurization/mode", "TO");
}
if (phase == 1 and ((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) {
setprop("FMGC/status/phase", 2);
setprop("/FMGC/status/phase", 2);
setprop("systems/pressurization/mode", "TO");
}
if (phase == 2 and (mode == "ALT CRZ" or mode == "ALT CRZ*")) {
setprop("FMGC/status/phase", 3);
setprop("/FMGC/status/phase", 3);
setprop("systems/pressurization/mode", "CR");
}
if (crzFl >= 200) {
if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) {
setprop("FMGC/status/phase", 4);
setprop("/FMGC/status/phase", 4);
setprop("systems/pressurization/mode", "DE");
}
} else {
if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < (crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens!
setprop("FMGC/status/phase", 4);
setprop("/FMGC/status/phase", 4);
setprop("systems/pressurization/mode", "DE");
}
}
if (phase == 4 and getprop("/FMGC/internal/decel")) {
setprop("FMGC/status/phase", 5);
setprop("/FMGC/status/phase", 5);
}
if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and flightPlanController.arrivalDist <= 15 and (modelat == "NAV" or modelat == "LOC" or modelat == "LOC*") and aglalt < 9500) { #todo decel pseudo waypoint
@ -266,21 +464,21 @@ var masterFMGC = maketimer(0.2, func {
}
if ((phase == "5") and state1 == "TOGA" and state2 == "TOGA") {
setprop("FMGC/status/phase", 6);
setprop("/FMGC/status/phase", 6);
setprop("systems/pressurization/mode", "TO");
setprop("it-autoflight/input/toga", 1);
}
if (phase == "6" and alt >= accel_agl_ft) { # todo when insert altn or new dest
setprop("FMGC/status/phase", 2);
setprop("/FMGC/status/phase", 2);
}
if (getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") != 1024) {
setprop("FMGC/internal/maxspeed", getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") - 4);
setprop("/FMGC/internal/maxspeed", getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") - 4);
} elsif (pts.Gear.position[0].getValue() != 0 or pts.Gear.position[1].getValue() != 0 or pts.Gear.position[2].getValue() != 0) {
setprop("FMGC/internal/maxspeed", 284);
setprop("/FMGC/internal/maxspeed", 284);
} else {
setprop("FMGC/internal/maxspeed", getprop("/it-fbw/speeds/vmo-mmo"));
setprop("/FMGC/internal/maxspeed", getprop("/it-fbw/speeds/vmo-mmo"));
}
# calculate speeds
@ -325,7 +523,7 @@ var masterFMGC = maketimer(0.2, func {
} else {
vapp = vls + dest_wind;
}
setprop("FMGC/internal/computed-speeds/vapp", vapp);
setprop("/FMGC/internal/computed-speeds/vapp", vapp);
}
aoa_prot = 15;
@ -383,100 +581,100 @@ var masterFMGC = maketimer(0.2, func {
} else {
vapp_appr = vls_appr + dest_wind;
}
setprop("FMGC/internal/computed-speeds/vapp_appr", vapp_appr);
setprop("/FMGC/internal/computed-speeds/vapp_appr", vapp_appr);
}
# set the values globally
setprop("FMGC/internal/computed-speeds/clean", clean);
setprop("FMGC/internal/computed-speeds/vs1g_clean", vs1g_clean);
setprop("FMGC/internal/computed-speeds/vs1g_conf_1", vs1g_conf_1);
setprop("FMGC/internal/computed-speeds/vs1g_conf_1f", vs1g_conf_1f);
setprop("FMGC/internal/computed-speeds/vs1g_conf_2", vs1g_conf_2);
setprop("FMGC/internal/computed-speeds/vs1g_conf_3", vs1g_conf_3);
setprop("FMGC/internal/computed-speeds/vs1g_conf_full", vs1g_conf_full);
setprop("FMGC/internal/computed-speeds/slat", slat);
setprop("FMGC/internal/computed-speeds/flap2", flap2);
setprop("FMGC/internal/computed-speeds/flap3", flap3);
setprop("FMGC/internal/computed-speeds/vls", vls);
setprop("FMGC/internal/computed-speeds/alpha_prot", alpha_prot);
setprop("FMGC/internal/computed-speeds/alpha_max", alpha_max);
setprop("/FMGC/internal/computed-speeds/clean", clean);
setprop("/FMGC/internal/computed-speeds/vs1g_clean", vs1g_clean);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_1", vs1g_conf_1);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_1f", vs1g_conf_1f);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_2", vs1g_conf_2);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_3", vs1g_conf_3);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_full", vs1g_conf_full);
setprop("/FMGC/internal/computed-speeds/slat", slat);
setprop("/FMGC/internal/computed-speeds/flap2", flap2);
setprop("/FMGC/internal/computed-speeds/flap3", flap3);
setprop("/FMGC/internal/computed-speeds/vls", vls);
setprop("/FMGC/internal/computed-speeds/alpha_prot", alpha_prot);
setprop("/FMGC/internal/computed-speeds/alpha_max", alpha_max);
setprop("FMGC/internal/computed-speeds/vs1g_clean_to", vs1g_clean_to);
setprop("FMGC/internal/computed-speeds/vs1g_conf_2_to", vs1g_conf_2_to);
setprop("FMGC/internal/computed-speeds/vs1g_conf_3_to", vs1g_conf_3_to);
setprop("FMGC/internal/computed-speeds/vs1g_conf_full_to", vs1g_conf_full_to);
setprop("FMGC/internal/computed-speeds/slat_to", slat_to);
setprop("FMGC/internal/computed-speeds/flap2_to", flap2_to);
setprop("FMGC/internal/computed-speeds/clean_to", clean_to);
setprop("/FMGC/internal/computed-speeds/vs1g_clean_to", vs1g_clean_to);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_to", vs1g_conf_2_to);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_to", vs1g_conf_3_to);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_to", vs1g_conf_full_to);
setprop("/FMGC/internal/computed-speeds/slat_to", slat_to);
setprop("/FMGC/internal/computed-speeds/flap2_to", flap2_to);
setprop("/FMGC/internal/computed-speeds/clean_to", clean_to);
setprop("FMGC/internal/computed-speeds/vs1g_clean_appr", vs1g_clean_appr);
setprop("FMGC/internal/computed-speeds/vs1g_conf_2_appr", vs1g_conf_2_appr);
setprop("FMGC/internal/computed-speeds/vs1g_conf_3_appr", vs1g_conf_3_appr);
setprop("FMGC/internal/computed-speeds/vs1g_conf_full_appr", vs1g_conf_full_appr);
setprop("FMGC/internal/computed-speeds/slat_appr", slat_appr);
setprop("FMGC/internal/computed-speeds/flap2_appr", flap2_appr);
setprop("FMGC/internal/computed-speeds/clean_appr", clean_appr);
setprop("FMGC/internal/computed-speeds/vls_appr", vls_appr);
setprop("/FMGC/internal/computed-speeds/vs1g_clean_appr", vs1g_clean_appr);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_appr", vs1g_conf_2_appr);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_appr", vs1g_conf_3_appr);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_appr", vs1g_conf_full_appr);
setprop("/FMGC/internal/computed-speeds/slat_appr", slat_appr);
setprop("/FMGC/internal/computed-speeds/flap2_appr", flap2_appr);
setprop("/FMGC/internal/computed-speeds/clean_appr", clean_appr);
setprop("/FMGC/internal/computed-speeds/vls_appr", vls_appr);
# Need info on these, also correct for height at altitude...
# https://www.pprune.org/archive/index.php/t-587639.html
if (getprop("/FMGC/status/to-state") == 1) {
if (flap == 0) { # 0
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_clean * 1.28);
setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_clean * 1.28);
} else if (flap == 1) { # 1
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_conf_1 * 1.23);
setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_conf_1 * 1.23);
} else { # 1+F
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_clean * 1.13);
setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_clean * 1.13);
}
} else {
if (flap == 0) { # 0
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_clean * 1.23);
setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_clean * 1.23);
} else if (flap == 1) { # 1
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_conf_1 * 1.23);
setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_conf_1 * 1.23);
} else if (flap == 2) { # 1+F
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_conf_1f * 1.23);
setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_conf_1f * 1.23);
} else if (flap == 3) { # 2
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_conf_2 * 1.23);
setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_conf_2 * 1.23);
} else if (flap == 4) { # 3
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_conf_3 * 1.23);
setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_conf_3 * 1.23);
} else if (flap == 5) { # FULL
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_conf_full * 1.23);
setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_conf_full * 1.23);
}
}
if (flap == 0) { # 0
setprop("FMGC/internal/computed-speeds/vsw", vs1g_clean);
setprop("/FMGC/internal/computed-speeds/vsw", vs1g_clean);
} else if (flap == 1) { # 1
setprop("FMGC/internal/computed-speeds/vsw", vs1g_conf_1);
setprop("/FMGC/internal/computed-speeds/vsw", vs1g_conf_1);
} else if (flap == 2) { # 1+F
setprop("FMGC/internal/computed-speeds/vsw", vs1g_conf_1f);
setprop("/FMGC/internal/computed-speeds/vsw", vs1g_conf_1f);
} else if (flap == 3) { # 2
setprop("FMGC/internal/computed-speeds/vsw", vs1g_conf_2);
setprop("/FMGC/internal/computed-speeds/vsw", vs1g_conf_2);
} else if (flap == 4) { # 3
setprop("FMGC/internal/computed-speeds/vsw", vs1g_conf_3);
setprop("/FMGC/internal/computed-speeds/vsw", vs1g_conf_3);
} else if (flap == 5) { # FULL
setprop("FMGC/internal/computed-speeds/vsw", vs1g_conf_full);
setprop("/FMGC/internal/computed-speeds/vsw", vs1g_conf_full);
}
if (flap == 0) { # 0
setprop("FMGC/internal/minspeed", clean);
setprop("/FMGC/internal/minspeed", clean);
} else if (flap == 1) { # 1
setprop("FMGC/internal/minspeed", slat);
setprop("/FMGC/internal/minspeed", slat);
} else if (flap == 2) { # 1+F
setprop("FMGC/internal/minspeed", slat);
setprop("/FMGC/internal/minspeed", slat);
} else if (flap == 3) { # 2
setprop("FMGC/internal/minspeed", flap2);
setprop("/FMGC/internal/minspeed", flap2);
} else if (flap == 4) { # 3
setprop("FMGC/internal/minspeed", flap3);
setprop("/FMGC/internal/minspeed", flap3);
} else if (flap == 5) { # FULL
setprop("FMGC/internal/minspeed", vapp);
setprop("/FMGC/internal/minspeed", vapp);
}
if (gear0 == 1 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA") and flaps < 5) {
setprop("FMGC/status/to-state", 1);
setprop("/FMGC/status/to-state", 1);
}
if (pts.Position.gearAglFt.getValue() >= 55) {
setprop("FMGC/status/to-state", 0);
setprop("/FMGC/status/to-state", 0);
}
#handle radios, runways, v1/vr/v2
@ -484,15 +682,15 @@ var masterFMGC = maketimer(0.2, func {
destination_rwy = fmgc.flightPlanController.flightplans[2].destination_runway;
if (destination_rwy != nil and phase >= 2) {
var airport = airportinfo(getprop("/FMGC/internal/arr-arpt"));
setprop("FMGC/internal/ldg-elev", airport.elevation * M2FT); # eventually should be runway elevation
setprop("/FMGC/internal/ldg-elev", airport.elevation * M2FT); # eventually should be runway elevation
magnetic_hdg = geo.normdeg(destination_rwy.heading - getprop("/environment/magnetic-variation-deg"));
runway_ils = destination_rwy.ils_frequency_mhz;
if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) {
setprop("FMGC/internal/ils1freq-calculated", runway_ils);
setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
} else if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) {
setprop("FMGC/internal/ils1freq-calculated", runway_ils);
setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
} else if (!getprop("/FMGC/internal/ils1crs-set")) {
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
@ -501,11 +699,11 @@ var masterFMGC = maketimer(0.2, func {
magnetic_hdg = geo.normdeg(departure_rwy.heading - getprop("/environment/magnetic-variation-deg"));
runway_ils = departure_rwy.ils_frequency_mhz;
if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) {
setprop("FMGC/internal/ils1freq-calculated", runway_ils);
setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
} else if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) {
setprop("FMGC/internal/ils1freq-calculated", runway_ils);
setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
} else if (!getprop("/FMGC/internal/ils1crs-set")) {
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
@ -514,7 +712,7 @@ var masterFMGC = maketimer(0.2, func {
});
var reset_FMGC = func {
setprop("FMGC/status/phase", "0");
setprop("/FMGC/status/phase", 0);
fd1 = getprop("/it-autoflight/input/fd1");
fd2 = getprop("/it-autoflight/input/fd2");
spd = getprop("/it-autoflight/input/spd-kts");
@ -564,7 +762,7 @@ var various = maketimer(1, func {
setprop("it-autoflight/settings/accel-agl-ft", getprop("/FMGC/internal/accel-agl-ft"));
}
setprop("FMGC/internal/gw", math.round(getprop("/fdm/jsbsim/inertia/weight-lbs"), 100));
setprop("/FMGC/internal/gw", math.round(getprop("/fdm/jsbsim/inertia/weight-lbs"), 100));
});
var various2 = maketimer(0.5, func {
@ -582,9 +780,9 @@ var nav0 = func {
var namenav0 = getprop("/instrumentation/nav[0]/nav-id");
if (freqnav0 >= 108.10 and freqnav0 <= 111.95) {
if (namenav0 != "") {
setprop("FMGC/internal/ils1-mcdu", namenav0 ~ "/" ~ freqnav0);
setprop("/FMGC/internal/ils1-mcdu", namenav0 ~ "/" ~ freqnav0);
} else {
setprop("FMGC/internal/ils1-mcdu", freqnav0);
setprop("/FMGC/internal/ils1-mcdu", freqnav0);
}
}
}
@ -595,9 +793,9 @@ var nav1 = func {
var namenav1 = getprop("/instrumentation/nav[1]/nav-id");
if (freqnav1 >= 108.10 and freqnav1 <= 111.95) {
if (namenav1 != "") {
setprop("FMGC/internal/ils2-mcdu", freqnav1 ~ "/" ~ namenav1);
setprop("/FMGC/internal/ils2-mcdu", freqnav1 ~ "/" ~ namenav1);
} else {
setprop("FMGC/internal/ils2-mcdu", freqnav1);
setprop("/FMGC/internal/ils2-mcdu", freqnav1);
}
}
}
@ -608,9 +806,9 @@ var nav2 = func {
var namenav2 = getprop("/instrumentation/nav[2]/nav-id");
if (freqnav2 >= 108.00 and freqnav2 <= 117.95) {
if (namenav2 != "") {
setprop("FMGC/internal/vor1-mcdu", namenav2 ~ "/" ~ freqnav2);
setprop("/FMGC/internal/vor1-mcdu", namenav2 ~ "/" ~ freqnav2);
} else {
setprop("FMGC/internal/vor1-mcdu", freqnav2);
setprop("/FMGC/internal/vor1-mcdu", freqnav2);
}
}
}
@ -621,9 +819,9 @@ var nav3 = func {
var namenav3 = getprop("/instrumentation/nav[3]/nav-id");
if (freqnav3 >= 108.00 and freqnav3 <= 117.95) {
if (namenav3 != "") {
setprop("FMGC/internal/vor2-mcdu", freqnav3 ~ "/" ~ namenav3);
setprop("/FMGC/internal/vor2-mcdu", freqnav3 ~ "/" ~ namenav3);
} else {
setprop("FMGC/internal/vor2-mcdu", freqnav3);
setprop("/FMGC/internal/vor2-mcdu", freqnav3);
}
}
}
@ -634,9 +832,9 @@ var adf0 = func {
var nameadf0 = getprop("/instrumentation/adf[0]/ident");
if (freqadf0 >= 190 and freqadf0 <= 1750) {
if (nameadf0 != "") {
setprop("FMGC/internal/adf1-mcdu", nameadf0 ~ "/" ~ freqadf0);
setprop("/FMGC/internal/adf1-mcdu", nameadf0 ~ "/" ~ freqadf0);
} else {
setprop("FMGC/internal/adf1-mcdu", freqadf0);
setprop("/FMGC/internal/adf1-mcdu", freqadf0);
}
}
}
@ -647,9 +845,9 @@ var adf1 = func {
var nameadf1 = getprop("/instrumentation/adf[1]/ident");
if (freqadf1 >= 190 and freqadf1 <= 1750) {
if (nameadf1 != "") {
setprop("FMGC/internal/adf2-mcdu", freqadf1 ~ "/" ~ nameadf1);
setprop("/FMGC/internal/adf2-mcdu", freqadf1 ~ "/" ~ nameadf1);
} else {
setprop("FMGC/internal/adf2-mcdu", freqadf1);
setprop("/FMGC/internal/adf2-mcdu", freqadf1);
}
}
}
@ -686,83 +884,83 @@ var ManagedSPD = maketimer(0.25, func {
mng_alt_mach = math.round(mng_alt_mach_cmd, 0.001);
if (mach > mng_alt_mach and (phase == 2 or phase == 3)) {
setprop("FMGC/internal/mach-switchover", 1);
setprop("/FMGC/internal/mach-switchover", 1);
}
if (ias > mng_alt_spd and (phase == 4 or phase == 5)) {
setprop("FMGC/internal/mach-switchover", 0);
setprop("/FMGC/internal/mach-switchover", 0);
}
if ((mode == " " or mode == "SRS") and (phase == 0 or phase == 1)) {
if (mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 0);
setprop("/FMGC/internal/mng-kts-mach", 0);
}
if (mng_spd_cmd != srsSPD) {
setprop("FMGC/internal/mng-spd-cmd", srsSPD);
setprop("/FMGC/internal/mng-spd-cmd", srsSPD);
}
} else if ((phase == 2 or phase == 3) and altitude <= 10050) {
if (mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 0);
setprop("/FMGC/internal/mng-kts-mach", 0);
}
if (mng_spd_cmd != 250 and !decel) {
setprop("FMGC/internal/mng-spd-cmd", 250);
setprop("/FMGC/internal/mng-spd-cmd", 250);
} else if (mng_spd_cmd != minspeed and decel) {
setprop("FMGC/internal/mng-spd-cmd", minspeed);
setprop("/FMGC/internal/mng-spd-cmd", minspeed);
}
} else if ((phase == 2 or phase == 3) and altitude > 10070 and !mach_switchover) {
if (mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 0);
setprop("/FMGC/internal/mng-kts-mach", 0);
}
if (mng_spd_cmd != mng_alt_spd) {
setprop("FMGC/internal/mng-spd-cmd", mng_alt_spd);
setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd);
}
} else if ((phase == 2 or phase == 3) and altitude > 10070 and mach_switchover) {
if (!mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 1);
setprop("/FMGC/internal/mng-kts-mach", 1);
}
if (mng_spd_cmd != mng_alt_mach) {
setprop("FMGC/internal/mng-spd-cmd", mng_alt_mach);
setprop("/FMGC/internal/mng-spd-cmd", mng_alt_mach);
}
} else if (phase == 4 and altitude > 11000 and !mach_switchover) {
if (mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 0);
setprop("/FMGC/internal/mng-kts-mach", 0);
}
if (mng_spd_cmd != mng_alt_spd) {
setprop("FMGC/internal/mng-spd-cmd", mng_alt_spd);
setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd);
}
} else if (phase == 4 and altitude > 11000 and mach_switchover) {
if (!mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 1);
setprop("/FMGC/internal/mng-kts-mach", 1);
}
if (mng_spd_cmd != mng_alt_mach) {
setprop("FMGC/internal/mng-spd-cmd", mng_alt_mach);
setprop("/FMGC/internal/mng-spd-cmd", mng_alt_mach);
}
} else if ((phase == 4 or phase == 5 or phase == 6) and altitude > 11000 and !mach_switchover) {
if (mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 0);
setprop("/FMGC/internal/mng-kts-mach", 0);
}
if (mng_spd_cmd != mng_alt_spd and !decel) {
setprop("FMGC/internal/mng-spd-cmd", mng_alt_spd);
setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd);
} else if (mng_spd_cmd != minspeed and decel) {
setprop("FMGC/internal/mng-spd-cmd", minspeed);
setprop("/FMGC/internal/mng-spd-cmd", minspeed);
}
} else if ((phase == 4 or phase == 5 or phase == 6) and altitude <= 10980) {
if (mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 0);
setprop("/FMGC/internal/mng-kts-mach", 0);
}
if (mng_spd_cmd != 250 and !decel) {
setprop("FMGC/internal/mng-spd-cmd", 250);
setprop("/FMGC/internal/mng-spd-cmd", 250);
} else if (mng_spd_cmd != minspeed and decel) {
setprop("FMGC/internal/mng-spd-cmd", minspeed);
setprop("/FMGC/internal/mng-spd-cmd", minspeed);
}
}
mng_spd_cmd = getprop("/FMGC/internal/mng-spd-cmd");
if (mng_spd_cmd > maxspeed -5) {
setprop("FMGC/internal/mng-spd", maxspeed -5);
setprop("/FMGC/internal/mng-spd", maxspeed -5);
} else {
setprop("FMGC/internal/mng-spd", mng_spd_cmd);
setprop("/FMGC/internal/mng-spd", mng_spd_cmd);
}
if (ktsmach and !mngktsmach) {
@ -783,7 +981,7 @@ var ManagedSPD = maketimer(0.25, func {
}
} else {
ManagedSPD.stop();
libraries.mcpSPDKnbPull();
fcu.FCUController.SPDPull();
}
});
@ -792,91 +990,136 @@ var switchDatabase = func {
database2 = getprop("/FMGC/internal/navdatabase2");
code1 = getprop("/FMGC/internal/navdatabasecode");
code2 = getprop("/FMGC/internal/navdatabasecode2");
setprop("FMGC/internal/navdatabase", database2);
setprop("FMGC/internal/navdatabase2", database1);
setprop("FMGC/internal/navdatabasecode", code2);
setprop("FMGC/internal/navdatabasecode2", code1);
setprop("/FMGC/internal/navdatabase", database2);
setprop("/FMGC/internal/navdatabase2", database1);
setprop("/FMGC/internal/navdatabasecode", code2);
setprop("/FMGC/internal/navdatabasecode2", code1);
}
# Landing to phase 7
setlistener("gear/gear[1]/wow", func() {
setlistener("/gear/gear[1]/wow", func() {
if (getprop("/gear/gear[1]/wow") == 0 and timer30secLanding.isRunning) {
timer30secLanding.stop();
setprop("FMGC/internal/landing-time", -99);
setprop("/FMGC/internal/landing-time", -99);
}
if (getprop("/gear/gear[1]/wow") == 1 and getprop("/FMGC/internal/landing-time") == -99) {
timer30secLanding.start();
setprop("FMGC/internal/landing-time", pts.Sim.Time.elapsedSec.getValue());
setprop("/FMGC/internal/landing-time", pts.Sim.Time.elapsedSec.getValue());
}
}, 0, 0);
# Align IRS 1
setlistener("systems/navigation/adr/operating-1", func() {
setlistener("/systems/navigation/adr/operating-1", func() {
if (timer48gpsAlign1.isRunning) {
timer48gpsAlign1.stop();
}
if (getprop("/FMGC/internal/align1-time") == -99) {
timer48gpsAlign1.start();
setprop("FMGC/internal/align1-time", pts.Sim.Time.elapsedSec.getValue());
setprop("/FMGC/internal/align1-time", pts.Sim.Time.elapsedSec.getValue());
}
}, 0, 0);
# Align IRS 2
setlistener("systems/navigation/adr/operating-2", func() {
setlistener("/systems/navigation/adr/operating-2", func() {
if (timer48gpsAlign2.isRunning) {
timer48gpsAlign2.stop();
}
if (getprop("/FMGC/internal/align2-time") == -99) {
timer48gpsAlign2.start();
setprop("FMGC/internal/align2-time", pts.Sim.Time.elapsedSec.getValue());
setprop("/FMGC/internal/align2-time", pts.Sim.Time.elapsedSec.getValue());
}
}, 0, 0);
# Align IRS 3
setlistener("systems/navigation/adr/operating-3", func() {
setlistener("/systems/navigation/adr/operating-3", func() {
if (timer48gpsAlign3.isRunning) {
timer48gpsAlign3.stop();
}
if (getprop("/FMGC/internal/align3-time") == -99) {
timer48gpsAlign3.start();
setprop("FMGC/internal/align3-time", pts.Sim.Time.elapsedSec.getValue());
setprop("/FMGC/internal/align3-time", pts.Sim.Time.elapsedSec.getValue());
}
}, 0, 0);
# Calculate Block Fuel
setlistener("/FMGC/internal/block-calculating", func() {
if (timer3blockFuel.isRunning) {
setprop("/FMGC/internal/block-fuel-time", -99);
timer3blockFuel.start();
setprop("/FMGC/internal/block-fuel-time", pts.Sim.Time.elapsedSec.getValue());
}
if (getprop("/FMGC/internal/block-fuel-time") == -99) {
timer3blockFuel.start();
setprop("/FMGC/internal/block-fuel-time", pts.Sim.Time.elapsedSec.getValue());
}
}, 0, 0);
# Calculate Fuel Prediction
setlistener("/FMGC/internal/fuel-calculating", func() {
if (timer5fuelPred.isRunning) {
setprop("/FMGC/internal/fuel-pred-time", -99);
timer5fuelPred.start();
setprop("/FMGC/internal/fuel-pred-time", pts.Sim.Time.elapsedSec.getValue());
}
if (getprop("/FMGC/internal/fuel-pred-time") == -99) {
timer5fuelPred.start();
setprop("/FMGC/internal/fuel-pred-time", pts.Sim.Time.elapsedSec.getValue());
}
}, 0, 0);
# Maketimers
var timer30secLanding = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/landing-time") + 30) {
setprop("FMGC/status/phase", 7);
setprop("FMGC/internal/landing-time", -99);
setprop("/FMGC/status/phase", 7);
setprop("/FMGC/internal/landing-time", -99);
timer30secLanding.stop();
}
});
var timer48gpsAlign1 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align1-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) {
setprop("FMGC/internal/align1-done", 1);
setprop("FMGC/internal/align1-time", -99);
setprop("/FMGC/internal/align1-done", 1);
setprop("/FMGC/internal/align1-time", -99);
timer48gpsAlign1.stop();
}
});
var timer48gpsAlign2 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align2-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) {
setprop("FMGC/internal/align2-done", 1);
setprop("FMGC/internal/align2-time", -99);
setprop("/FMGC/internal/align2-done", 1);
setprop("/FMGC/internal/align2-time", -99);
timer48gpsAlign2.stop();
}
});
var timer48gpsAlign3 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align3-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) {
setprop("FMGC/internal/align3-done", 1);
setprop("FMGC/internal/align3-time", -99);
setprop("/FMGC/internal/align3-done", 1);
setprop("/FMGC/internal/align3-time", -99);
timer48gpsAlign3.stop();
}
});
var timer3blockFuel = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/block-fuel-time") + 3) {
updateFuel();
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-fuel-time", -99);
timer3blockFuel.stop();
}
});
var timer5fuelPred = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/fuel-pred-time") + 5) {
updateFuel();
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-pred-time", -99);
timer5fuelPred.stop();
}
});

View file

@ -0,0 +1,285 @@
# A3XX FMGC Waypoint database
# Copyright (c) 2020 Josh Davidson (Octal450) and Jonathan Redpath (legoboyvdlp)
var nilTree = {
"latitude": 0,
"longitude": 0,
"ident": "",
};
var WaypointDatabase = {
waypointsVec: [],
confirm: [0, 0],
# addWP - adds pilot waypoint to waypoints vector
# arg: wpObj - passed pilot waypoint object
# return:
# 0 - not allowed
# 2 - accepted
# 4 - database full
addWP: func(wpObj) {
# validate ghost
if (wpObj.wpGhost == nil) {
return 0;
}
# check size of database
if (me.getCount() >= 20) {
return 4;
}
if (wpObj.index >= me.getSize()) {
# add to end, since index doesn't exist
append(me.waypointsVec, wpObj);
me.write();
return 2;
} elsif (me.waypointsVec[wpObj.index] == nil) {
# add at passed index
me.waypointsVec[wpObj.index] = wpObj;
me.write();
return 2;
} else {
# fall back to end
logprint(4, "pilotWaypoint constructor claims index " ~ wpObj.index ~ " is nil, but it isn't!");
append(me.waypointsVec, wpObj);
me.write();
return 2;
}
},
# delete - empties waypoints vector
# callerIdx is the calling mcdu
delete: func(callerIdx) {
var noDel = 0;
for (var i = 0; i < me.getSize(); i = i + 1) {
if (me.waypointsVec[i] != nil) {
if (fmgc.flightPlanController.flightplans[2].indexOfWP(me.waypointsVec[i].wpGhost) == -1) { # docs says only checks active and secondary
me.waypointsVec[i] = nil;
}
}
}
me.write();
if (me.getCount() != 0) {
setprop("/MCDU[" ~ callerIdx ~ "]/scratchpad-msg", 1);
setprop("/MCDU[" ~ callerIdx ~ "]/scratchpad", "PILOT ELEMENT RETAINED");
}
},
# deleteAtIndex - delete at specific index. Set to nil, so it still exists in vector
deleteAtIndex: func(index) {
if (index < 0 or index >= me.getSize() or index >= 20) {
return;
}
me.waypointsVec[index] = nil;
me.write();
},
# getNilIndex - find the first nil
# post 2020.1 use dedicated function vecindex()
getNilIndex: func() {
for (var i = 0; i < me.getSize(); i = i + 1) {
if (me.waypointsVec[i] == nil) {
return i;
}
}
return -1;
},
# getNonNilIndex - find the first non-nil
# post 2020.1 use dedicated function vecindex()
getNonNilIndex: func() {
for (var i = 0; i < me.getSize(); i = i + 1) {
if (me.waypointsVec[i] != nil) {
return i;
}
}
return -1;
},
# getNextFromIndex - find the next non-nil after a passed index
getNextFromIndex: func(index) {
for (var i = (index + 1); i < me.getSize(); i = i + 1) {
if (me.waypointsVec[i] != nil) {
return i;
}
}
for (var i = 0; i <= index; i = i + 1) {
if (me.waypointsVec[i] != nil) {
return i;
}
}
return index;
},
# getPreviousFromIndex - find the next non-nil before a passed index
getPreviousFromIndex: func(index) {
for (var i = (index - 1); i >= 0; i = i - 1) {
if (me.waypointsVec[i] != nil) {
return i;
}
}
for (var i = (me.getSize() - 1); i >= index; i = i - 1) {
if (me.waypointsVec[i] != nil) {
return i;
}
}
return index;
},
# getNoOfIndex - return what number passed item is in list, neglecting "nil"
getNoOfIndex: func(index) {
var count = 0;
for (var i = 0; i <= index; i = i + 1) {
if (me.waypointsVec[i] == nil) {
continue;
}
count += 1;
}
return count;
},
# getCount - return size, neglecting "nil"
getCount: func() {
var count = 0;
for (var i = 0; i < me.getSize(); i = i + 1) {
if (me.waypointsVec[i] == nil) {
continue;
}
count += 1;
}
return count;
},
# getSize - return maximum size of vector
getSize: func() {
return size(me.waypointsVec);
},
# getWP - try to find waypoint whose name matches passed argument
getWP: func(text) {
for (var i = 0; i < me.getSize(); i = i + 1) {
if (me.waypointsVec[i] == nil) {
continue;
}
if (text == me.waypointsVec[i].wpGhost.wp_name) {
return me.waypointsVec[i].wpGhost;
}
}
return nil;
},
# write - write to file, as a hash structure
write: func() {
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWaypoints.xml";
var tree = {
waypoints: {
},
};
for (var i = 0; i < me.getSize(); i = i + 1) {
if (me.waypointsVec[i] != nil) {
tree.waypoints["waypoint" ~ i] = me.waypointsVec[i].tree;
}
}
io.writexml(path, props.Node.new(tree)); # write the data
},
# read - read from a file, extract using props interface
read: func() {
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWaypoints.xml";
# create file if it doesn't exist
if (io.stat(path) == nil) {
me.write();
return;
}
var data = io.readxml(path).getChild("waypoints");
var pilotWP = nil;
for (var i = 0; i < 20; i = i + 1) {
pilotWP = nil;
var childNode = data.getChild("waypoint" ~ i);
if (childNode == nil) {
continue;
}
var wpt = createWP({lat: num(childNode.getChild("latitude").getValue()), lon: num(childNode.getChild("longitude").getValue())},childNode.getChild("ident").getValue());
if (left(childNode.getChild("ident").getValue(), 3) == "PBD") {
pilotWP = pilotWaypoint.newAtPosition(wpt, "PBD", right(childNode.getChild("ident").getValue(), 1));
} else {
pilotWP = pilotWaypoint.newAtPosition(wpt, "LL", right(childNode.getChild("ident").getValue(), 1));
}
me.addWPToPos(pilotWP, right(childNode.getChild("ident").getValue(), 1));
}
},
# addWPToPos - helper for reading - inserts at specific index
# will create nil for intermediates
addWPToPos: func(wpObj, position) {
if (me.getSize() >= position) {
me.waypointsVec[position - 1] = wpObj;
} else {
var numToIns = position - me.getSize();
while (numToIns >= 1) {
append(me.waypointsVec, nil);
numToIns -= 1;
}
me.waypointsVec[position - 1] = wpObj;
}
},
};
var pilotWaypoint = {
new: func(positioned, typeStr) {
var pilotWp = { parents:[pilotWaypoint] };
# Figure out what the first index is we can use
var nilIndex = WaypointDatabase.getNilIndex();
var position = nil;
if (nilIndex == -1) {
position = WaypointDatabase.getSize() + 1;
} else {
position = nilIndex + 1
}
pilotWp.setId(typeStr ~ sprintf("%s", position));
pilotWp.index = position - 1;
# set ghost to created waypoint
pilotWp.wpGhost = createWP(positioned, pilotWp.id);
pilotWp.tree = {
"latitude": pilotWp.wpGhost.wp_lat,
"longitude": pilotWp.wpGhost.wp_lon,
"ident": pilotWp.id,
};
return pilotWp;
},
newAtPosition: func(positioned, typeStr, position) {
var pilotWp = { parents:[pilotWaypoint] };
pilotWp.setId(typeStr ~ sprintf("%s", position));
pilotWp.index = position - 1;
# set ghost to created waypoint
pilotWp.wpGhost = positioned;
pilotWp.tree = {
"latitude": pilotWp.wpGhost.wp_lat,
"longitude": pilotWp.wpGhost.wp_lon,
"ident": pilotWp.id,
};
return pilotWp;
},
setId: func(id) {
if (typeof(id) == "scalar") { me.id = id; }
},
getId: func() {
if (me.id != nil) { return id; }
},
};
setlistener("/MCDU[0]/page", func() {
if (getprop("/MCDU[0]/page") != "PILOTWP" and getprop("/MCDU[0]/page") != "STATUS") {
WaypointDatabase.confirm[0] = 0;
}
}, 0, 0);
setlistener("/MCDU[1]/page", func() {
if (getprop("/MCDU[1]/page") != "PILOTWP" and getprop("/MCDU[1]/page") != "STATUS") {
WaypointDatabase.confirm[1] = 0;
}
}, 0, 0);

View file

@ -11,7 +11,7 @@ var courseDistanceFromPrev = nil;
var sizeWP = nil;
var magTrueError = 0;
var DEBUG_DISCONT = 1;
var DEBUG_DISCONT = 0;
# Props.getNode
var magHDG = props.globals.getNode("/orientation/heading-magnetic-deg", 1);
@ -56,6 +56,14 @@ var flightPlanController = {
_timeTemp: nil,
_altTemp: nil,
init: func() {
me.resetFlightplan(2);
me.insertPPOS(2);
me.addDiscontinuity(1, 2, 1);
me.currentToWptIndex.setValue(0);
me.flightPlanChanged(2);
},
reset: func() {
me.temporaryFlag[0] = 0;
me.temporaryFlag[1] = 0;
@ -93,7 +101,7 @@ var flightPlanController = {
print("Load failed.");
}
# try to fix fgfp
me.flightplans[3].destination = airportinfo(getprop("FMGC/internal/arr-arpt"));
me.flightplans[3].destination = airportinfo(getprop("/FMGC/internal/arr-arpt"));
me.destroyTemporaryFlightPlan(3, 1);
},
@ -135,7 +143,7 @@ var flightPlanController = {
me.flightPlanChanged(plan);
},
autoSequencing: func() {
calculateTimeAltitudeOnSequence: func() {
me._timeTemp = math.round(getprop("/sim/time/utc/minute") + (getprop("/sim/time/utc/second") / 60));
if (me._timeTemp < 10) {
me._timeTemp = "0" ~ me._timeTemp;
@ -143,7 +151,7 @@ var flightPlanController = {
me.fromWptTime = getprop("/sim/time/utc/hour") ~ me._timeTemp;
me._altTemp = getprop("/systems/navigation/adr/output/baro-alt-corrected-1-capt");
if (me._altTemp > getprop("FMGC/internal/trans-alt")) {
if (me._altTemp > fmgc.FMGCInternal.transAlt) {
me.fromWptAlt = "FL" ~ math.round(me._altTemp / 100);
} else {
if (me._altTemp > 0) {
@ -152,6 +160,10 @@ var flightPlanController = {
me.fromWptAlt = "M" ~ math.round(me._altTemp);
}
}
},
autoSequencing: func() {
me.calculateTimeAltitudeOnSequence();
# todo setlistener on sim/time/warp to recompute predictions
@ -179,7 +191,7 @@ var flightPlanController = {
me.deleteWP(0, 2, 0, 1);
} else {
me.wptType = me.flightplans[2].getWP(me.currentToWptIndexTemp).wp_type;
me.wptTypeNoAdvanceDelete = me.wptType == "radialIntercept" or me.wptType == "vectors" or me.wptType == "hdgToAlt";
me.wptTypeNoAdvanceDelete = me.wptType == "radialIntercept" or me.wptType == "vectors" or me.wptType == "dmeIntercept" or me.wptType == "hdgToAlt";
if (me.wptTypeNoAdvanceDelete) {
me.currentToWptIndex.setValue(2);
} else {
@ -197,8 +209,18 @@ var flightPlanController = {
# for these two remember to call flightPlanChanged. We are assuming this is called from a function which will all flightPlanChanged itself.
addDiscontinuity: func(index, plan) {
# addDiscontinuity - insert discontinuity at passed index
# args: index, plan
# index: index to add at
# plan: plan to add to
# Check if a discontinuity already exists either immediately before or at that index
# If it does, don't add another one
# Optional flag DEBUG_DISCONT to disable discontinuities totally
addDiscontinuity: func(index, plan, force = 0) {
if (DEBUG_DISCONT) { return; }
if (force) {
me.flightplans[plan].insertWP(createDiscontinuity(), index);
}
if (index > 0) {
if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index - 1).wp_name != "DISCONTINUITY") {
me.flightplans[plan].insertWP(createDiscontinuity(), index);
@ -220,6 +242,10 @@ var flightPlanController = {
me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "T-P"), index);
},
insertPPOS: func(n, index = 0) {
me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "PPOS"), index);
},
# childWPBearingDistance - return waypoint at bearing and distance from specified waypoint ghost
# args: wpt, bearing, dist, name, typeStr
# wpt: waypoint ghost
@ -228,13 +254,9 @@ var flightPlanController = {
# name: name of waypoint to be created
# typeStr: optional argument to be passed to createWP, must be one of "sid", "star" "approach" "missed" or "pseudo"
childWPBearingDistance: func(wpt, bearing, dist, name, typeStr = "") {
childWPBearingDistance: func(wpt, bearing, dist) {
var coordinates = greatCircleMove(wpt.lat, wpt.lon, num(bearing), num(dist));
if (typeStr != "") {
return createWP(coordinates, name, typeStr);
} else {
return createWP(coordinates, name);
}
return coordinates;
},
# insertNOSID - create default SID and add to flightplan
@ -250,7 +272,7 @@ var flightPlanController = {
}
# fudge the altitude since we cannot create a hdgtoAlt from nasal. Assume 600 feet per mile - 2.5 miles
me.flightplans[n].insertWP(me.childWPBearingDistance(wptStore, me.flightplans[n].departure_runway.heading, 2.5, "1500", "sid"), 1);
me.flightplans[n].insertWP(createWP(me.childWPBearingDistance(wptStore, me.flightplans[n].departure_runway.heading, 2.5), "1500", "sid"), 1);
}
me.flightPlanChanged(n);
},
@ -270,7 +292,7 @@ var flightPlanController = {
if (hdg > 360) {
hdg = hdg - 360;
}
me.flightplans[n].insertWP(me.childWPBearingDistance(wptStore, hdg, 5, "CF", "star"), me.arrivalIndex[n]);
me.flightplans[n].insertWP(createWP(me.childWPBearingDistance(wptStore, hdg, 5), "CF", "star"), me.arrivalIndex[n]);
}
me.flightPlanChanged(n);
},
@ -289,7 +311,10 @@ var flightPlanController = {
directTo: func(waypointGhost, plan) {
if (me.flightplans[plan].indexOfWP(waypointGhost) == -1) {
me.insertTP(plan, 1);
me.flightplans[plan].insertWP(createWPFrom(waypointGhost), 2);
# use createWP here as createWPFrom doesn't accept waypoints
# createWPFrom worked before... but be sure!
me.flightplans[plan].insertWP(createWP(waypointGhost, waypointGhost.wp_name), 2);
me.addDiscontinuity(3, plan);
} else {
# we want to delete the intermediate waypoints up to but not including the waypoint. Leave index 0, we delete it later.
@ -306,9 +331,9 @@ var flightPlanController = {
me.insertTP(plan, 1);
}
me.deleteWP(0, plan);
me.flightPlanChanged(plan);
var curAircraftPosDirTo = geo.aircraft_position();
canvas_mcdu.myDirTo[plan].updateDist(me.flightplans[plan].getWP(1).courseAndDistanceFrom(curAircraftPosDirTo)[1]);
me.flightPlanChanged(plan);
},
deleteWP: func(index, n, a = 0, s = 0) { # a = 1, means adding a waypoint via deleting intermediate. s = 1, means autosequencing
@ -332,6 +357,18 @@ var flightPlanController = {
}
},
# deleteTillIndex - helper that deletes waypoints up to a passed waypoint already in flightplan
# uses a while loop to delete a certain number of waypoints between passed index and
# index of waypoint alredy in flightplan
deleteTillIndex: func(wpGhost, index, plan) {
var numToDel = me.flightplans[plan].indexOfWP(wpGhost) - index;
while (numToDel > 0) {
me.deleteWP(index, plan, 1);
numToDel -= 1;
}
return 2;
},
# createDuplicateNames - helper to spawn DUPLICATENAMES page
# args: ghostContainer, index, flag, plan
# ghostContainer: vector of fgPositioned ghosts
@ -360,34 +397,21 @@ var flightPlanController = {
}
if (size(airport) == 1 or override) {
if (!override) {
if (me.flightplans[plan].indexOfWP(airport[0]) == -1) {
me.flightplans[plan].insertWP(createWPFrom(airport[0]), index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
} else {
var numToDel = me.flightplans[plan].indexOfWP(airport[0]) - index;
while (numToDel > 0) {
me.deleteWP(index, plan, 1);
numToDel -= 1;
}
return 2;
}
var indexToInsert = -1;
if (override) {
indexToInsert = overrideIndex;
} else {
if (me.flightplans[plan].indexOfWP(airport[overrideIndex]) == -1) {
me.flightplans[plan].insertWP(createWPFrom(airport[overrideIndex]), index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
} else {
var numToDel = me.flightplans[plan].indexOfWP(airport[overrideIndex]) - index;
while (numToDel > 0) {
me.deleteWP(index, plan, 1);
numToDel -= 1;
}
return 2;
}
indexToInsert = 0;
}
var indexPresent = me.flightplans[plan].indexOfWP(airport[indexToInsert]);
if (me.flightplans[plan].indexOfWP(airport[indexToInsert]) == -1) {
me.flightplans[plan].insertWP(createWPFrom(airport[indexToInsert]), index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
} else {
return me.deleteTillIndex(airport[indexToInsert], index, plan);
}
} elsif (size(airport) >= 1) {
me.createDuplicateNames(airport, index, 0, plan);
@ -395,7 +419,7 @@ var flightPlanController = {
}
},
insertFix: func(text, index, plan, override = 0, overrideIndex = -1) { # override - means always choose [0]
insertFix: func(text, index, plan, override = 0, overrideIndex = -1) {
if (index == 0) {
return 1;
}
@ -406,34 +430,21 @@ var flightPlanController = {
}
if (size(fix) == 1 or override) {
if (!override) {
if (me.flightplans[plan].indexOfWP(fix[0]) == -1) {
me.flightplans[plan].insertWP(createWPFrom(fix[0]), index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
} else {
var numToDel = me.flightplans[plan].indexOfWP(fix[0]) - index;
while (numToDel > 0) {
me.deleteWP(index, plan, 1);
numToDel -= 1;
}
return 2;
}
var indexToInsert = -1;
if (override) {
indexToInsert = overrideIndex;
} else {
if (me.flightplans[plan].indexOfWP(fix[overrideIndex]) == -1) {
me.flightplans[plan].insertWP(createWPFrom(fix[overrideIndex]), index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
} else {
var numToDel = me.flightplans[plan].indexOfWP(fix[overrideIndex]) - index;
while (numToDel > 0) {
me.deleteWP(index, plan, 1);
numToDel -= 1;
}
return 2;
}
indexToInsert = 0;
}
var indexPresent = me.flightplans[plan].indexOfWP(fix[indexToInsert]);
if (me.flightplans[plan].indexOfWP(fix[indexToInsert]) == -1) {
me.flightplans[plan].insertWP(createWPFrom(fix[indexToInsert]), index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
} else {
return me.deleteTillIndex(fix[indexToInsert], index, plan);
}
} elsif (size(fix) >= 1) {
me.createDuplicateNames(fix, index, 0, plan);
@ -441,6 +452,55 @@ var flightPlanController = {
}
},
insertNavaid: func(text, index, plan, override = 0, overrideIndex = -1) {
if (index == 0) {
return 1;
}
var navaid = findNavaidsByID(text);
if (size(navaid) == 0) {
return 0;
}
if (size(navaid) == 1 or override) {
var indexToInsert = -1;
if (override) {
indexToInsert = overrideIndex;
} else {
indexToInsert = 0;
}
var indexPresent = me.flightplans[plan].indexOfWP(navaid[indexToInsert]);
if (me.flightplans[plan].indexOfWP(navaid[indexToInsert]) == -1) {
me.flightplans[plan].insertWP(createWPFrom(navaid[indexToInsert]), index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
} else {
return me.deleteTillIndex(navaid[indexToInsert], index, plan);
}
} elsif (size(navaid) >= 1) {
me.createDuplicateNames(navaid, index, 1, plan);
return 2;
}
},
insertDBWP: func(wpGhost, index, plan) {
if (index == 0 or wpGhost == nil) {
return 1;
}
if (me.flightplans[plan].indexOfWP(wpGhost) == -1) {
# use createWP here as createWPFrom doesn't accept waypoints
me.flightplans[plan].insertWP(createWP(wpGhost, wpGhost.wp_name), index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
} else {
return me.deleteTillIndex(wpGhost, index, plan);
}
},
insertLatLonFix: func(text, index, plan) {
if (index == 0) {
return 1;
@ -455,66 +515,16 @@ var flightPlanController = {
return 1;
}
var myWpLatLon = createWP(latDecimal, lonDecimal, "LL" ~ index);
if (me.flightplans[plan].indexOfWP(myWpLatLon) == -1) {
me.flightplans[plan].insertWP(myWpLatLon, index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
} else {
var numToDel = me.flightplans[plan].indexOfWP(myWpLatLon) - index;
while (numToDel > 0) {
me.deleteWP(index, plan, 1);
numToDel -= 1;
}
return 2;
}
},
insertNavaid: func(text, index, plan, override = 0, overrideIndex = -1) {
if (index == 0) {
return 1;
var waypoint = pilotWaypoint.new({lat: latDecimal, lon: lonDecimal}, "LL");
var addDb = WaypointDatabase.addWP(waypoint);
if (addDb != 2) {
return addDb;
}
var navaid = findNavaidsByID(text);
if (size(navaid) == 0) {
return 0;
}
if (size(navaid) == 1 or override) {
if (!override) {
if (me.flightplans[plan].indexOfWP(navaid[0]) == -1) {
me.flightplans[plan].insertWP(createWPFrom(navaid[0]), index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
} else {
var numToDel = me.flightplans[plan].indexOfWP(navaid[0]) - index;
while (numToDel > 0) {
me.deleteWP(index, plan, 1);
numToDel -= 1;
}
return 2;
}
} else {
if (me.flightplans[plan].indexOfWP(navaid[overrideIndex]) == -1) {
me.flightplans[plan].insertWP(createWPFrom(navaid[overrideIndex]), index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
} else {
var numToDel = me.flightplans[plan].indexOfWP(navaid[overrideIndex]) - index;
while (numToDel > 0) {
me.deleteWP(index, plan, 1);
numToDel -= 1;
}
return 2;
}
}
} elsif (size(navaid) >= 1) {
me.createDuplicateNames(navaid, index, 1, plan);
return 2;
}
me.flightplans[plan].insertWP(waypoint.wpGhost, index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
},
# getWPforPBD - parse scratchpad text to find waypoint ghost for PBD
@ -564,7 +574,7 @@ var flightPlanController = {
return 1;
}
if (size(wpGhostContainer) == 0 or override) {
if (size(wpGhostContainer) == 1 or override) {
if (!override) {
wpGhost = wpGhostContainer[0];
} else {
@ -580,8 +590,7 @@ var flightPlanController = {
}
var localMagvar = magvar(wpGhost.lat, wpGhost.lon);
me.insertPlaceBearingDistance(wpGhost, textSplit[1] + localMagvar, textSplit[2], index, plan);
return 2;
return me.insertPlaceBearingDistance(wpGhost, textSplit[1] + localMagvar, textSplit[2], index, plan); # magnetic to true? I don't know. But this works!
},
@ -593,12 +602,19 @@ var flightPlanController = {
# plan: plan to insert to
insertPlaceBearingDistance: func(wp, bearing, distance, index, plan) {
me.flightplans[plan].insertWP(me.childWPBearingDistance(wp, bearing, distance, "PBD" ~ index), index);
var waypoint = pilotWaypoint.new(me.childWPBearingDistance(wp, bearing, distance), "PBD");
var addDb = WaypointDatabase.addWP(waypoint);
if (addDb != 2) {
return addDb;
}
me.flightplans[plan].insertWP(waypoint.wpGhost, index);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
},
scratchpad: func(text, index, plan) { # return 0 not in database, 1 not allowed, 2 success, 3 = not allowed due to dir to
scratchpad: func(text, index, plan) { # return 0 not in database, 1 not allowed, 2 success, 3 = not allowed due to dir to, 4 = database full
if (mcdu.dirToFlag) {
return 3;
}
@ -614,6 +630,12 @@ var flightPlanController = {
var thePlan = plan;
}
# check waypoints database here
var wpFromDB = WaypointDatabase.getWP(text);
if (wpFromDB != nil) {
return me.insertDBWP(wpFromDB, index, thePlan);
}
if (size(split("/", text)) == 3) {
return me.getWPforPBD(text, index, thePlan);
} elsif (text == "CLR") {
@ -643,6 +665,11 @@ var flightPlanController = {
append(wpDistancePrev[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/distance-from-prev", 0, "DOUBLE"));
}
me.updatePlans();
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
canvas_nd.A3XXRouteDriver.triggerSignal("fp-added");
},

View file

@ -0,0 +1,134 @@
# A3XX FMGC MCDU Message Generator and Control
# Copyright (c) 2020 Josh Davidson (Octal450) and Jonathan Redpath (legoboyvdlp)
var TypeIMessage = {
new: func(msgText) {
var msg = { parents: [TypeIMessage] };
msg.msgText = msgText;
msg.colour = "w";
return msg;
},
};
var TypeIIMessage = {
new: func(msgText, colour, isInhibit: 0,) {
var msg = { parents: [TypeIIMessage] };
msg.msgText = msgText;
msg.colour = colour;
msg.inhibitable: isInhibit;
return msg;
},
};
var MessageQueueController = {
messages: std.Vector.new(), # show left to right
# first in first out
addNewMsg: func(msg) {
if (me.messages.size() < 5) {
if (!me.messages.contains(msg)) {
me.messages.append(x);
}
}
},
getNextMsg: func() {
if (me.messages.size() >= 1) {
me.messages.pop(0);
}
},
clearQueue: func() {
me.messages.clear();
},
};
var scratchpadController = {
scratchpad: "",
scratchpadSave: "",
scratchpadShowTypeIMsg: 0,
scratchpadShowTypeIIMsg: 0,
addCharToScratchpad: func(character) {
if (size(me.scratchpad) >= 22) {
return;
}
# any shown type ii is hidden
if (me.scratchpadShowTypeIIMsg) {
me.clearTypeIIMsg();
}
# any shown type i is hidden
if (me.scratchpadShowTypeIMsg) {
me.clearTypeIMsg();
}
me.scratchpad = me.scratchpad ~ character;
},
showTypeIMsg: func(msg) {
# any shown type ii is hidden
if (me.scratchpadShowTypeIIMsg) {
me.clearTypeIIMsg();
}
me.scratchpadShowTypeIMsg = 1;
# save any data entered
me.scratchpadSave = me.scratchpad;
me.scratchpad = msg;
},
showTypeIIMsg: func(msg) {
# only show if scratchpad empty
if (me.scratchpad = "") {
me.scratchpadShowTypeIIMsg = 1;
me.scratchpad = msg;
}
},
clearTypeIMsg: func() {
me.scratchpad = me.scratchpadSave;
me.scratchpadSave = nil;
me.scratchpadShowTypeIMsg = 0;
},
clearTypeIIMsg: func() {
me.scratchpadShowTypeIIMsg = 0;
me.empty();
},
empty: func() {
me.scratchpad = "";
},
clear: func() {
if (me.showTypeIMsg) {
me.clearTypeIMsg();
} elsif (!me.showTypeIIMsg) {
me.scratchpad = left(me.scratchpad, size(me.scratchpad) - 1);
} else {
me.clearTypeIIMsg();
}
},
};
var MessageController = {
typeIMessages: std.Vector.new([
TypeIMessage.new("AWY/WPT MISMATCH"),TypeIMessage.new("DEST/ALTN MISMATCH"),TypeIMessage.new("DIR TO IN PROGRESS"),
TypeIMessage.new("ENTRY OUT OF RANGE"),TypeIMessage.new("FORMAT ERROR"),TypeIMessage.new("INSERT/ERASE TMPY FIRST"),
TypeIMessage.new("LIST OF 20 IN USE"),TypeIMessage.new("PILOT ELEMENT RETAINED"),TypeIMessage.new("NOT ALLOWED"),
TypeIMessage.new("NOT IN DATA BASE"),TypeIMessage.new("ONLY SPD ENTRY ALLOWED"),TypeIMessage.new("PLEASE WAIT"),
TypeIMessage.new("REVISION IN PROGRESS"),TypeIMessage.new("TMPY F-PLN EXISTS"),TypeIMessage.new("SELECT DESIRED SYSTEM"),
TypeIMessage.new("SELECT HDG/TRK FIRST"),TypeIMessage.new("USING COST INDEX N"),
]),
typeIIMessages: std.Vector.new([
]),
getTypeIMsgByText: func(text) {
return me.getMsgByText(text, me.typeIMessages);
},
getTypeIIMsgByText: func(text) {
return me.getMsgByText(text, me.typeIIMessages);
},
getMsgByText: func(text, theVector) {
foreach (var message; theVector) {
if (message.msgText = text) {
return message;
}
}
return nil;
},
};

View file

@ -221,8 +221,9 @@ var systemsInit = func {
systems.ADIRS.init();
systems.eng_init();
systems.APUController.init();
systems.fire_init();
systems.autobrake_init();
systems.fire_init();
systems.icingInit();
fmgc.flightPlanController.reset();
fadec.FADEC.init();
fmgc.ITAF.init();
@ -230,9 +231,12 @@ var systemsInit = func {
mcdu.MCDU_init(0);
mcdu.MCDU_init(1);
systemsLoop.start();
<<<<<<< HEAD
effects.icingInit();
=======
>>>>>>> dev
lightsLoop.start();
libraries.ECAM.init();
ecam.ECAM.init();
libraries.variousReset();
rmp.init();
acp.init();
@ -240,11 +244,13 @@ var systemsInit = func {
atc.init();
fcu.FCUController.init();
dmc.DMController.init();
fmgc.flightPlanController.init();
}
setlistener("/sim/signals/fdm-initialized", func {
systemsInit();
fmgc.flightPlanTimer.start();
fmgc.WaypointDatabase.read();
});
var systemsLoop = maketimer(0.1, func {
@ -253,7 +259,7 @@ var systemsLoop = maketimer(0.1, func {
systems.HYD.loop();
systems.FUEL.loop();
systems.ADIRS.loop();
libraries.ECAM.loop();
ecam.ECAM.loop();
libraries.BUTTONS.update();
fadec.FADEC.loop();
rmp.rmpUpdate();

View file

@ -80,9 +80,11 @@ var arrivalPage = {
}
if (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
me.selectedSTAR = fmgc.flightPlanController.flightplans[me.computer].star;
me.selectedTransition = fmgc.flightPlanController.flightplans[me.computer].star_trans;
isNoStar[me.computer] = 0;
} elsif (fmgc.flightPlanController.flightplans[2].star != nil) {
me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star;
me.selectedTransition = fmgc.flightPlanController.flightplans[2].star_trans;
isNoStar[me.computer] = 0;
} elsif (isNoStar[me.computer] == 1) {
me.selectedSTAR = "NO STAR";

View file

@ -87,12 +87,13 @@ var closestAirportPage = {
me.cdVector[1] = courseAndDistance(me.airports[1]);
me.cdVector[2] = courseAndDistance(me.airports[2]);
me.cdVector[3] = courseAndDistance(me.airports[3]);
me.C1 = [math.round(me.cdVector[0][0]) ~ " " ~ math.round(me.cdVector[0][1]), " BRG DIST", "grn"];
me.C2 = [math.round(me.cdVector[1][0]) ~ " " ~ math.round(me.cdVector[1][1]), nil, "grn"];
me.C3 = [math.round(me.cdVector[2][0]) ~ " " ~ math.round(me.cdVector[2][1]), nil, "grn"];
me.C4 = [math.round(me.cdVector[3][0]) ~ " " ~ math.round(me.cdVector[3][1]), nil, "grn"];
var magvarLocal = magvar();
me.C1 = [math.round(me.cdVector[0][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[0][1]), " BRG DIST", "grn"];
me.C2 = [math.round(me.cdVector[1][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[1][1]) , nil, "grn"];
me.C3 = [math.round(me.cdVector[2][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[2][1]), nil, "grn"];
me.C4 = [math.round(me.cdVector[3][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[3][1]), nil, "grn"];
if (me.manAirport != nil) {
me.C5 = [math.round(courseAndDistance(me.manAirport)[0]) ~ " " ~ math.round(courseAndDistance(me.manAirport)[1]), nil, "grn"];
me.C5 = [math.round(courseAndDistance(me.manAirport)[0] - magvarLocal) ~ " " ~ math.round(courseAndDistance(me.manAirport)[1]), nil, "grn"];
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},

View file

@ -77,9 +77,11 @@ var departurePage = {
}
if (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
me.selectedSID = fmgc.flightPlanController.flightplans[me.computer].sid;
me.selectedTransition = fmgc.flightPlanController.flightplans[me.computer].sid_trans;
isNoSid[me.computer] = 0;
} elsif (fmgc.flightPlanController.flightplans[2].sid != nil) {
me.selectedSID = fmgc.flightPlanController.flightplans[2].sid;
me.selectedTransition = fmgc.flightPlanController.flightplans[2].sid_trans;
isNoSid[me.computer] = 0;
} elsif (isNoSid[me.computer] == 1) {
me.selectedSID = "NO SID";
@ -196,7 +198,7 @@ var departurePage = {
me.R1 = ["-------", "TRANS ", "wht"];
}
} elsif (fmgc.flightPlanController.flightplans[me.computer].sid_trans != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid_trans.id, "SID", "yel"];
me.R1 = [fmgc.flightPlanController.flightplans[me.computer].sid_trans.id, "SID", "yel"];
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
@ -558,7 +560,7 @@ var departurePage = {
if (!dirToFlag) {
me.selectedTransition = me.transitions[index - 2];
me.makeTmpy();
fmgc.flightPlanController.flightplans[me.computer].sid = me.depAirport[0].getSid(me.selectedSID).transition(me.selectedTransition);
fmgc.flightPlanController.flightplans[me.computer].sid_trans = me.depAirport[0].getSid(me.selectedSID).transition(me.selectedTransition);
me.updateActiveTransitions();
me.updateTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer);

View file

@ -16,12 +16,12 @@ var fplnItem = {
} elsif (me.wp.wp_name != "DISCONTINUITY") {
var wptName = split("-", me.wp.wp_name);
if (wptName[0] == "VECTORS") {
return ["MANUAL", nil, me.colour];
return ["MANUAL", me.getSubText(), me.colour];
} else {
if (size(wptName) == 2) {
return[wptName[0] ~ wptName[1], nil, me.colour];
return[wptName[0] ~ wptName[1], me.getSubText(), me.colour];
} else {
return [me.wp.wp_name, nil, me.colour];
return [me.wp.wp_name, me.getSubText(), me.colour];
}
}
} else {
@ -31,6 +31,9 @@ var fplnItem = {
return ["problem", nil, "ack"];
}
},
getSubText: func() {
return nil;
},
updateCenterText: func() {
if (me.wp != nil) {
if (me.wp.wp_name != "DISCONTINUITY") {
@ -388,6 +391,11 @@ var fplnPage = { # this one is only created once, and then updated - remember th
if (index == 6) {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
} else {
if (canvas_mcdu.myLatRev[me.computer] != nil) {
canvas_mcdu.myLatRev[me.computer].del();
@ -407,6 +415,8 @@ var fplnPage = { # this one is only created once, and then updated - remember th
notInDataBase(me.computer);
} elsif (returny == 1) {
notAllowed(me.computer);
} elsif (returny == 4) {
databaseFull(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", "");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "");
@ -424,6 +434,11 @@ var fplnPage = { # this one is only created once, and then updated - remember th
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (dirToFlag) { dirToFlag = 0; }
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
} else {
notAllowed(me.computer);
}
@ -442,15 +457,25 @@ var fplnPage = { # this one is only created once, and then updated - remember th
};
var notInDataBase = func(i) {
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "NOT IN DATABASE");
} else {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
}
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "NOT IN DATABASE");
} else {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "NOT IN DATABASE");
}
var databaseFull = func(i) {
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "LIST OF 20 IN USE");
} else {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "LIST OF 20 IN USE");
}
var decimalToShortString = func(dms, type) {
var degrees = split(".", sprintf(dms))[0];
if (type == "lat") {

View file

@ -22,6 +22,7 @@ var min_dest_fob = props.globals.getNode("FMGC/internal/min-dest-fob", 1);
var tow = props.globals.getNode("FMGC/internal/tow", 1);
var lw = props.globals.getNode("FMGC/internal/lw", 1);
var trip_wind = props.globals.getNode("FMGC/internal/trip-wind", 1);
var trip_wind_value = props.globals.getNode("FMGC/internal/trip-wind", 1);
var fob = props.globals.getNode("FMGC/internal/fob", 1);
var fffq_sensor = props.globals.getNode("FMGC/internal/fffq-sensor", 1);
var extra_fuel = props.globals.getNode("FMGC/internal/extra-fuel", 1);
@ -29,62 +30,79 @@ var extra_time = props.globals.getNode("FMGC/internal/extra-time", 1);
var fuelPredInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L3" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", 5.0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
} else if (getprop("FMGC/internal/trip-fuel") != 0) {
setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-percent", 5.0);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
mcdu.clearScratchpad(i);
} else if (getprop("/FMGC/internal/trip-fuel") != 0) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) {
var perc = num(split("/", scratchpad)[1]);
if (perc != nil and perc >= 0.0 and perc <= 15.0) {
setprop("FMGC/internal/rte-rsv", num(perc) / 100 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", perc);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-percent", perc);
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
}
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7 and tf / num(trip_fuel.getValue()) <= 0.15) {
setprop("FMGC/internal/rte-rsv", scratchpad);
setprop("FMGC/internal/rte-percent", scratchpad / num(trip_fuel.getValue()) * 100);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) {
setprop("/FMGC/internal/rte-rsv", scratchpad);
if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) {
setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100);
} else {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value
}
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
} else {
notAllowed(i);
}
} else if (key == "L4" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and getprop("/FMGC/internal/alt-set")) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/alt-fuel", 0.0);
setprop("FMGC/internal/alt-time", "0000");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
mcdu.clearScratchpad(i);
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + alt_fuel.getValue()) {
setprop("FMGC/internal/alt-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/alt-fuel", tf);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
} else {
notAllowed(i);
}
} else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/final-fuel", 0.0);
setprop("/FMGC/internal/final-time", "0030");
setprop("/FMGC/internal/final-fuel-set", 0);
setprop("/FMGC/internal/final-time-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
mcdu.clearScratchpad(i);
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/final-fuel", tf);
setprop("/FMGC/internal/final-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -92,57 +110,47 @@ var fuelPredInput = func(key, i) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) {
setprop("FMGC/internal/alt-time", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/final-time", scratchpad);
setprop("/FMGC/internal/final-time-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
}
} else if (key == "L5" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
} else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/final-fuel", 0.0);
setprop("FMGC/internal/final-time", "0030");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
setprop("/FMGC/internal/min-dest-fob", 0);
setprop("/FMGC/internal/min-dest-fob-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
mcdu.clearScratchpad(i);
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + final_fuel.getValue()) {
setprop("FMGC/internal/final-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
if (tfs >= 3 and tfs <= 5 and tf != nil and tf >= 0 and tf <= 80.0) {
setprop("/FMGC/internal/min-dest-fob", tf);
setprop("/FMGC/internal/min-dest-fob-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
if (num(getprop("/FMGC/internal/min-dest-fob")) < num(getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/alt-fuel"))) {
genericMessage(i, "CHECK MIN DEST FOB", "wht");
}
} else {
notAllowed(i);
}
} else {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) {
setprop("FMGC/internal/final-time", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
notAllowed(i);
}
} else if (key == "R3") {
} else if (key == "R3" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
notAllowed(i);
} else {
var tfs = size(scratchpad);
if (tfs == 0) {
var zfw = getprop("fdm/jsbsim/inertia/weight-lbs") - getprop("consumables/fuel/total-fuel-lbs");
setprop("MCDU[" ~ i ~ "]/scratchpad", "/" ~ sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
setprop("/FMGC/internal/zfw-set", 1);
} else if (tfs >= 2 and tfs <= 11 and find("/", scratchpad) != -1) {
var zfwi = split("/", scratchpad);
var zfwcg = num(zfwi[0]);
@ -150,36 +158,51 @@ var fuelPredInput = func(key, i) {
var zfwcgs = size(zfwi[0]);
var zfws = size(zfwi[1]);
if (zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) {
setprop("FMGC/internal/zfwcg", zfwcg);
setprop("FMGC/internal/zfwcg-set", 1);
if (getprop("FMGC/internal/block-set") != 1) {
setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("FMGC/internal/block-set", 1);
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
}
}
if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) {
setprop("FMGC/internal/zfw", zfw);
setprop("FMGC/internal/zfw-set", 1);
if (getprop("FMGC/internal/block-set") != 1) {
setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("FMGC/internal/block-set", 1);
setprop("/FMGC/internal/zfw", zfw);
setprop("/FMGC/internal/zfw-set", 1);
if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
}
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) {
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
} else if (tfs >= 1 and tfs <= 5) {
var zfwcg = size(scratchpad);
if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) {
setprop("FMGC/internal/zfwcg", scratchpad);
setprop("FMGC/internal/zfwcg-set", 1);
if (getprop("FMGC/internal/block-set") != 1) {
setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("FMGC/internal/block-set", 1);
setprop("/FMGC/internal/zfwcg", scratchpad);
setprop("/FMGC/internal/zfwcg-set", 1);
if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
}
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -189,14 +212,14 @@ var fuelPredInput = func(key, i) {
}
} else if (key == "R4") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/fffq-sensor", "FF+FQ");
setprop("/FMGC/internal/fffq-sensor", "FF+FQ");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else if (find("/", scratchpad) == 0) {
var sensor = substr(scratchpad, 1);
if (sensor == "FF+FQ" or sensor == "FQ+FF" or sensor == "FF" or sensor == "FQ") {
setprop("FMGC/internal/fffq-sensor", sensor);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}

View file

@ -7,22 +7,30 @@ var initInputA = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L2") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/alt-airport", "");
setprop("FMGC/internal/alt-set", 0);
setprop("/FMGC/internal/alt-airport", "");
setprop("/FMGC/internal/alt-set", 0);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
fmgc.updateARPT();
#} else if (scratchpad == "") {
#setprop("FMGC/internal/alt-selected", 1);
#setprop("/FMGC/internal/alt-selected", 1);
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else if (getprop("FMGC/internal/tofrom-set") == 1) {
} else if (getprop("/FMGC/internal/tofrom-set") == 1) {
var tfs = size(scratchpad);
if (tfs == 4) {
setprop("FMGC/internal/alt-airport", scratchpad);
setprop("FMGC/internal/alt-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/alt-airport", scratchpad);
setprop("/FMGC/internal/alt-set", 1);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
mcdu.clearScratchpad(i);
fmgc.updateARPT();
#setprop("FMGC/internal/alt-selected", 1);
#setprop("/FMGC/internal/alt-selected", 1);
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else {
notAllowed(i);
@ -35,31 +43,31 @@ var initInputA = func(key, i) {
setprop("MCDUC/flight-num", "");
setprop("MCDUC/flight-num-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var flts = size(scratchpad);
if (flts >= 1 and flts <= 8) {
setprop("MCDUC/flight-num", scratchpad);
setprop("MCDUC/flight-num-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
}
} else if (key == "L5") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/cost-index", 0);
setprop("FMGC/internal/cost-index-set", 0);
setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (ci != nil and ci >= 0 and ci <= 999) {
setprop("FMGC/internal/cost-index", ci);
setprop("FMGC/internal/cost-index-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -69,13 +77,17 @@ var initInputA = func(key, i) {
}
} else if (key == "L6") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/cruise-ft", 10000);
setprop("FMGC/internal/cruise-fl", 100);
setprop("FMGC/internal/cruise-lvl-set", 0);
setprop("FMGC/internal/cruise-temp", 15);
setprop("FMGC/internal/cruise-temp-set", 0);
setprop("/FMGC/internal/cruise-ft", 10000);
setprop("/FMGC/internal/cruise-fl", 100);
setprop("/FMGC/internal/cruise-lvl-set", 0);
setprop("/FMGC/internal/cruise-temp", 15);
setprop("/FMGC/internal/cruise-temp-set", 0);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else if (find("/", scratchpad) != -1) {
var crztemp = split("/", scratchpad);
if (find("FL", crztemp[0]) != -1) {
@ -87,22 +99,30 @@ var initInputA = func(key, i) {
}
var temp = int(crztemp[1]);
var temps = size(crztemp[1]);
if (crzs == 0 and temps >= 1 and temps <= 3 and temp != nil and getprop("FMGC/internal/cruise-lvl-set")) {
if (crzs == 0 and temps >= 1 and temps <= 3 and temp != nil and getprop("/FMGC/internal/cruise-lvl-set")) {
if (temp >= -99 and temp <= 99) {
setprop("FMGC/internal/cruise-temp", temp);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/cruise-temp", temp);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
} else if (crzs >= 1 and crzs <= 3 and crz != nil and temps >= 1 and temps <= 3 and temp != nil) {
if (crz > 0 and crz <= 390 and temp >= -99 and temp <= 99) {
setprop("FMGC/internal/cruise-ft", crz * 100);
setprop("FMGC/internal/cruise-fl", crz);
setprop("FMGC/internal/cruise-fl-prog", crz);
setprop("FMGC/internal/cruise-lvl-set", 1);
setprop("FMGC/internal/cruise-temp", temp);
setprop("FMGC/internal/cruise-temp-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/cruise-ft", crz * 100);
setprop("/FMGC/internal/cruise-fl", crz);
setprop("/FMGC/internal/cruise-fl-prog", crz);
setprop("/FMGC/internal/cruise-lvl-set", 1);
setprop("/FMGC/internal/cruise-temp", temp);
setprop("/FMGC/internal/cruise-temp-set", 1);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -119,11 +139,15 @@ var initInputA = func(key, i) {
}
if (crzs >= 1 and crzs <= 3 and crz != nil) {
if (crz > 0 and crz <= 390) {
setprop("FMGC/internal/cruise-ft", crz * 100);
setprop("FMGC/internal/cruise-fl", crz);
setprop("FMGC/internal/cruise-fl-prog", crz);
setprop("FMGC/internal/cruise-lvl-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/cruise-ft", crz * 100);
setprop("/FMGC/internal/cruise-fl", crz);
setprop("/FMGC/internal/cruise-fl-prog", crz);
setprop("/FMGC/internal/cruise-lvl-set", 1);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -133,18 +157,23 @@ var initInputA = func(key, i) {
}
} else if (key == "R1") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/dep-arpt", "");
setprop("FMGC/internal/arr-arpt", "");
setprop("FMGC/internal/tofrom-set", 0);
setprop("FMGC/internal/align-ref-lat", 0);
setprop("FMGC/internal/align-ref-long", 0);
setprop("FMGC/internal/align-ref-lat-edit", 0);
setprop("FMGC/internal/align-ref-long-edit", 0);
fmgc.flightPlanController.reset();
setprop("/FMGC/internal/dep-arpt", "");
setprop("/FMGC/internal/arr-arpt", "");
setprop("/FMGC/internal/tofrom-set", 0);
setprop("/FMGC/internal/align-ref-lat", 0);
setprop("/FMGC/internal/align-ref-long", 0);
setprop("/FMGC/internal/align-ref-lat-edit", 0);
setprop("/FMGC/internal/align-ref-long-edit", 0);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
fmgc.flightPlanController.reset(2);
fmgc.flightPlanController.init();
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
#} else if (scratchpad == "") {
#setprop("FMGC/internal/alt-selected", 0);
#setprop("/FMGC/internal/alt-selected", 0);
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else {
var tfs = size(scratchpad);
@ -154,32 +183,32 @@ var initInputA = func(key, i) {
var tos = size(fromto[1]);
if (froms == 4 and tos == 4) {
#route
setprop("FMGC/internal/dep-arpt", fromto[0]);
setprop("FMGC/internal/arr-arpt", fromto[1]);
setprop("FMGC/internal/tofrom-set", 1);
setprop("/FMGC/internal/dep-arpt", fromto[0]);
setprop("/FMGC/internal/arr-arpt", fromto[1]);
setprop("/FMGC/internal/tofrom-set", 1);
#scratchpad
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2);
setprop("FMGC/internal/alt-selected", 0);
setprop("/FMGC/internal/alt-selected", 0);
#ref lat
dms = getprop("FMGC/flightplan[2]/wp[0]/lat");
dms = getprop("/FMGC/flightplan[2]/wp[0]/lat");
degrees = int(dms);
minutes = sprintf("%.1f",abs((dms - degrees) * 60));
sign = degrees >= 0 ? "N" : "S";
setprop("FMGC/internal/align-ref-lat-degrees", degrees);
setprop("FMGC/internal/align-ref-lat-minutes", minutes);
setprop("FMGC/internal/align-ref-lat-sign", sign);
setprop("/FMGC/internal/align-ref-lat-degrees", degrees);
setprop("/FMGC/internal/align-ref-lat-minutes", minutes);
setprop("/FMGC/internal/align-ref-lat-sign", sign);
#ref long
dms = getprop("FMGC/flightplan[2]/wp[0]/lon");
dms = getprop("/FMGC/flightplan[2]/wp[0]/lon");
degrees = int(dms);
minutes = sprintf("%.1f",abs((dms - degrees) * 60));
sign = degrees >= 0 ? "E" : "W";
setprop("FMGC/internal/align-ref-long-degrees", degrees);
setprop("FMGC/internal/align-ref-long-minutes", minutes);
setprop("FMGC/internal/align-ref-long-sign", sign);
setprop("/FMGC/internal/align-ref-long-degrees", degrees);
setprop("/FMGC/internal/align-ref-long-minutes", minutes);
setprop("/FMGC/internal/align-ref-long-sign", sign);
#ref edit
setprop("FMGC/internal/align-ref-lat-edit", 0);
setprop("FMGC/internal/align-ref-long-edit", 0);
setprop("/FMGC/internal/align-ref-lat-edit", 0);
setprop("/FMGC/internal/align-ref-long-edit", 0);
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else {
notAllowed(i);
@ -192,29 +221,29 @@ var initInputA = func(key, i) {
setprop("MCDU[" ~ i ~ "]/page", "IRSINIT");
} else if (key == "R5") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/tropo", 36090);
setprop("FMGC/internal/tropo-set", 0);
setprop("/FMGC/internal/tropo", 36090);
setprop("/FMGC/internal/tropo-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tropo = size(scratchpad);
if (tropo == 5 and scratchpad <= 99990) {
setprop("FMGC/internal/tropo-set", 1);
setprop("FMGC/internal/tropo", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
}
} else if (key == "R6") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/gndtemp-set", 0);
setprop("/FMGC/internal/gndtemp-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (int(scratchpad) != nil and getprop("FMGC/status/phase") == 0 and size(scratchpad) >= 1 and size(scratchpad) <= 3 and scratchpad >= -99 and scratchpad <= 99) {
setprop("FMGC/internal/gndtemp", scratchpad);
setprop("FMGC/internal/gndtemp-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil and getprop("/FMGC/status/phase") == 0 and size(scratchpad) >= 1 and size(scratchpad) <= 3 and scratchpad >= -99 and scratchpad <= 99) {
setprop("/FMGC/internal/gndtemp", scratchpad);
setprop("/FMGC/internal/gndtemp-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}

View file

@ -2,47 +2,28 @@
# Copyright (c) 2020 Matthew Maring (mattmaring)
var zfwcg = props.globals.getNode("FMGC/internal/zfwcg", 1);
var zfwcgSet = props.globals.getNode("FMGC/internal/zfwcg-set", 1);
var zfw = props.globals.getNode("FMGC/internal/zfw", 1);
var zfwSet = props.globals.getNode("FMGC/internal/zfw-set", 1);
var block = props.globals.getNode("FMGC/internal/block", 1);
var blockSet = props.globals.getNode("FMGC/internal/block-set", 1);
var taxi_fuel = props.globals.getNode("FMGC/internal/taxi-fuel", 1);
var trip_fuel = props.globals.getNode("FMGC/internal/trip-fuel", 1);
var trip_time = props.globals.getNode("FMGC/internal/trip-time", 1);
var rte_rsv = props.globals.getNode("FMGC/internal/rte-rsv", 1);
var rte_percent = props.globals.getNode("FMGC/internal/rte-percent", 1);
var alt_fuel = props.globals.getNode("FMGC/internal/alt-fuel", 1);
var alt_time = props.globals.getNode("FMGC/internal/alt-time", 1);
var final_fuel = props.globals.getNode("FMGC/internal/final-fuel", 1);
var final_time = props.globals.getNode("FMGC/internal/final-time", 1);
var min_dest_fob = props.globals.getNode("FMGC/internal/min-dest-fob", 1);
var tow = props.globals.getNode("FMGC/internal/tow", 1);
var lw = props.globals.getNode("FMGC/internal/lw", 1);
var trip_wind = props.globals.getNode("FMGC/internal/trip-wind", 1);
var extra_fuel = props.globals.getNode("FMGC/internal/extra-fuel", 1);
var extra_time = props.globals.getNode("FMGC/internal/extra-time", 1);
var initInputB = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") {
var scratchpad = getprop("/MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/taxi-fuel", 0.4);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/taxi-fuel", 0.4);
setprop("/FMGC/internal/taxi-fuel-set", 0);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
} else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1);
}
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 4) {
if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 9.9) {
setprop("FMGC/internal/taxi-fuel", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
setprop("/FMGC/internal/taxi-fuel", scratchpad);
setprop("/FMGC/internal/taxi-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
fmgc.updateFuel();
} else {
notAllowed(i);
}
@ -50,87 +31,85 @@ var initInputB = func(key, i) {
notAllowed(i);
}
}
# }
# else if (key == "L2") {
# if (scratchpad == "CLR") {
# notAllowed(i);
# } else if (getprop("FMGC/internal/trip-fuel") != 0) {
# var tfs = size(scratchpad);
# if (tfs >= 1 and tfs <= 4) {
# var temp_rte = num(scratchpad * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100));
# if (scratchpad >= 0.0 and scratchpad <= block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - temp_rte) {
# setprop("FMGC/internal/trip-fuel", scratchpad);
# setprop("MCDU[" ~ i ~ "]/scratchpad", "");
#
# setprop("FMGC/internal/rte-rsv", temp_rte);
# setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
# setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
# } else {
# notAllowed(i);
# }
# } else {
# notAllowed(i);
# }
# } else {
# notAllowed(i);
# }
#
} else if (key == "L3" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
} else if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", 5.0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
} else if (getprop("FMGC/internal/trip-fuel") != 0) {
setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-rsv-set", 0);
setprop("/FMGC/internal/rte-percent", 5.0);
setprop("/FMGC/internal/rte-percent-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
mcdu.clearScratchpad(i);
} else if (getprop("/FMGC/internal/trip-fuel") != 0) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) {
var perc = num(split("/", scratchpad)[1]);
if (perc != nil and perc >= 0.0 and perc <= 15.0) {
setprop("FMGC/internal/rte-rsv", num(perc) / 100 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", perc);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-rsv-set", 0);
setprop("/FMGC/internal/rte-percent", perc);
setprop("/FMGC/internal/rte-percent-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
}
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7 and tf / num(trip_fuel.getValue()) <= 0.15) {
setprop("FMGC/internal/rte-rsv", scratchpad);
setprop("FMGC/internal/rte-percent", scratchpad / num(trip_fuel.getValue()) * 100);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) {
setprop("/FMGC/internal/rte-rsv", scratchpad);
setprop("/FMGC/internal/rte-rsv-set", 1);
if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) {
setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100);
} else {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value
}
setprop("/FMGC/internal/rte-percent-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
} else {
notAllowed(i);
}
} else if (key == "L4" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and getprop("/FMGC/internal/alt-set")) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/alt-fuel", 0.0);
setprop("FMGC/internal/alt-time", "0000");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
mcdu.clearScratchpad(i);
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + alt_fuel.getValue()) {
setprop("FMGC/internal/alt-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/alt-fuel", tf);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
} else {
notAllowed(i);
}
} else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/final-fuel", 0.0);
setprop("/FMGC/internal/final-time", "0030");
setprop("/FMGC/internal/final-fuel-set", 0);
setprop("/FMGC/internal/final-time-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
mcdu.clearScratchpad(i);
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/final-fuel", tf);
setprop("/FMGC/internal/final-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -138,57 +117,59 @@ var initInputB = func(key, i) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) {
setprop("FMGC/internal/alt-time", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/final-time", scratchpad);
setprop("/FMGC/internal/final-time-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
}
} else if (key == "L5" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
} else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/final-fuel", 0.0);
setprop("FMGC/internal/final-time", "0030");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
setprop("/FMGC/internal/min-dest-fob", 0);
setprop("/FMGC/internal/min-dest-fob-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
mcdu.clearScratchpad(i);
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + final_fuel.getValue()) {
setprop("FMGC/internal/final-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
if (tfs >= 3 and tfs <= 5 and tf != nil and tf >= 0 and tf <= 80.0) {
setprop("/FMGC/internal/min-dest-fob", tf);
setprop("/FMGC/internal/min-dest-fob-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i);
if (num(getprop("/FMGC/internal/min-dest-fob")) < num(getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/alt-fuel"))) {
genericMessage(i, "CHECK MIN DEST FOB", "wht");
}
} else {
notAllowed(i);
}
} else {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) {
setprop("FMGC/internal/final-time", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
notAllowed(i);
}
} else if (key == "R1") {
} else if (key == "R1" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
notAllowed(i);
} else {
var tfs = size(scratchpad);
if (tfs == 0) {
var zfw = getprop("fdm/jsbsim/inertia/weight-lbs") - getprop("consumables/fuel/total-fuel-lbs");
setprop("MCDU[" ~ i ~ "]/scratchpad", "/" ~ sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
setprop("/FMGC/internal/zfw-set", 1);
if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/tow-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
} else if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
} else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1);
}
} else if (tfs >= 2 and tfs <= 11 and find("/", scratchpad) != -1) {
var zfwi = split("/", scratchpad);
var zfwcg = num(zfwi[0]);
@ -196,24 +177,36 @@ var initInputB = func(key, i) {
var zfwcgs = size(zfwi[0]);
var zfws = size(zfwi[1]);
if (zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) {
setprop("FMGC/internal/zfwcg", zfwi[0]);
setprop("FMGC/internal/zfwcg-set", 1);
setprop("/FMGC/internal/zfwcg", zfwi[0]);
setprop("/FMGC/internal/zfwcg-set", 1);
}
if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) {
setprop("FMGC/internal/zfw", zfwi[1]);
setprop("FMGC/internal/zfw-set", 1);
setprop("/FMGC/internal/zfw", zfwi[1]);
setprop("/FMGC/internal/zfw-set", 1);
if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/tow-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
} else if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
} else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1);
}
}
if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) {
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
} else if (tfs >= 1 and tfs <= 5) {
var zfwcg = size(scratchpad);
if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) {
setprop("FMGC/internal/zfwcg", scratchpad);
setprop("FMGC/internal/zfwcg-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/zfwcg", scratchpad);
setprop("/FMGC/internal/zfwcg-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -221,42 +214,67 @@ var initInputB = func(key, i) {
notAllowed(i);
}
}
} else if (key == "R2") {
} else if (key == "R2" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/block", 0.0);
setprop("FMGC/internal/block-set", 0);
setprop("FMGC/internal/taxi-fuel", 0.4);
setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", 5.0);
setprop("FMGC/internal/alt-fuel", 0.0);
setprop("FMGC/internal/alt-time", "0000");
setprop("FMGC/internal/final-fuel", 0.0);
setprop("FMGC/internal/final-time", "0030");
setprop("FMGC/internal/extra-fuel", 0.0);
setprop("FMGC/internal/extra-time", "0000");
setprop("FMGC/internal/min-dest-fob", 0.0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/block", 0.0);
setprop("/FMGC/internal/block-set", 0);
setprop("/FMGC/internal/taxi-fuel", 0.4);
setprop("/FMGC/internal/taxi-fuel-set", 0);
setprop("/FMGC/internal/trip-fuel", 0);
setprop("/FMGC/internal/trip-time", "0000");
setprop("/FMGC/internal/rte-rsv", 0);
setprop("/FMGC/internal/rte-rsv-set", 0);
setprop("/FMGC/internal/rte-percent", 5.0);
setprop("/FMGC/internal/rte-percent-set", 0);
setprop("/FMGC/internal/alt-fuel", 0);
setprop("/FMGC/internal/alt-fuel-set", 0);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/final-fuel", 0);
setprop("/FMGC/internal/final-fuel-set", 0);
setprop("/FMGC/internal/final-time", "0030");
setprop("/FMGC/internal/final-time-set", 0);
setprop("/FMGC/internal/min-dest-fob", 0);
setprop("/FMGC/internal/min-dest-fob-set", 0);
setprop("/FMGC/internal/tow", 0);
setprop("/FMGC/internal/lw", 0);
setprop("/FMGC/internal/trip-wind", "HD000");
setprop("/FMGC/internal/trip-wind-value", 0);
setprop("/FMGC/internal/fffq-sensor", "FF+FQ");
setprop("/FMGC/internal/extra-fuel", 0);
setprop("/FMGC/internal/extra-time", "0000");
setprop("/FMGC/internal/fuel-request-set", 0);
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
var maxblock = getprop("options/maxblock");
var maxblock = getprop("/options/maxblock");
if (tfs == 0) {
setprop("MCDU[" ~ i ~ "]/scratchpad", sprintf("%3.1f", math.round(getprop("consumables/fuel/total-fuel-lbs") / 1000, 0.1)));
setprop("/FMGC/internal/block", sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)));
setprop("/FMGC/internal/block-set", 1);
if (getprop("/FMGC/internal/zfw-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/tow-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
}
} else if (tfs >= 1 and tfs <= 5) {
if (num(scratchpad) != nil and scratchpad >= 1.0 and scratchpad <= maxblock) {
setprop("FMGC/internal/block", scratchpad);
setprop("FMGC/internal/block-set", 1);
setprop("FMGC/internal/taxi-fuel", 0.4);
setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", 5.0);
setprop("FMGC/internal/alt-fuel", 0.0);
setprop("FMGC/internal/alt-time", "0000");
setprop("FMGC/internal/final-fuel", 0.0);
setprop("FMGC/internal/final-time", "0030");
setprop("FMGC/internal/extra-fuel", 0.0);
setprop("FMGC/internal/extra-time", "0000");
setprop("FMGC/internal/min-dest-fob", 0.0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/block", scratchpad);
setprop("/FMGC/internal/block-set", 1);
if (getprop("/FMGC/internal/zfw-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/tow-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
}
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -265,40 +283,57 @@ var initInputB = func(key, i) {
}
}
} else if (key == "R3") {
if (scratchpad == "" and (!getprop("FMGC/internal/block-set") or !getprop("FMGC/internal/zfw-set"))) {
setprop("FMGC/internal/zfw", num((getprop("fdm/jsbsim/inertia/weight-lbs") - getprop("consumables/fuel/total-fuel-lbs")) / 1000));
setprop("FMGC/internal/zfw-set", 1);
setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("FMGC/internal/block-set", 1);
if (scratchpad == "" and getprop("/FMGC/internal/zfw-set") and !getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/block-calculating", 1);
} else if (scratchpad == "" and getprop("/FMGC/internal/zfw-set") and getprop("/FMGC/internal/fuel-request-set") and !getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/block-calculating")) {
setprop("/FMGC/internal/block-confirmed", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
} else {
notAllowed(i);
}
} else if (key == "R5") {
} else if (key == "R5" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/trip-wind", "HD000");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/trip-wind", "HD000");
setprop("/FMGC/internal/trip-wind-value", 0);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
mcdu.clearScratchpad(i);
} else {
if (find("TL", scratchpad) != -1 or find("HD", scratchpad) != -1) {
var effwind = substr(scratchpad, 2);
if (int(effwind) != nil and effwind >= 0 and effwind <= 500) {
setprop("FMGC/internal/trip-wind", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/trip-wind", scratchpad);
setprop("/FMGC/internal/trip-wind-value", effwind);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
} else if (find("-", scratchpad) != -1 or find("+", scratchpad) != -1 or find("T", scratchpad) != -1 or find("H", scratchpad) != -1) {
var effwind = substr(scratchpad, 1);
if (int(effwind) != nil and effwind >= 0 and effwind <= 500) {
setprop("FMGC/internal/trip-wind", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/trip-wind", scratchpad);
setprop("/FMGC/internal/trip-wind-value", effwind);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
} else {
if (num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 500) {
setprop("FMGC/internal/trip-wind", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/trip-wind", scratchpad);
setprop("/FMGC/internal/trip-wind-value", scratchpad);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}

File diff suppressed because it is too large Load diff

View file

@ -10,11 +10,11 @@ var perfAPPRInput = func(key, i) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/dest-qnh", -1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} 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", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -22,10 +22,10 @@ var perfAPPRInput = func(key, i) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/dest-temp", -999);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else if (num(scratchpad) != nil and scratchpad >= -99 and scratchpad < 99) {
setprop("/FMGC/internal/dest-temp", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -35,7 +35,7 @@ var perfAPPRInput = func(key, i) {
setprop("/FMGC/internal/dest-mag", -1);
setprop("/FMGC/internal/dest-wind", -1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else if (tfs >= 3 and tfs <= 7 and find("/", scratchpad) != -1) {
var weather = split("/", scratchpad);
var mag = int(weather[0]);
@ -46,7 +46,7 @@ var perfAPPRInput = func(key, i) {
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", "");
mcdu.clearScratchpad(i);
fmgc.updateARPT();
} else {
notAllowed(i);
@ -59,24 +59,33 @@ var perfAPPRInput = func(key, i) {
}
} else if (key == "L4") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/trans-alt", 18000);
fmgc.FMGCInternal.transAlt = 18000;
fmgc.FMGCInternal.transAltSet = 0;
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", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
var tfs = size(scratchpad);
if (int(scratchpad) != nil and (tfs == 4 or tfs == 5) and scratchpad >= 1000 and scratchpad <= 39000) {
fmgc.FMGCInternal.transAlt = math.round(scratchpad, 500);
fmgc.FMGCInternal.transAltSet = 1;
mcdu.clearScratchpad(i);
} elsif (int(scratchpad) != nil and (tfs == 2 or tfs == 3) and scratchpad >= 10 and scratchpad <= 390) {
fmgc.FMGCInternal.transAlt = math.round(scratchpad * 100, 5);
fmgc.FMGCInternal.transAltSet = 1;
mcdu.clearScratchpad(i);
} 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", "");
} else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 200) {
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("/FMGC/internal/vapp-speed-set", 1);
setprop("/FMGC/internal/computed-speeds/vapp_appr", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -86,13 +95,13 @@ var perfAPPRInput = func(key, i) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/baro", 99999);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} 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", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -101,16 +110,16 @@ var perfAPPRInput = func(key, i) {
setprop("/FMGC/internal/radio", 99999);
setprop("/FMGC/internal/radio-no", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else if (scratchpad == "NO") {
setprop("/FMGC/internal/radio", 99999);
setprop("/FMGC/internal/radio-no", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} 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", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}

View file

@ -6,18 +6,19 @@ var perfCLBInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L2") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/cost-index", 0);
setprop("FMGC/internal/cost-index-set", 0);
setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (ci != nil and ci >= 0 and ci <= 999) {
setprop("FMGC/internal/cost-index", ci);
setprop("FMGC/internal/cost-index-set", 1);
setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -26,24 +27,24 @@ var perfCLBInput = func(key, i) {
}
}
} else if (key == "L5") {
if (getprop("FMGC/status/phase") == 2) {
if (getprop("/FMGC/status/phase") == 2) {
setprop("MCDU[" ~ i ~ "]/page", "PERFTO");
} else {
notAllowed(i);
}
} else if (key == "L6") {
if (getprop("FMGC/status/phase") == 2) {
if (getprop("FMGC/internal/activate-once") == 1) {
if (getprop("FMGC/internal/activate-twice") == 0) {
setprop("FMGC/internal/activate-twice", 1);
setprop("FMGC/status/phase", 5);
setprop("FMGC/internal/decel", 1);
if (getprop("/FMGC/status/phase") == 2) {
if (getprop("/FMGC/internal/activate-once") == 1) {
if (getprop("/FMGC/internal/activate-twice") == 0) {
setprop("/FMGC/internal/activate-twice", 1);
setprop("/FMGC/status/phase", 5);
setprop("/FMGC/internal/decel", 1);
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else {
notAllowed(i);
}
} else {
setprop("FMGC/internal/activate-once", 1);
setprop("/FMGC/internal/activate-once", 1);
}
} else {
setprop("MCDU[" ~ i ~ "]/page", "PERFTO");

View file

@ -6,18 +6,18 @@ var perfCRZInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L2") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/cost-index", 0);
setprop("FMGC/internal/cost-index-set", 0);
setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (ci != nil and ci >= 0 and ci <= 999) {
setprop("FMGC/internal/cost-index", ci);
setprop("FMGC/internal/cost-index-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -26,18 +26,18 @@ var perfCRZInput = func(key, i) {
}
}
} else if (key == "L6") {
if (getprop("FMGC/status/phase") == 3) {
if (getprop("FMGC/internal/activate-once") == 1) {
if (getprop("FMGC/internal/activate-twice") == 0) {
setprop("FMGC/internal/activate-twice", 1);
setprop("FMGC/status/phase", 5);
setprop("FMGC/internal/decel", 1);
if (getprop("/FMGC/status/phase") == 3) {
if (getprop("/FMGC/internal/activate-once") == 1) {
if (getprop("/FMGC/internal/activate-twice") == 0) {
setprop("/FMGC/internal/activate-twice", 1);
setprop("/FMGC/status/phase", 5);
setprop("/FMGC/internal/decel", 1);
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else {
notAllowed(i);
}
} else {
setprop("FMGC/internal/activate-once", 1);
setprop("/FMGC/internal/activate-once", 1);
}
} else {
setprop("MCDU[" ~ i ~ "]/page", "PERFCLB");

View file

@ -6,18 +6,18 @@ var perfDESInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L2") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/cost-index", 0);
setprop("FMGC/internal/cost-index-set", 0);
setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (ci != nil and ci >= 0 and ci <= 999) {
setprop("FMGC/internal/cost-index", ci);
setprop("FMGC/internal/cost-index-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -26,18 +26,18 @@ var perfDESInput = func(key, i) {
}
}
} else if (key == "L6") {
if (getprop("FMGC/status/phase") == 4) {
if (getprop("FMGC/internal/activate-once") == 1) {
if (getprop("FMGC/internal/activate-twice") == 0) {
setprop("FMGC/internal/activate-twice", 1);
setprop("FMGC/status/phase", 5);
setprop("FMGC/internal/decel", 1);
if (getprop("/FMGC/status/phase") == 4) {
if (getprop("/FMGC/internal/activate-once") == 1) {
if (getprop("/FMGC/internal/activate-twice") == 0) {
setprop("/FMGC/internal/activate-twice", 1);
setprop("/FMGC/status/phase", 5);
setprop("/FMGC/internal/decel", 1);
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else {
notAllowed(i);
}
} else {
setprop("FMGC/internal/activate-once", 1);
setprop("/FMGC/internal/activate-once", 1);
}
} else {
setprop("MCDU[" ~ i ~ "]/page", "PERFCRZ");

View file

@ -7,10 +7,10 @@ var perfGAInput = func(key, i) {
if (key == "L5") {
if (scratchpad == "CLR") {
setprop("systems/thrust/clbreduc-ft", "1500");
setprop("FMGC/internal/accel-agl-ft", "1500");
setprop("/FMGC/internal/accel-agl-ft", "1500");
setprop("MCDUC/thracc-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs >= 7 and tfs <= 9 and find("/", scratchpad) != -1) {
@ -19,9 +19,9 @@ var perfGAInput = func(key, i) {
var acc = size(thracc[1]);
if (int(thrred) != nil and int(acc) != nil and (thrred >= 3 and thrred <= 5) and (acc >= 3 and acc <= 5)) {
setprop("systems/thrust/clbreduc-ft", thracc[0]);
setprop("FMGC/internal/accel-agl-ft", thracc[1]);
setprop("/FMGC/internal/accel-agl-ft", thracc[1]);
setprop("MCDUC/thracc-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -33,16 +33,16 @@ var perfGAInput = func(key, i) {
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else if (key == "R5") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/eng-out-reduc", "1500");
setprop("/FMGC/internal/eng-out-reduc", "1500");
setprop("MCDUC/reducacc-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (int(scratchpad) != nil and tfs >= 3 and tfs <= 5) {
setprop("FMGC/internal/eng-out-reduc", scratchpad);
setprop("/FMGC/internal/eng-out-reduc", scratchpad);
setprop("MCDUC/reducacc-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}

View file

@ -6,19 +6,19 @@
var perfTOInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") {
if (getprop("FMGC/status/phase") != 1) {
if (getprop("/FMGC/status/phase") != 1) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/v1", 0);
setprop("FMGC/internal/v1-set", 0);
setprop("/FMGC/internal/v1", 0);
setprop("/FMGC/internal/v1-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs == 3) {
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("FMGC/internal/v1", scratchpad);
setprop("FMGC/internal/v1-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/v1", scratchpad);
setprop("/FMGC/internal/v1-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -30,19 +30,20 @@ var perfTOInput = func(key, i) {
notAllowed(i);
}
} else if (key == "L2") {
if (getprop("FMGC/status/phase") != 1) {
if (getprop("/FMGC/status/phase") != 1) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/vr", 0);
setprop("FMGC/internal/vr-set", 0);
setprop("/FMGC/internal/vr", 0);
setprop("/FMGC/internal/vr-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs == 3) {
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("FMGC/internal/vr", scratchpad);
setprop("FMGC/internal/vr-set", 1);
setprop("/FMGC/internal/vr", scratchpad);
setprop("/FMGC/internal/vr-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -54,21 +55,21 @@ var perfTOInput = func(key, i) {
notAllowed(i);
}
} else if (key == "L3") {
if (getprop("FMGC/status/phase") != 1) {
if (getprop("/FMGC/status/phase") != 1) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/v2", 0);
setprop("FMGC/internal/v2-set", 0);
setprop("/FMGC/internal/v2", 0);
setprop("/FMGC/internal/v2-set", 0);
setprop("it-autoflight/settings/togaspd", 157);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs == 3) {
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("FMGC/internal/v2", scratchpad);
setprop("FMGC/internal/v2-set", 1);
setprop("/FMGC/internal/v2", scratchpad);
setprop("/FMGC/internal/v2-set", 1);
setprop("it-autoflight/settings/togaspd", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -81,14 +82,16 @@ var perfTOInput = func(key, i) {
}
} else if (key == "L4") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/trans-alt", 18000);
fmgc.FMGCInternal.transAlt = 18000;
fmgc.FMGCInternal.transAltSet = 0;
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (int(scratchpad) != nil and (tfs == 4 or tfs <= 5) and scratchpad >= 1000 and scratchpad <= 39000) {
setprop("FMGC/internal/trans-alt", int(scratchpad / 10) * 10);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.FMGCInternal.transAlt = int(scratchpad / 10) * 10;
fmgc.FMGCInternal.transAltSet = 1;
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -96,10 +99,10 @@ var perfTOInput = func(key, i) {
} else if (key == "L5") {
if (scratchpad == "CLR") {
setprop("systems/thrust/clbreduc-ft", "1500");
setprop("FMGC/internal/accel-agl-ft", "1500");
setprop("/FMGC/internal/accel-agl-ft", "1500");
setprop("MCDUC/thracc-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (find("/", scratchpad) != -1) {
@ -110,29 +113,29 @@ var perfTOInput = func(key, i) {
var accs = size(acc);
if (int(thrred) != nil and (thrreds >= 3 and thrreds <= 5) and thrred >= 400 and thrred <= 39000 and int(acc) != nil and (accs == 3 or accs == 4 or accs == 5) and acc >= 400 and acc <= 39000) {
setprop("systems/thrust/clbreduc-ft", int(thrred / 10) * 10);
setprop("FMGC/internal/accel-agl-ft", int(acc / 10) * 10);
setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10);
setprop("MCDUC/thracc-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else if (thrreds == 0 and int(acc) != nil and (accs >= 3 and accs <= 5) and acc >= 400 and acc <= 39000) {
setprop("FMGC/internal/accel-agl-ft", int(acc / 10) * 10);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
} else if (num(scratchpad) != nil and (tfs >= 3 and tfs <= 5) and scratchpad >= 400 and scratchpad <= 39000) {
setprop("systems/thrust/clbreduc-ft", int(scratchpad / 10) * 10);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
}
} else if (key == "R3") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/to-flap", 0);
setprop("FMGC/internal/to-ths", "0.0");
setprop("FMGC/internal/flap-ths-set", 0);
setprop("/FMGC/internal/to-flap", 0);
setprop("/FMGC/internal/to-ths", "0.0");
setprop("/FMGC/internal/flap-ths-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
if (find("/", scratchpad) != -1) {
var flapths = split("/", scratchpad);
@ -144,43 +147,43 @@ var perfTOInput = func(key, i) {
var trimb = substr(trim, 0, 3);
var validtrima = num(trima) != nil and num(trima) >= 0 and num(trima) <= 7.0;
var validtrimb = num(trimb) != nil and num(trimb) >= 0 and num(trimb) <= 7.0;
if (flaps == 0 and getprop("FMGC/internal/flap-ths-set")) {
if (flaps == 0 and getprop("/FMGC/internal/flap-ths-set")) {
if (trims == 5 and find("DN", trim) != -1 and validtrima) {
setprop("FMGC/internal/to-ths", -1 * trima);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/to-ths", -1 * trima);
mcdu.clearScratchpad(i);
} else if (trims == 5 and find("DN", trim) != -1 and validtrimb) {
setprop("FMGC/internal/to-ths", -1 * trimb);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/to-ths", -1 * trimb);
mcdu.clearScratchpad(i);
} else if (trims == 5 and find("UP", trim) != -1 and validtrima) {
setprop("FMGC/internal/to-ths", trima);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/to-ths", trima);
mcdu.clearScratchpad(i);
} else if (trims == 5 and find("UP", trim) != -1 and validtrimb) {
setprop("FMGC/internal/to-ths", trimb);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/to-ths", trimb);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
} else if (flaps == 1 and num(flap) != nil and flap >= 0 and flap <= 3) {
if (trims == 5 and find("DN", trim) != -1 and validtrima) {
setprop("FMGC/internal/to-flap", flap);
setprop("FMGC/internal/to-ths", -1 * trima);
setprop("FMGC/internal/flap-ths-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/to-flap", flap);
setprop("/FMGC/internal/to-ths", -1 * trima);
setprop("/FMGC/internal/flap-ths-set", 1);
mcdu.clearScratchpad(i);
} else if (trims == 5 and find("DN", trim) != -1 and validtrimb) {
setprop("FMGC/internal/to-flap", flap);
setprop("FMGC/internal/to-ths", -1 * trimb);
setprop("FMGC/internal/flap-ths-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/to-flap", flap);
setprop("/FMGC/internal/to-ths", -1 * trimb);
setprop("/FMGC/internal/flap-ths-set", 1);
mcdu.clearScratchpad(i);
} else if (trims == 5 and find("UP", trim) != -1 and validtrima) {
setprop("FMGC/internal/to-flap", flap);
setprop("FMGC/internal/to-ths", trima);
setprop("FMGC/internal/flap-ths-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/to-flap", flap);
setprop("/FMGC/internal/to-ths", trima);
setprop("/FMGC/internal/flap-ths-set", 1);
mcdu.clearScratchpad(i);
} else if (trims == 5 and find("UP", trim) != -1 and validtrimb) {
setprop("FMGC/internal/to-flap", flap);
setprop("FMGC/internal/to-ths", trimb);
setprop("FMGC/internal/flap-ths-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/to-flap", flap);
setprop("/FMGC/internal/to-ths", trimb);
setprop("/FMGC/internal/flap-ths-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -188,30 +191,30 @@ var perfTOInput = func(key, i) {
notAllowed(i);
}
} else if (size(scratchpad) == 1 and num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 3) {
setprop("FMGC/internal/to-flap", scratchpad);
if (!getprop("FMGC/internal/flap-ths-set")) {
setprop("FMGC/internal/flap-ths-set", 1);
setprop("/FMGC/internal/to-flap", scratchpad);
if (!getprop("/FMGC/internal/flap-ths-set")) {
setprop("/FMGC/internal/flap-ths-set", 1);
}
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
}
} else if (key == "R4") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/flex", 0);
setprop("FMGC/internal/flex-set", 0);
setprop("/FMGC/internal/flex", 0);
setprop("/FMGC/internal/flex-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs == 1 or tfs == 2) {
if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 99) {
setprop("FMGC/internal/flex", scratchpad);
setprop("FMGC/internal/flex-set", 1);
var flex_calc = getprop("FMGC/internal/flex") - getprop("environment/temperature-degc");
setprop("FMGC/internal/flex-cmd", flex_calc);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/flex", scratchpad);
setprop("/FMGC/internal/flex-set", 1);
var flex_calc = getprop("/FMGC/internal/flex") - getprop("environment/temperature-degc");
setprop("/FMGC/internal/flex-cmd", flex_calc);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -221,16 +224,16 @@ var perfTOInput = func(key, i) {
}
} else if (key == "R5") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/eng-out-reduc", "1500");
setprop("/FMGC/internal/eng-out-reduc", "1500");
setprop("MCDUC/reducacc-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (int(scratchpad) != nil and (tfs == 4 or tfs == 5) and scratchpad >= 1000 and scratchpad <= 39000) {
setprop("FMGC/internal/eng-out-reduc", scratchpad);
setprop("/FMGC/internal/eng-out-reduc", scratchpad);
setprop("MCDUC/reducacc-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}

View file

@ -0,0 +1,97 @@
var pilotWaypointPage = {
title: nil,
fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
L1: [nil, nil, "ack"], # content, title, colour
L2: [nil, nil, "ack"],
L3: [nil, nil, "ack"],
L4: [nil, nil, "ack"],
L5: [nil, nil, "ack"],
L6: [nil, nil, "ack"],
C1: [nil, nil, "ack"],
C2: [nil, nil, "ack"],
C3: [nil, nil, "ack"],
C4: [nil, nil, "ack"],
C5: [nil, nil, "ack"],
C6: [nil, nil, "ack"],
R1: [nil, nil, "ack"],
R2: [nil, nil, "ack"],
R3: [nil, nil, "ack"],
R4: [nil, nil, "ack"],
R5: [nil, nil, "ack"],
R6: [nil, nil, "ack"],
new: func(computer) {
var ap = {parents:[pilotWaypointPage]};
ap.scroll = fmgc.WaypointDatabase.getNonNilIndex();
ap.computer = computer;
ap._setupPageWithData();
return ap;
},
del: func() {
return nil;
},
_setupPageWithData: func() {
me.title = "PILOTS WAYPOINT";
me.L1 = [fmgc.WaypointDatabase.waypointsVec[me.scroll].id, " IDENT", "grn"];
var ghost = fmgc.WaypointDatabase.waypointsVec[me.scroll].wpGhost;
me.L2 = [me.translateLatitude(ghost.lat) ~ "/" ~ me.translateLongitude(ghost.lon), " LAT/LON", "grn"];
me.R5 = ["WAYPOINT ", "NEW ", "wht"];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["ack", "ack", "ack", "ack", "wht", "blu"]];
if (fmgc.WaypointDatabase.confirm[me.computer]) {
me.R6 = ["CONFIRM DELETE ALL ", nil, "amb"];
me.arrowsColour[1][5] = "amb";
} else {
me.R6 = ["DELETE ALL ", nil, "blu"];
me.arrowsColour[1][5] = "blu";
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
translateLatitude: func(latitude) {
var split = split(".", sprintf("%s", latitude));
var degree = split[0];
if (latitude >= 0) {
var decimal = sprintf("%04.1f", (latitude - num(degree)) * 60);
return sprintf("%02.0f", degree) ~ decimal ~ "N";
} else {
var decimal = sprintf("%04.1f", (latitude - num(degree)) * 60);
return sprintf("%02.0f", degree) ~ decimal ~ "S";
}
},
translateLongitude: func(longitude) {
var split = split(".", sprintf("%s", longitude));
var degree = split[0];
if (longitude >= 0) {
var decimal = sprintf("%04.1f", (longitude - num(degree)) * 60);
return sprintf("%03.0f", degree) ~ decimal ~ "E";
} else {
var decimal = sprintf("%04.1f", (longitude - num(degree)) * 60);
return sprintf("%03.0f", degree) ~ decimal ~ "W";
}
},
scrollLeft: func() {
me.scroll = fmgc.WaypointDatabase.getPreviousFromIndex(me.scroll);
me._setupPageWithData();
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
scrollRight: func() {
me.scroll = fmgc.WaypointDatabase.getNextFromIndex(me.scroll);
me._setupPageWithData();
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
deleteCmd: func() {
if (!fmgc.WaypointDatabase.confirm[me.computer]) {
fmgc.WaypointDatabase.delete(me.computer);
me.scroll = fmgc.WaypointDatabase.getNonNilIndex();
}
me._setupPageWithData();
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
};

View file

@ -4,25 +4,25 @@ var progCLBInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/cruise-fl-prog", getprop("FMGC/internal/cruise-fl"));
if (getprop("FMGC/status/phase") == 5) {
setprop("FMGC/status/phase", 3);
setprop("FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0);
setprop("FMGC/internal/decel", 0);
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));
if (getprop("/FMGC/status/phase") == 5) {
setprop("/FMGC/status/phase", 3);
setprop("/FMGC/internal/activate-once", 0);
setprop("/FMGC/internal/activate-twice", 0);
setprop("/FMGC/internal/decel", 0);
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil) {
var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
setprop("FMGC/internal/cruise-fl-prog", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
if (getprop("FMGC/status/phase") == 5) {
setprop("FMGC/status/phase", 3);
setprop("FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0);
setprop("FMGC/internal/decel", 0);
setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
mcdu.clearScratchpad(i);
if (getprop("/FMGC/status/phase") == 5) {
setprop("/FMGC/status/phase", 3);
setprop("/FMGC/internal/activate-once", 0);
setprop("/FMGC/internal/activate-twice", 0);
setprop("/FMGC/internal/decel", 0);
}
} else {
notAllowed(i);

View file

@ -4,25 +4,25 @@ var progCRZInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/cruise-fl-prog", getprop("FMGC/internal/cruise-fl"));
if (getprop("FMGC/status/phase") == 5) {
setprop("FMGC/status/phase", 3);
setprop("FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0);
setprop("FMGC/internal/decel", 0);
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));
if (getprop("/FMGC/status/phase") == 5) {
setprop("/FMGC/status/phase", 3);
setprop("/FMGC/internal/activate-once", 0);
setprop("/FMGC/internal/activate-twice", 0);
setprop("/FMGC/internal/decel", 0);
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil) {
var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
setprop("FMGC/internal/cruise-fl-prog", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
if (getprop("FMGC/status/phase") == 5) {
setprop("FMGC/status/phase", 3);
setprop("FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0);
setprop("FMGC/internal/decel", 0);
setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
mcdu.clearScratchpad(i);
if (getprop("/FMGC/status/phase") == 5) {
setprop("/FMGC/status/phase", 3);
setprop("/FMGC/internal/activate-once", 0);
setprop("/FMGC/internal/activate-twice", 0);
setprop("/FMGC/internal/decel", 0);
}
} else {
notAllowed(i);

View file

@ -4,25 +4,25 @@ var progDESInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/cruise-fl-prog", getprop("FMGC/internal/cruise-fl"));
if (getprop("FMGC/status/phase") == 5 or getprop("FMGC/status/phase") == 6) {
setprop("FMGC/status/phase", 3);
setprop("FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0);
setprop("FMGC/internal/decel", 0);
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));
if (getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) {
setprop("/FMGC/status/phase", 3);
setprop("/FMGC/internal/activate-once", 0);
setprop("/FMGC/internal/activate-twice", 0);
setprop("/FMGC/internal/decel", 0);
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil) {
var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
setprop("FMGC/internal/cruise-fl-prog", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
if (getprop("FMGC/status/phase") == 4 or getprop("FMGC/status/phase") == 5 or getprop("FMGC/status/phase") == 6) {
setprop("FMGC/status/phase", 3);
setprop("FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0);
setprop("FMGC/internal/decel", 0);
setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
mcdu.clearScratchpad(i);
if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) {
setprop("/FMGC/status/phase", 3);
setprop("/FMGC/internal/activate-once", 0);
setprop("/FMGC/internal/activate-twice", 0);
setprop("/FMGC/internal/decel", 0);
}
} else {
notAllowed(i);

View file

@ -6,14 +6,14 @@ var progTOInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/cruise-fl-prog", getprop("FMGC/internal/cruise-fl"));
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil) {
var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100 and getprop("FMGC/internal/cruise-lvl-set")) {
setprop("FMGC/internal/cruise-fl-prog", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100 and getprop("/FMGC/internal/cruise-lvl-set")) {
setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}

View file

@ -6,9 +6,9 @@ var radnavInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/vor1freq-set", 0);
setprop("/FMGC/internal/vor1freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs == 3 or tfs == 5 or tfs == 6) {
@ -20,13 +20,13 @@ var radnavInput = func(key, i) {
notAllowed(i);
} else {
setprop("instrumentation/nav[2]/frequencies/selected-mhz", scratchpad);
setprop("FMGC/internal/vor1freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/vor1freq-set", 1);
mcdu.clearScratchpad(i);
}
} else if (scratchpad >= 112.00 and scratchpad <= 117.95) {
setprop("instrumentation/nav[2]/frequencies/selected-mhz", scratchpad);
setprop("FMGC/internal/vor1freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/vor1freq-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -36,16 +36,16 @@ var radnavInput = func(key, i) {
}
} else if (key == "L2") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/vor1crs-set", 0);
setprop("/FMGC/internal/vor1crs-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 3) {
if (scratchpad >= 0 and scratchpad <= 360) {
setprop("instrumentation/nav[2]/radials/selected-deg", scratchpad);
setprop("FMGC/internal/vor1crs-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/vor1crs-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -55,9 +55,9 @@ var radnavInput = func(key, i) {
}
} else if (key == "L3") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/ils1freq-set", 0);
setprop("/FMGC/internal/ils1freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs == 3 or tfs == 5 or tfs == 6) {
@ -67,9 +67,9 @@ var radnavInput = func(key, i) {
or scratchpad == 110.10 or scratchpad == 110.15 or scratchpad == 110.30 or scratchpad == 110.35 or scratchpad == 110.50 or scratchpad == 110.55 or scratchpad == 110.70 or scratchpad == 110.75 or scratchpad == 110.90 or scratchpad == 110.95
or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) {
setprop("instrumentation/nav[0]/frequencies/selected-mhz", scratchpad);
setprop("FMGC/internal/ils1freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
if (num(getprop("FMGC/internal/ils1freq-calculated")) != 0 and num(getprop("FMGC/internal/ils1freq-calculated")) != num(getprop("instrumentation/nav[0]/frequencies/selected-mhz"))) {
setprop("/FMGC/internal/ils1freq-set", 1);
mcdu.clearScratchpad(i);
if (num(getprop("/FMGC/internal/ils1freq-calculated")) != 0 and num(getprop("/FMGC/internal/ils1freq-calculated")) != num(getprop("instrumentation/nav[0]/frequencies/selected-mhz"))) {
genericMessage(i, "RWY/LS MISMATCH", "amb");
}
} else {
@ -84,16 +84,16 @@ var radnavInput = func(key, i) {
}
} else if (key == "L4") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/ils1crs-set", 0);
setprop("/FMGC/internal/ils1crs-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 3) {
if (scratchpad >= 0 and scratchpad <= 360) {
setprop("instrumentation/nav[0]/radials/selected-deg", scratchpad);
setprop("FMGC/internal/ils1crs-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/ils1crs-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -103,16 +103,16 @@ var radnavInput = func(key, i) {
}
} else if (key == "L5") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/adf1freq-set", 0);
setprop("/FMGC/internal/adf1freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs == 3 or tfs == 4) {
if (scratchpad >= 190 and scratchpad <= 1750) {
setprop("instrumentation/adf[0]/frequencies/selected-khz", scratchpad);
setprop("FMGC/internal/adf1freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/adf1freq-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -122,9 +122,9 @@ var radnavInput = func(key, i) {
}
} else if (key == "R1") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/vor2freq-set", 0);
setprop("/FMGC/internal/vor2freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs == 3 or tfs == 5 or tfs == 6) {
@ -136,13 +136,13 @@ var radnavInput = func(key, i) {
notAllowed(i);
} else {
setprop("instrumentation/nav[3]/frequencies/selected-mhz", scratchpad);
setprop("FMGC/internal/vor2freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/vor2freq-set", 1);
mcdu.clearScratchpad(i);
}
} else if (scratchpad >= 112.00 and scratchpad <= 117.95) {
setprop("instrumentation/nav[3]/frequencies/selected-mhz", scratchpad);
setprop("FMGC/internal/vor2freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/vor2freq-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -152,16 +152,16 @@ var radnavInput = func(key, i) {
}
} else if (key == "R2") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/vor2crs-set", 0);
setprop("/FMGC/internal/vor2crs-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 3) {
if (scratchpad >= 0 and scratchpad <= 360) {
setprop("instrumentation/nav[3]/radials/selected-deg", scratchpad);
setprop("FMGC/internal/vor2crs-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/vor2crs-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}
@ -171,16 +171,16 @@ var radnavInput = func(key, i) {
}
} else if (key == "R5") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/adf2freq-set", 0);
setprop("/FMGC/internal/adf2freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
mcdu.clearScratchpad(i);
} else {
var tfs = size(scratchpad);
if (tfs == 3 or tfs == 4) {
if (scratchpad >= 190 and scratchpad <= 1750) {
setprop("instrumentation/adf[1]/frequencies/selected-khz", scratchpad);
setprop("FMGC/internal/adf2freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("/FMGC/internal/adf2freq-set", 1);
mcdu.clearScratchpad(i);
} else {
notAllowed(i);
}

View file

@ -5,5 +5,12 @@
var statusInput = func(key, i) {
if (key == "L3") {
fmgc.switchDatabase();
} elsif (key == "R5") {
if (fmgc.WaypointDatabase.confirm[i]) {
fmgc.WaypointDatabase.delete(i);
fmgc.WaypointDatabase.confirm[i] = 0;
} else {
fmgc.WaypointDatabase.confirm[i] = 1;
}
}
}

View file

@ -50,7 +50,7 @@ var vertRev = {
me.L5 = [" WIND DATA", nil, "wht"];
me.L6 = [" RETURN", nil, "wht"];
me.R2 = ["RTA ", nil, "wht"];
me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 0, 1]];
me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "wht"], ["ack", "wht", "ack", "ack", "wht", "wht"]];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
} if (me.type == 2) {
@ -61,12 +61,17 @@ var vertRev = {
me.L3 = [" [ ]", " SPD CSTR", "blu"];
me.L4 = [" CONSTANT MACH", nil, "wht"];
me.L5 = [" WIND DATA", nil, "wht"];
me.L6 = [" CLB", nil, "wht"];
me.L6 = [" CLB", nil, "amb"];
me.R2 = ["RTA ", nil, "wht"];
me.R3 = ["[ ] ", "ALT CSTR ", "blu"];
me.R6 = ["DES ", nil, "wht"];
me.R6 = ["DES ", nil, "amb"];
# When the system does vertical planning, L6 should be RETURN and R6 not used if the MCDU knows the waypoint is during climb or descent.
# The CLB or DES prompts should only be shown for a vertical revision in the cruise phase.
# For now we fake it and allow the user to press either, which both act like RETURN.
# When CLB/DES are shown, a small "OR" should be shown between them.
# The 'arrows' for CLB/DES should actually be asterisks.
me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 0, 1]];
me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "wht"], ["ack", "wht", "ack", "ack", "wht", "wht"]];
me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "amb"], ["ack", "wht", "ack", "ack", "wht", "amb"]];
me.fontMatrix = [[0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0]];
} else {
me.title = ["VERT REV", " AT ", me.id];
@ -84,8 +89,7 @@ var vertRev = {
me.L5 = [" WIND DATA", nil, "wht"];
me.L6 = [" RETURN", nil, "wht"];
me.R2 = ["RTA ", nil, "wht"];
me.R6 = ["DES ", nil, "wht"];
me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 0, 1]];
me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "wht"], ["ack", "wht", "ack", "ack", "wht", "wht"]];
me.fontMatrix = [[0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
} elsif (me.type == 1) {
@ -102,8 +106,7 @@ var vertRev = {
me.L6 = [" RETURN", nil, "wht"];
me.R2 = ["RTA ", nil, "wht"];
me.R3 = ["3000", "G/S INTCP", "grn"];
me.R6 = ["DES ", nil, "wht"];
me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 0, 1]];
me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "wht"], ["ack", "wht", "ack", "ack", "wht", "wht"]];
me.fontMatrix = [[0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
}

View file

@ -7,32 +7,56 @@
# NOTE: This is just temporary until FG allows a full implementation of the audio system.
var vhf1_recive = props.globals.initNode("/controls/audio/acp[0]/vhf1-recive", 1, "BOOL");
var vhf2_recive = props.globals.initNode("/controls/audio/acp[0]/vhf2-recive", 1, "BOOL");
var vhf1_capt_recive = props.globals.initNode("/controls/audio/acp[0]/vhf1-recive", 1, "BOOL");
var vhf2_capt_recive = props.globals.initNode("/controls/audio/acp[0]/vhf2-recive", 1, "BOOL");
var vhf1_capt_volume = props.globals.initNode("/controls/audio/acp[0]/vhf1-volume", 1, "DOUBLE");
var vhf2_capt_volume = props.globals.initNode("/controls/audio/acp[0]/vhf2-volume", 1, "DOUBLE");
var vhf1_volume = props.globals.initNode("/controls/audio/acp[0]/vhf1-volume", 1, "DOUBLE");
var vhf2_volume = props.globals.initNode("/controls/audio/acp[0]/vhf2-volume", 1, "DOUBLE");
var vhf1_fo_recive = props.globals.initNode("/controls/audio/acp[1]/vhf1-recive", 1, "BOOL");
var vhf2_fo_recive = props.globals.initNode("/controls/audio/acp[1]/vhf2-recive", 1, "BOOL");
var vhf1_fo_volume = props.globals.initNode("/controls/audio/acp[1]/vhf1-volume", 1, "DOUBLE");
var vhf2_fo_volume = props.globals.initNode("/controls/audio/acp[1]/vhf2-volume", 1, "DOUBLE");
var com1_volume = props.globals.getNode("instrumentation/comm[0]/volume");
var com2_volume = props.globals.getNode("instrumentation/comm[1]/volume");
var init = func() {
vhf1_recive.setValue(1);
vhf2_recive.setValue(1);
vhf1_volume.setValue(1);
vhf2_volume.setValue(0.8);
vhf1_capt_recive.setValue(1);
vhf2_capt_recive.setValue(1);
vhf1_capt_volume.setValue(1);
vhf2_capt_volume.setValue(0.8);
vhf1_fo_recive.setValue(1);
vhf2_fo_recive.setValue(1);
vhf1_fo_volume.setValue(0.8);
vhf2_fo_volume.setValue(1);
}
var update_instruments = func(com_no) {
if (com_no == 0) {
if (vhf1_recive.getValue()) {
com1_volume.setValue(vhf1_volume.getValue());
var update_com1 = func() {
if (getprop("systems/acconfig/options/fo-view") == 1) {
if (vhf1_fo_recive.getValue()) {
com1_volume.setValue(vhf1_fo_volume.getValue());
} else {
com1_volume.setValue(0);
}
} else if (com_no == 1) {
if (vhf2_recive.getValue()) {
com2_volume.setValue(vhf2_volume.getValue());
} else {
if (vhf1_capt_recive.getValue()) {
com1_volume.setValue(vhf1_capt_volume.getValue());
} else {
com1_volume.setValue(0);
}
}
}
var update_com2 = func() {
if (getprop("systems/acconfig/options/fo-view") == 1) {
if (vhf2_fo_recive.getValue()) {
com2_volume.setValue(vhf2_fo_volume.getValue());
} else {
com2_volume.setValue(0);
}
} else {
if (vhf2_capt_recive.getValue()) {
com2_volume.setValue(vhf2_capt_volume.getValue());
} else {
com2_volume.setValue(0);
}
@ -40,17 +64,39 @@ var update_instruments = func(com_no) {
}
setlistener("/controls/audio/acp[0]/vhf1-recive", func {
update_instruments(0);
update_com1();
});
setlistener("/controls/audio/acp[0]/vhf1-volume", func {
update_instruments(0);
update_com1();
});
setlistener("/controls/audio/acp[0]/vhf2-recive", func {
update_instruments(1);
update_com2();
});
setlistener("/controls/audio/acp[0]/vhf2-volume", func {
update_instruments(1);
update_com2();
});
setlistener("/controls/audio/acp[1]/vhf1-recive", func {
update_com1();
});
setlistener("/controls/audio/acp[1]/vhf1-volume", func {
update_com1();
});
setlistener("/controls/audio/acp[1]/vhf2-recive", func {
update_com2();
});
setlistener("/controls/audio/acp[1]/vhf2-volume", func {
update_com2();
});
setlistener("/systems/acconfig/options/fo-view", func {
update_com1();
update_com2();
});

View file

@ -8,14 +8,15 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/start/A320_cockpit_starter.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>1</value>
</equals>
<property>/sim/sound/internal-custom</property>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>1</factor>
</volume>
<position>
<x>0</x>
<y>20</y>
@ -28,14 +29,15 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/start/A320_cockpit_starter.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>1</value>
</equals>
<property>/sim/sound/internal-custom</property>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>1</factor>
</volume>
<position>
<x>0</x>
<y>-20</y>
@ -48,14 +50,15 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/start/A320_cockpit_startup.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
<property>/sim/sound/internal-custom</property>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>1</factor>
</volume>
<position>
<x>0</x>
<y>20</y>
@ -68,14 +71,15 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/start/A320_cockpit_startup.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
<property>/sim/sound/internal-custom</property>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>1</factor>
</volume>
<position>
<x>0</x>
<y>-20</y>
@ -492,21 +496,23 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/external/cfm-starter.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>1</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>-1</x>
<y>0</y>
<z>0</z>
<inner-angle>225</inner-angle>
<outer-angle>135</outer-angle>
<outer-gain>0.01</outer-gain>
<outer-gain>0.60</outer-gain>
</orientation>
<reference-dist>30</reference-dist>
<position>
@ -521,21 +527,23 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/external/cfm-starter.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>1</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>-1</x>
<y>0</y>
<z>0</z>
<inner-angle>225</inner-angle>
<outer-angle>135</outer-angle>
<outer-gain>0.01</outer-gain>
<outer-gain>0.60</outer-gain>
</orientation>
<reference-dist>30</reference-dist>
<position>
@ -550,14 +558,16 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/external/cfm-startup.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>-1</x>
<y>0</y>
@ -579,14 +589,16 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/external/cfm-startup.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>-1</x>
<y>0</y>
@ -608,14 +620,16 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/external/cfm-startup-rear.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>1</x>
<y>0</y>
@ -637,14 +651,16 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/external/cfm-startup-rear.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>1</x>
<y>0</y>

View file

@ -8,14 +8,15 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/start/A320_cockpit_starter.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>1</value>
</equals>
<property>/sim/sound/internal-custom</property>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>1</factor>
</volume>
<position>
<x>0</x>
<y>20</y>
@ -28,14 +29,15 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/start/A320_cockpit_starter.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>1</value>
</equals>
<property>/sim/sound/internal-custom</property>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>1</factor>
</volume>
<position>
<x>0</x>
<y>-20</y>
@ -48,14 +50,15 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/start/A320_cockpit_startup.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
<property>/sim/sound/internal-custom</property>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>1</factor>
</volume>
<position>
<x>0</x>
<y>20</y>
@ -68,14 +71,15 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/start/A320_cockpit_startup.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
<property>/sim/sound/internal-custom</property>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>1</factor>
</volume>
<position>
<x>0</x>
<y>-20</y>
@ -448,21 +452,23 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/external/cfm-starter.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>1</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>-1</x>
<y>0</y>
<z>0</z>
<inner-angle>225</inner-angle>
<outer-angle>135</outer-angle>
<outer-gain>0.01</outer-gain>
<outer-gain>0.60</outer-gain>
</orientation>
<reference-dist>30</reference-dist>
<position>
@ -477,21 +483,23 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/external/cfm-starter.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>1</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>-1</x>
<y>0</y>
<z>0</z>
<inner-angle>225</inner-angle>
<outer-angle>135</outer-angle>
<outer-gain>0.01</outer-gain>
<outer-gain>0.60</outer-gain>
</orientation>
<reference-dist>30</reference-dist>
<position>
@ -506,14 +514,16 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/external/cfm-startup.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>-1</x>
<y>0</y>
@ -535,14 +545,16 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/external/cfm-startup.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>-1</x>
<y>0</y>
@ -564,14 +576,16 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/external/cfm-startup-rear.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>1</x>
<y>0</y>
@ -593,14 +607,16 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/CFM56B/external/cfm-startup-rear.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>1</x>
<y>0</y>

View file

@ -8,14 +8,15 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/V2500/start/v2500-start1.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>1</value>
</equals>
<property>/sim/sound/internal-custom</property>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>1</factor>
</volume>
<position>
<x>0</x>
<y>20</y>
@ -28,14 +29,15 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/V2500/start/v2500-start1.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>1</value>
</equals>
<property>/sim/sound/internal-custom</property>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>1</factor>
</volume>
<position>
<x>0</x>
<y>-20</y>
@ -48,14 +50,15 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/V2500/start/v2500-start2.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
<property>/sim/sound/internal-custom</property>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>1</factor>
</volume>
<position>
<x>0</x>
<y>20</y>
@ -68,14 +71,15 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/V2500/start/v2500-start2.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
<property>/sim/sound/internal-custom</property>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>1</factor>
</volume>
<position>
<x>0</x>
<y>-20</y>
@ -309,21 +313,23 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/V2500/external/v2500-starter.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>1</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>-1</x>
<y>0</y>
<z>0</z>
<inner-angle>225</inner-angle>
<outer-angle>135</outer-angle>
<outer-gain>0.01</outer-gain>
<outer-gain>0.60</outer-gain>
</orientation>
<reference-dist>30</reference-dist>
<position>
@ -338,21 +344,23 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/V2500/external/v2500-starter.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>1</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>-1</x>
<y>0</y>
<z>0</z>
<inner-angle>225</inner-angle>
<outer-angle>135</outer-angle>
<outer-gain>0.01</outer-gain>
<outer-gain>0.60</outer-gain>
</orientation>
<reference-dist>30</reference-dist>
<position>
@ -367,14 +375,16 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/V2500/external/v2500-startup.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>-1</x>
<y>0</y>
@ -396,14 +406,16 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/V2500/external/v2500-startup.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>-1</x>
<y>0</y>
@ -425,14 +437,16 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/V2500/external/v2500-startup-rear.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[0]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>1</x>
<y>0</y>
@ -454,14 +468,16 @@
<mode>once</mode>
<path>Aircraft/A320-family/Sounds/SASA/V2500/external/v2500-startup-rear.wav</path>
<condition>
<and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
<not><property>/sim/sound/internal-custom</property></not>
</and>
<equals>
<property>/engines/engine[1]/state</property>
<value>2</value>
</equals>
</condition>
<volume>
<property>/sim/sound/internal-custom</property>
<factor>-1</factor>
<offset>1</offset>
</volume>
<orientation>
<x>1</x>
<y>0</y>

View file

@ -748,15 +748,10 @@
/systems/hydraulic/yellow-psi ge 1500
/sim/model/autopush/connected eq 0
/controls/gear/nws-switch eq 1
/engines/engine[0]/state eq 3
</test>
<test logic="AND" value="1">
position/wow eq 1
hydraulics/tiller/elec-pwr eq 1
/systems/hydraulic/yellow-psi ge 1500
/sim/model/autopush/connected eq 0
/controls/gear/nws-switch eq 1
/engines/engine[1]/state eq 3
<test logic="OR">
/engines/engine[0]/state eq 3
/engines/engine[1]/state eq 3
</test>
</test>
</switch>
@ -789,11 +784,13 @@
<switch name="fcs/steer-rate">
<default value="0"/>
<test logic="OR" value="12">
hydraulics/tiller/hyd-pwr eq 1
<test logic="OR" value="75">
/sim/model/autopush/connected eq 1
/systems/acconfig/autoconfig-running eq 1
</test>
<test logic="OR" value="12">
hydraulics/tiller/hyd-pwr eq 1
</test>
</switch>
<actuator name="fcs/steer-deg">

View file

@ -7,7 +7,7 @@
<channel name="Fuel Pumps and Valves">
<!-- Pumps -->
<switch name="/systems/fuel/pumps/apu-operate">
<switch name="/systems/fuel/pumps/apu-operate"> <!-- DC HOT 1 ? -->
<default value="0"/>
<test logic="AND" value="1">
/systems/fuel/pumps/all-eng-pump-off eq 1

View file

@ -247,11 +247,11 @@
<tcas>
<name>tcas</name>
<number>0</number>
<!--<vertical-range-ft>9900</vertical-range-ft>
<vertical-range-ft>9900</vertical-range-ft>
<lateral-range-nm>30</lateral-range-nm>
<intruder-use-own-alt>1</intruder-use-own-alt>
<intruder-inhibit-alt-ft>380</intruder-inhibit-alt-ft>
<intruder-minimum-own-alt-ft>1700</intruder-minimum-own-alt-ft> uncomment for 2019.3 -->
<intruder-minimum-own-alt-ft>1700</intruder-minimum-own-alt-ft>
</tcas>
<radar>

View file

@ -508,6 +508,16 @@
<legend>AIR</legend>
<pref-height>25</pref-height>
<pref-width>40</pref-width>
<binding>
<command>nasal</command>
<script>mcdu.pagebutton("airport", 0);</script>
<condition>
<greater-than-equals>
<property>systems/electrical/bus/ac-1</property>
<value>110</value>
</greater-than-equals>
</condition>
</binding>
</button>
<button>

View file

@ -508,6 +508,23 @@
<legend>AIR</legend>
<pref-height>25</pref-height>
<pref-width>40</pref-width>
<button>
<row>0</row>
<col>0</col>
<legend>AIR</legend>
<pref-height>25</pref-height>
<pref-width>40</pref-width>
<binding>
<command>nasal</command>
<script>mcdu.pagebutton("airport", 1);</script>
<condition>
<greater-than-equals>
<property>systems/electrical/bus/ac-2</property>
<value>110</value>
</greater-than-equals>
</condition>
</binding>
</button>
</button>
<button>