1
0
Fork 0

Merge branch 'dev' into speed-rewrite

This commit is contained in:
Matthew Maring 2020-04-12 18:08:16 -04:00 committed by GitHub
commit cfff5302d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
57 changed files with 7280 additions and 1030 deletions

View file

@ -205,13 +205,6 @@
<dialog-name>autopilot</dialog-name>
</binding>
</item>
<item>
<label>Route Manager</label>
<binding>
<command>dialog-show</command>
<dialog-name>route-manager</dialog-name>
</binding>
</item>
</menu>
<menu n="102">
<label>DU</label>
@ -432,7 +425,7 @@
<z-offset-max-m type="float">300.0</z-offset-max-m>
</current-view>
<minimum-fg-version>2019.2.0</minimum-fg-version>
<minimum-fg-version>2019.1.2</minimum-fg-version>
</sim>
<consumables>
@ -3911,11 +3904,20 @@
<file>Aircraft/A320-family/Nasal/FMGC/FCU.nas</file>
</fcu>
<fmgc>
<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>
<file>Aircraft/A320-family/Nasal/FMGC/FMGC-c.nas</file>
</fmgc>
<mcdu>
<file>Aircraft/A320-family/Nasal/MCDU/DUPLICATE.nas</file> <!-- dynamic page - init before others as used in various pages -->
<file>Aircraft/A320-family/Nasal/MCDU/DIRTO.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/LATREV.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/VERTREV.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/DEPARTURE.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/ARRIVAL.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>
<file>Aircraft/A320-family/Nasal/MCDU/INITA.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/IRSINIT.nas</file>

View file

@ -1,7 +1,7 @@
# INSTALL
## Prerequisites
Have at least following versions installed:
* FlightGear 2019.1.0 or newer
* FlightGear 2019.2.0 or newer
## Install using ZIP Snapshot
[Download](https://github.com/legoboyvdlp/A320-family/archive/master.zip) the zip file.

View file

@ -37,4 +37,12 @@
</emission>
</animation>
<effect>
<inherits-from>Effects/model-interior-display</inherits-from>
<object-name>lecam.screen</object-name>
<parameters>
<contrast>0.7</contrast>
</parameters>
</effect>
</PropertyList>

File diff suppressed because it is too large Load diff

View file

@ -30,6 +30,14 @@
</emission>
</animation>
<effect>
<inherits-from>Effects/model-interior-display</inherits-from>
<object-name>mcdu1.screen</object-name>
<parameters>
<contrast>0.7</contrast>
</parameters>
</effect>
<animation>
<type>pick</type>
<object-name>BRT</object-name>
@ -276,6 +284,31 @@
</action>
</animation>
<animation>
<type>pick</type>
<object-name>dir</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>mcdu.pagebutton("dirto", 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>L1</object-name>

View file

@ -30,6 +30,14 @@
</emission>
</animation>
<effect>
<inherits-from>Effects/model-interior-display</inherits-from>
<object-name>mcdu2.screen</object-name>
<parameters>
<contrast>0.7</contrast>
</parameters>
</effect>
<animation>
<type>pick</type>
<object-name>BRT</object-name>
@ -276,6 +284,31 @@
</action>
</animation>
<animation>
<type>pick</type>
<object-name>dir</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>mcdu.pagebutton("dirto", 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>L1</object-name>

View file

@ -872,6 +872,579 @@
y="83.814453"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke-width:1px">TEXT</tspan></text>
</g>
<g
id="g1390"
transform="translate(-0.25527898,1.4267237)"
inkscape:label="FPLN"
style="display:inline">
<g
style="display:inline"
id="Simple-9"
inkscape:label="Simple">
<g
inkscape:groupmode="layer"
id="Simple_Center-6"
inkscape:label="Simple_Center" />
<circle
id="path4227-0"
style="fill:#000000;stroke:none"
cx="700.88422"
cy="15.471865"
r="1.5" />
<circle
id="path4229-4"
style="fill:#000000;stroke:none"
cx="763.95813"
cy="15.754708"
r="1.5" />
<circle
id="path4231-7"
style="fill:#000000;stroke:none"
cx="787.43408"
cy="16.320395"
r="1.5" />
<circle
id="path4233-7"
style="fill:#000000;stroke:none"
cx="796.48511"
cy="13.774809"
r="3" />
</g>
<g
style="display:inline"
id="INITA-9"
inkscape:label="INITA" />
<g
style="display:inline"
id="INITB-0"
inkscape:label="INITB" />
<g
style="display:inline"
id="PERFTO-8"
inkscape:label="PERFTO" />
<g
style="display:inline"
id="FPLN"
inkscape:label="FPLN">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;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="750.78857"
y="69.238258"
id="FPLN_Callsign"
transform="scale(0.991516,1.0085566)"
inkscape:label="#text4244"><tspan
sodipodi:role="line"
id="tspan4388"
x="750.78857"
y="69.238258"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">CALLSIG</tspan></text>
<g
inkscape:label="#g3767"
id="FPLN_TMPY_group">
<text
inkscape:label="#text4244"
transform="scale(0.991516,1.0085566)"
id="FPLN_TMPY"
y="69.238258"
x="350.9628"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffff00;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:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffff00;fill-opacity:1"
y="69.238258"
x="350.9628"
id="tspan3617"
sodipodi:role="line">TMPY</tspan></text>
<g
id="FPLN_TMPY_ERASE"
inkscape:label="#g3715">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#bb6100;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="63.16515"
y="773.87396"
id="text3623"
transform="scale(0.991516,1.0085566)"
inkscape:label="#text4244"><tspan
sodipodi:role="line"
id="tspan3625"
x="63.16515"
y="773.87396"
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:start;text-anchor:start;fill:#bb6100;fill-opacity:1">ERASE</tspan></text>
<text
inkscape:label="#text4244"
transform="scale(0.991516,1.0085566)"
id="text3627"
y="717.159"
x="70.001091"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#bb6100;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:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#bb6100;fill-opacity:1"
y="717.159"
x="70.001091"
id="tspan3629"
sodipodi:role="line">TMPY</tspan></text>
<g
id="g4241"
inkscape:label="#g4241"
transform="matrix(1.0000008,0,0,0.99998914,-895.98809,710.38932)"
style="stroke:#bb6100;stroke-opacity:1">
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4480-4"
d="M 952.4036,47.432743 H 923.87395"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 936.70791,32.6968 921.8587,47.4328"
id="path4482-0"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4484-0"
d="M 936.70791,62.1688 921.8587,47.4328"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</g>
<g
id="FPLN_TMPY_INSERT"
inkscape:label="#g3746">
<text
inkscape:label="#text4244"
transform="scale(0.9915153,1.0085573)"
id="text3729"
y="717.15857"
x="970.52771"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#bb6100;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:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:end;text-anchor:end;fill:#bb6100;fill-opacity:1"
y="717.15857"
x="970.52771"
id="tspan3731"
sodipodi:role="line">TMPY</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#bb6100;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="972.33221"
y="773.87335"
id="text3725"
transform="scale(0.99151523,1.0085574)"
inkscape:label="#text4244"><tspan
sodipodi:role="line"
id="tspan3727"
x="972.33221"
y="773.87335"
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:end;text-anchor:end;fill:#bb6100;fill-opacity:1">INSERT</tspan></text>
<g
id="g4324"
inkscape:label="#g4324"
transform="matrix(1.0807108,0,0,1.0807111,-76.371959,450.13459)">
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4490-7"
d="M 998.71909,284.70793 H 970.18944"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 994.54102,294.79468 -20.17351,-20.1735"
id="path4318-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4320-1"
d="m 984.45427,298.97275 -10e-6,-28.52964"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 974.36752,294.79468 20.17349,-20.1735"
id="path4322-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
</g>
</g>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="177.72771"
y="68.861366"
id="FPLN_FROM"
transform="scale(0.991516,1.0085566)"
inkscape:label="#text4244"><tspan
sodipodi:role="line"
id="tspan1240"
x="177.72771"
y="68.861366"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:51.20000076px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">FROM</tspan></text>
</g>
<g
inkscape:label="#g3767"
id="DIRTO_TMPY_group">
<g
id="DIRTO_TMPY_ERASE"
inkscape:label="#g3715">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#bb6100;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="63.16515"
y="773.87396"
id="text174"
transform="scale(0.991516,1.0085566)"
inkscape:label="#text4244"><tspan
sodipodi:role="line"
id="tspan172"
x="63.16515"
y="773.87396"
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:start;text-anchor:start;fill:#bb6100;fill-opacity:1">ERASE</tspan></text>
<text
inkscape:label="#text4244"
transform="scale(0.991516,1.0085566)"
id="text178"
y="717.159"
x="73.163895"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#bb6100;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:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#bb6100;fill-opacity:1"
y="717.159"
x="73.163895"
id="tspan176"
sodipodi:role="line">DIR TO</tspan></text>
<g
id="g186"
inkscape:label="#g4241"
transform="matrix(1.0000008,0,0,0.99998914,-895.98809,710.38932)"
style="stroke:#bb6100;stroke-opacity:1">
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path180"
d="M 952.4036,47.432743 H 923.87395"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 936.70791,32.6968 921.8587,47.4328"
id="path182"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path184"
d="M 936.70791,62.1688 921.8587,47.4328"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</g>
<g
id="g207"
inkscape:label="#g3746">
<text
inkscape:label="#text4244"
transform="scale(0.9915153,1.0085573)"
id="text191"
y="717.15857"
x="937.84546"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#bb6100;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:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:end;text-anchor:end;fill:#bb6100;fill-opacity:1"
y="717.15857"
x="947.84546"
id="tspan189"
sodipodi:role="line">DIR TO</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#bb6100;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="972.33221"
y="773.87335"
id="text195"
transform="scale(0.99151523,1.0085574)"
inkscape:label="#text4244"><tspan
sodipodi:role="line"
id="tspan193"
x="972.33221"
y="773.87335"
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:end;text-anchor:end;fill:#bb6100;fill-opacity:1">INSERT</tspan></text>
<g
id="g205"
inkscape:label="#g4324"
transform="matrix(1.0807108,0,0,1.0807111,-76.371959,450.13459)">
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path197"
d="M 998.71909,284.70793 H 970.18944"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 994.54102,294.79468 -20.17351,-20.1735"
id="path199"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path201"
d="m 984.45427,298.97275 -10e-6,-28.52964"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 974.36752,294.79468 20.17349,-20.1735"
id="path203"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
</g>
</g>
<g
inkscape:label="arrowsDepArr"
id="arrowsDepArr">
<g
id="arrow5L"
inkscape:label="arrow5L"
transform="matrix(1.0000008,0,0,0.99998914,-895.98809,589.53826)"
style="stroke:#bb6100;stroke-opacity:1">
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path301"
d="M 952.4036,47.432743 H 923.87395"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 936.70791,32.6968 921.8587,47.4328"
id="path303"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path305"
d="M 936.70791,62.1688 921.8587,47.4328"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<g
style="stroke:#bb6100;stroke-opacity:1"
transform="matrix(1.0000008,0,0,0.99998914,-895.98809,472.51698)"
inkscape:label="arrow4L"
id="arrow4L">
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 952.4036,47.432743 H 923.87395"
id="path417"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path419"
d="M 936.70791,32.6968 921.8587,47.4328"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 936.70791,62.1688 921.8587,47.4328"
id="path421"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
<g
id="arrow3L"
inkscape:label="arrow3L"
transform="matrix(1.0000008,0,0,0.99998914,-895.98809,353.79358)"
style="stroke:#bb6100;stroke-opacity:1">
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path425"
d="M 952.4036,47.432743 H 923.87395"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 936.70791,32.6968 921.8587,47.4328"
id="path427"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path429"
d="M 936.70791,62.1688 921.8587,47.4328"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<g
style="stroke:#bb6100;stroke-opacity:1"
transform="matrix(1.0000008,0,0,0.99998914,-895.98809,235.49571)"
inkscape:label="arrow2L"
id="arrow2L">
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 952.4036,47.432743 H 923.87395"
id="path433"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path435"
d="M 936.70791,32.6968 921.8587,47.4328"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 936.70791,62.1688 921.8587,47.4328"
id="path437"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
<g
id="arrow1L"
inkscape:label="arrow1L"
transform="matrix(1.0000008,0,0,0.99998914,-895.98809,118.0489)"
style="stroke:#bb6100;stroke-opacity:1">
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path471"
d="M 952.4036,47.432743 H 923.87395"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 936.70791,32.6968 921.8587,47.4328"
id="path473"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path475"
d="M 936.70791,62.1688 921.8587,47.4328"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<g
style="stroke:#bb6100;stroke-opacity:1"
transform="matrix(-1.0000008,0,0,0.99998914,1920.5256,589.53826)"
inkscape:label="arrow5R"
id="arrow5R">
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 952.4036,47.432743 H 923.87395"
id="path479"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path481"
d="M 936.70791,32.6968 921.8587,47.4328"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 936.70791,62.1688 921.8587,47.4328"
id="path483"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
<g
id="arrow4R"
inkscape:label="arrow4R"
transform="matrix(-1.0000008,0,0,0.99998914,1920.5256,472.51698)"
style="stroke:#bb6100;stroke-opacity:1">
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path487"
d="M 952.4036,47.432743 H 923.87395"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 936.70791,32.6968 921.8587,47.4328"
id="path489"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path491"
d="M 936.70791,62.1688 921.8587,47.4328"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<g
style="stroke:#bb6100;stroke-opacity:1"
transform="matrix(-1.0000008,0,0,0.99998914,1920.5256,353.79358)"
inkscape:label="arrow3R"
id="arrow3R">
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 952.4036,47.432743 H 923.87395"
id="path495"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path497"
d="M 936.70791,32.6968 921.8587,47.4328"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 936.70791,62.1688 921.8587,47.4328"
id="path499"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
<g
id="arrow2R"
inkscape:label="arrow2R"
transform="matrix(-1.0000008,0,0,0.99998914,1920.5256,235.49571)"
style="stroke:#bb6100;stroke-opacity:1">
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path503"
d="M 952.4036,47.432743 H 923.87395"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 936.70791,32.6968 921.8587,47.4328"
id="path505"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path507"
d="M 936.70791,62.1688 921.8587,47.4328"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<g
style="stroke:#bb6100;stroke-opacity:1"
transform="matrix(-1.0000008,0,0,0.99998914,1920.5256,118.0489)"
inkscape:label="arrow1R"
id="arrow1R">
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 952.4036,47.432743 H 923.87395"
id="path511"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path513"
d="M 936.70791,32.6968 921.8587,47.4328"
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 936.70791,62.1688 921.8587,47.4328"
id="path515"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
</g>
</g>
<g
inkscape:label="INITA"
id="INITA"

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 135 KiB

View file

@ -37,4 +37,12 @@
</emission>
</animation>
<effect>
<inherits-from>Effects/model-interior-display</inherits-from>
<object-name>ND.screen</object-name>
<parameters>
<contrast>0.7</contrast>
</parameters>
</effect>
</PropertyList>

View file

@ -37,4 +37,12 @@
</emission>
</animation>
<effect>
<inherits-from>Effects/model-interior-display</inherits-from>
<object-name>ND_R.screen</object-name>
<parameters>
<contrast>0.7</contrast>
</parameters>
</effect>
</PropertyList>

View file

@ -5,7 +5,7 @@
# Copyright (c) 2019 Joshua Davidson (Octal450)
var get_local_path = func(file){
var aircraft_dir = split("/", getprop("sim/aircraft-dir"))[-1];
var aircraft_dir = split("/", getprop("/sim/aircraft-dir"))[-1];
return "Aircraft/" ~ aircraft_dir ~ "/Models/Instruments/ND/canvas/"~ file;
};

View file

@ -16,7 +16,7 @@ var A3XXRouteDriver = {
me.update();
},
update: func(){
me.flightplan = flightplan();
me.flightplan = fmgc.flightPlanController.flightplans[2];
},
getNumberOfFlightPlans: func(){1},
getFlightPlanType: func(fpNum){"current"},
@ -25,7 +25,17 @@ var A3XXRouteDriver = {
getWP: func(fpNum, idx){me.flightplan.getWP(idx)},
getPlanModeWP: func(plan_wp_idx){me.flightplan.getWP(plan_wp_idx)},
hasDiscontinuity: func(fpNum, wptID){0},
getListeners: func(){[]},
triggerSignal: func(signal){
setprop(me.signalPath(signal),1);
setprop(me.signalPath(signal),0);
},
signalPath: func(signal){
"autopilot/route-manager/signals/rd-"~ signal;
},
getListeners: func(){[
me.signalPath("fp-added"),
me.signalPath("fp-removed")
]},
shouldUpdate: func 1
};
@ -99,7 +109,8 @@ var MultiA3XXRouteDriver = {
return fp.getWP(idx);
},
triggerSignal: func(signal){
setprop(me.signalPath(signal));
setprop(me.signalPath(signal), 1);
setprop(me.signalPath(signal), 0);
},
signalPath: func(signal){
"autopilot/route-manager/signals/rd-"~ signal;

View file

@ -23,7 +23,7 @@ var SymbolPainter = {
},
getAircraftDir: func(){
if(me.aircraft_dir == nil)
me.aircraft_dir = split("/", getprop("sim/aircraft-dir"))[-1];
me.aircraft_dir = split("/", getprop("/sim/aircraft-dir"))[-1];
return me.aircraft_dir;
},
svgPath: func(file){

View file

@ -13,7 +13,7 @@ setlistener("/nasal/canvas/loaded", func() {
####### LOAD FILES #######
#print("loading files");
(func {
var aircraft_root = getprop("sim/aircraft-dir");
var aircraft_root = getprop("/sim/aircraft-dir");
var load = func(file, name) {
#print("Loading ..." ~ file);

View file

@ -12,9 +12,9 @@ SymbolLayer.add(name, {
type: name, # Symbol type
df_controller: __self__, # controller to use by default -- this one
df_options: { # default configuration options
active_node: "/autopilot/route-manager/active",
current_wp_node: "/autopilot/route-manager/current-wp",
wp_num: "/autopilot/route-manager/route/num",
active_node: "/FMGC/flightplan[2]/active",
current_wp_node: "/FMGC/flightplan[2]/current-wp",
wp_num: "/FMGC/flightplan[2]/num",
display_inactive_rte: 0
}
});
@ -74,12 +74,12 @@ var searchCmd = func {
path = [{},{lon:leg.wp_lon, lat:leg.wp_lat}];
else
path = leg.path();
if(i == (fpSize - 1) and !discontinuity){# WORKAROUND FOR FG BUG
var ltype = leg.wp_type;
var path_l = size(path);
if(ltype != 'runway' and path_l >= 2)
path = subvec(path, 0, 1) ~ subvec(path, path_l - 1, 1);
}
# if(i == (fpSize - 1) and !discontinuity){# WORKAROUND FOR FG BUG -- we don't need it anymore (I think)!
# var ltype = leg.wp_type;
# var path_l = size(path);
# if(ltype != 'runway' and path_l >= 2)
# path = subvec(path, 0, 1) ~ subvec(path, path_l - 1, 1);
# }
coords ~= path;
discontinuity = driver.hasDiscontinuity(idx, leg);
}

View file

@ -19,7 +19,7 @@ canvas.SymbolLayer.add(name, {
.close()
.setStrokeLineWidth(3)
.setColor(1,1,1)
.setScale(1,1);
.setScale(1);
},
vor_symbol: 'Nasal/canvas/map/Airbus/Images/airbus_vor.svg',
airport_symbol: 'Nasal/canvas/map/Airbus/Images/airbus_airport.svg',

View file

@ -58,16 +58,16 @@ var init = func {
var cstr_txt = "\n";
if(alt > 0){
if(alt > 10000)
cstr_txt ~= sprintf('FL%3.0f', int(alt / 100));
cstr_txt ~= sprintf('FL%3d', int(alt / 100));
else
cstr_txt ~= sprintf('%4.0f', int(alt));
cstr_txt ~= sprintf('%4d', int(alt));
}
if(spd > 0){
if(alt > 0) cstr_txt ~= "\n";
if(spd <= 1)
cstr_txt ~= sprintf('%1.2fM', spd);
cstr_txt ~= sprintf('%4.2fM', spd);
else
cstr_txt ~= sprintf('%3.0fKT', int(spd));
cstr_txt ~= sprintf('%3dKT', int(spd));
}
me.text_alt = wp_group.createChild("text", "wp-alt-text-" ~ me.model.idx)
.setDrawMode( canvas.Text.TEXT )
@ -127,7 +127,7 @@ var draw = func{
}
if(me.model.is_departure or me.model.is_destination){
var prop = (me.model.is_departure ? 'departure' : 'destination');
var rwy = getprop("autopilot/route-manager/"~prop~"/runway");
var rwy = getprop("/autopilot/route-manager/"~prop~"/runway");
if(rwy != nil and size(rwy) > 0){
me.wp_sym.hide();
} else {

View file

@ -46,12 +46,12 @@ canvas.NDStyles["Airbus"] = {
# that the lateral flight mode is managed.
# You can easily override these options before creating the ND, example:
# canvas.NDStyles["Airbus"].options.defaults.fplan_active = "my/autpilot/f-plan/active"
fplan_active: "autopilot/route-manager/active",
fplan_active: "/FMGC/flightplan[2]/active",
lat_ctrl: "/it-autoflight/output/lat",
managed_val: 1,
ver_ctrl: "/it-autoflight/output/vert",
spd_ctrl: "/flight-management/control/spd-ctrl",
current_wp: "/autopilot/route-manager/current-wp",
current_wp: "/FMGC/flightplan[2]/current-wp",
ap1: "/it-autoflight/output/ap1",
ap2: "/it-autoflight/output/ap2",
nav1_frq: "/instrumentation/nav[0]/frequencies/selected-mhz",
@ -740,11 +740,11 @@ canvas.NDStyles["Airbus"] = {
id: "wpActiveId",
impl: {
init: func(nd,symbol),
predicate: func(nd) getprop("autopilot/route-manager/wp/id") != nil and
getprop("autopilot/route-manager/active") and
predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg") != nil and
getprop("FMGC/flightplan[2]/active") and
nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
is_true: func(nd) {
nd.symbols.wpActiveId.setText(getprop("autopilot/route-manager/wp/id"));
nd.symbols.wpActiveId.setText(getprop("/FMGC/flightplan[2]/current-leg"));
nd.symbols.wpActiveId.show();
},
is_false: func(nd) nd.symbols.wpActiveId.hide(),
@ -754,12 +754,16 @@ canvas.NDStyles["Airbus"] = {
id: "wpActiveCrs",
impl: {
init: func(nd,symbol),
predicate: func(nd) getprop("autopilot/route-manager/wp/id") != nil and
getprop("autopilot/route-manager/active") and
predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg") != nil and
getprop("FMGC/flightplan[2]/active") and
nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
is_true: func(nd) {
#var cur_wp = getprop("autopilot/route-manager/current-wp");
var deg = int(getprop("autopilot/route-manager/wp/bearing-deg"));
if (nd.get_switch("toggle_true_north")) {
var deg = math.round(getprop("/FMGC/flightplan[2]/current-leg-course"));
} else {
var deg = math.round(getprop("/FMGC/flightplan[2]/current-leg-course-mag"));
}
nd.symbols.wpActiveCrs.setText((deg or "")~"°");
nd.symbols.wpActiveCrs.show();
},
@ -770,11 +774,11 @@ canvas.NDStyles["Airbus"] = {
id: "wpActiveDist",
impl: {
init: func(nd,symbol),
predicate: func(nd) getprop("autopilot/route-manager/wp/dist") != nil and
getprop("autopilot/route-manager/active") and
predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg-dist") != nil and
getprop("FMGC/flightplan[2]/active") and
nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
is_true: func(nd) {
var dst = getprop("autopilot/route-manager/wp/dist");
var dst = getprop("/FMGC/flightplan[2]/current-leg-dist");
nd.symbols.wpActiveDist.setText(sprintf("%3.01f",dst));
nd.symbols.wpActiveDist.show();
},
@ -785,10 +789,10 @@ canvas.NDStyles["Airbus"] = {
id: "wpActiveDistLbl",
impl: {
init: func(nd,symbol),
predicate: func(nd) getprop("autopilot/route-manager/wp/dist") != nil and getprop("autopilot/route-manager/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg-dist") != nil and getprop("FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
is_true: func(nd) {
nd.symbols.wpActiveDistLbl.show();
if(getprop("autopilot/route-manager/wp/dist") > 1000)
if(getprop("/FMGC/flightplan[2]/current-leg-dist") > 1000)
nd.symbols.wpActiveDistLbl.setText(" NM");
},
is_false: func(nd) nd.symbols.wpActiveDistLbl.hide(),
@ -798,7 +802,7 @@ canvas.NDStyles["Airbus"] = {
id: "eta",
impl: {
init: func(nd,symbol),
predicate: func(nd) getprop("autopilot/route-manager/wp/eta") != nil and getprop("autopilot/route-manager/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
predicate: func(nd) getprop("autopilot/route-manager/wp/eta") != nil and getprop("FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]),
is_true: func(nd) {
var etaSec = getprop("sim/time/utc/day-seconds")+
getprop("autopilot/route-manager/wp/eta-seconds");
@ -1679,7 +1683,7 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered")),
is_true: func(nd){
var active = getprop("autopilot/route-manager/active");
var active = getprop("FMGC/flightplan[2]/active");
var lat_ctrl = getprop(nd.options.defaults.lat_ctrl);
var managed_v = nd.options.defaults.managed_val;
var is_managed = (lat_ctrl == managed_v);
@ -1708,7 +1712,7 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered")),
is_true: func(nd){
var active = getprop("autopilot/route-manager/active");
var active = getprop("FMGC/flightplan[2]/active");
var lat_ctrl = getprop(nd.options.defaults.lat_ctrl);
var managed_v = nd.options.defaults.managed_val;
var is_managed = (lat_ctrl == managed_v);
@ -1737,7 +1741,7 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered")),
is_true: func(nd){
var active = getprop("autopilot/route-manager/active");
var active = getprop("FMGC/flightplan[2]/active");
var lat_ctrl = getprop(nd.options.defaults.lat_ctrl);
var managed_v = nd.options.defaults.managed_val;
var is_managed = (lat_ctrl == managed_v);
@ -1766,7 +1770,7 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered")),
is_true: func(nd){
var active = getprop("autopilot/route-manager/active");
var active = getprop("FMGC/flightplan[2]/active");
var lat_ctrl = getprop(nd.options.defaults.lat_ctrl);
var managed_v = nd.options.defaults.managed_val;
var is_managed = (lat_ctrl == managed_v);
@ -1795,7 +1799,7 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol),
predicate: func(nd) (nd.in_mode("toggle_display_mode", ["MAP", "PLAN"])),
is_true: func(nd){
var active = getprop("autopilot/route-manager/active");
var active = getprop("FMGC/flightplan[2]/active");
var lat_ctrl = getprop(nd.options.defaults.lat_ctrl);
var managed_v = nd.options.defaults.managed_val;
var is_managed = (lat_ctrl == managed_v);

View file

@ -37,4 +37,12 @@
</emission>
</animation>
<effect>
<inherits-from>Effects/model-interior-display</inherits-from>
<object-name>pfd1.screen</object-name>
<parameters>
<contrast>0.7</contrast>
</parameters>
</effect>
</PropertyList>

View file

@ -37,4 +37,12 @@
</emission>
</animation>
<effect>
<inherits-from>Effects/model-interior-display</inherits-from>
<object-name>pfd2.screen</object-name>
<parameters>
<contrast>0.7</contrast>
</parameters>
</effect>
</PropertyList>

View file

@ -37,4 +37,12 @@
</emission>
</animation>
<effect>
<inherits-from>Effects/model-interior-display</inherits-from>
<object-name>uecam.screen</object-name>
<parameters>
<contrast>0.7</contrast>
</parameters>
</effect>
</PropertyList>

View file

@ -136,14 +136,14 @@ var phaseLoop = func() {
if (eng == "IAE") {
eprlim = getprop("controls/engines/epr-limit");
if ((!getprop("controls/engines/engine[0]/reverser") and !getprop("controls/engines/engine[1]/reverser")) and (((pts.Controls.Engines.Engine1.throttle.getValue() >= 0.8 or pts.Controls.Engines.Engine2.throttle.getValue() >= 0.8) and pts.PTSSystems.Thrust.flex.getBoolValue()) or (pts.Controls.Engines.Engine1.throttle.getValue() == 1.0 or pts.Controls.Engines.Engine2.throttle.getValue() == 1.0))) {
if ((!getprop("controls/engines/engine[0]/reverser") and !getprop("controls/engines/engine[1]/reverser")) and (((pts.Controls.Engines.Engine1.throttle.getValue() >= 0.78 or pts.Controls.Engines.Engine2.throttle.getValue() >= 0.78) and pts.PTSSystems.Thrust.flex.getBoolValue()) or (pts.Controls.Engines.Engine1.throttle.getValue() == 1.0 or pts.Controls.Engines.Engine2.throttle.getValue() == 1.0))) {
FWC.toPower.setBoolValue(1);
} else {
FWC.toPower.setBoolValue(0);
}
} else {
n1lim = getprop("controls/engines/n1-limit");
if ((!getprop("controls/engines/engine[0]/reverser") and !getprop("controls/engines/engine[1]/reverser")) and (((pts.Controls.Engines.Engine1.throttle.getValue() >= 0.8 or pts.Controls.Engines.Engine2.throttle.getValue() >= 0.8) and pts.PTSSystems.Thrust.flex.getBoolValue()) or (pts.Controls.Engines.Engine1.throttle.getValue() == 1.0 or pts.Controls.Engines.Engine2.throttle.getValue() == 1.0))) {
if ((!getprop("controls/engines/engine[0]/reverser") and !getprop("controls/engines/engine[1]/reverser")) and (((pts.Controls.Engines.Engine1.throttle.getValue() >= 0.78 or pts.Controls.Engines.Engine2.throttle.getValue() >= 0.78) and pts.PTSSystems.Thrust.flex.getBoolValue()) or (pts.Controls.Engines.Engine1.throttle.getValue() == 1.0 or pts.Controls.Engines.Engine2.throttle.getValue() == 1.0))) {
FWC.toPower.setBoolValue(1);
} else {
FWC.toPower.setBoolValue(0);

View file

@ -48,10 +48,10 @@ var Radio = {
};
var FPLN = {
active: props.globals.getNode("autopilot/route-manager/active", 1),
active: props.globals.getNode("/FMGC/flightplan[2]/active", 1),
activeTemp: 0,
currentCourse: 0,
currentWP: props.globals.getNode("autopilot/route-manager/current-wp", 1),
currentWP: props.globals.getNode("/FMGC/flightplan[2]/current-wp", 1),
currentWPTemp: 0,
deltaAngle: 0,
deltaAngleRad: 0,
@ -59,12 +59,10 @@ var FPLN = {
maxBank: 0,
maxBankLimit: 0,
nextCourse: 0,
num: props.globals.getNode("autopilot/route-manager/route/num", 1),
numTemp: 0,
R: 0,
radius: 0,
turnDist: 0,
wp0Dist: props.globals.getNode("autopilot/route-manager/wp/dist", 1),
wp0Dist: props.globals.getNode("/FMGC/flightplan[2]/current-leg-dist", 1),
wpFlyFrom: 0,
wpFlyTo: 0,
};
@ -376,7 +374,6 @@ var ITAF = {
Velocity.trueAirspeedKtTemp = Velocity.trueAirspeedKt.getValue();
FPLN.activeTemp = FPLN.active.getValue();
FPLN.currentWPTemp = FPLN.currentWP.getValue();
FPLN.numTemp = FPLN.num.getValue();
# Bank Limit
if (Velocity.trueAirspeedKtTemp >= 420) {
@ -391,25 +388,25 @@ var ITAF = {
# If in LNAV mode and route is not longer active, switch to HDG HLD
if (Output.lat.getValue() == 1) { # Only evaulate the rest of the condition if we are in LNAV mode
if (FPLN.num.getValue() == 0 or !FPLN.active.getBoolValue()) {
if (flightPlanController.num[2].getValue() == 0 or !FPLN.active.getBoolValue()) {
me.setLatMode(3);
}
}
# Waypoint Advance Logic
if (FPLN.numTemp > 0 and FPLN.activeTemp == 1) {
if ((FPLN.currentWPTemp + 1) < FPLN.numTemp) {
if (flightPlanController.num[2].getValue() > 0 and FPLN.activeTemp == 1) {
if ((FPLN.currentWPTemp + 1) < flightPlanController.num[2].getValue()) {
Velocity.groundspeedMps = Velocity.groundspeedKt.getValue() * 0.5144444444444;
FPLN.wpFlyFrom = FPLN.currentWPTemp;
if (FPLN.wpFlyFrom < 0) {
FPLN.wpFlyFrom = 0;
}
FPLN.currentCourse = getprop("autopilot/route-manager/route/wp[" ~ FPLN.wpFlyFrom ~ "]/leg-bearing-true-deg"); # Best left at getprop
FPLN.currentCourse = getprop("/FMGC/flightplan[2]/wp[" ~ FPLN.wpFlyFrom ~ "]/course"); # Best left at getprop
FPLN.wpFlyTo = FPLN.currentWPTemp + 1;
if (FPLN.wpFlyTo < 0) {
FPLN.wpFlyTo = 0;
}
FPLN.nextCourse = getprop("autopilot/route-manager/route/wp[" ~ FPLN.wpFlyTo ~ "]/leg-bearing-true-deg"); # Best left at getprop
FPLN.nextCourse = getprop("/FMGC/flightplan[2]/wp[" ~ FPLN.wpFlyTo ~ "]/course"); # Best left at getprop
FPLN.maxBankLimit = Internal.bankLimit.getValue();
FPLN.deltaAngle = math.abs(geo.normdeg180(FPLN.currentCourse - FPLN.nextCourse));
@ -431,7 +428,11 @@ var ITAF = {
Internal.lnavAdvanceNm.setValue(FPLN.turnDist);
if (FPLN.wp0Dist.getValue() <= FPLN.turnDist) {
FPLN.currentWP.setValue(FPLN.currentWPTemp + 1);
if (flightPlanController.currentToWptIndex.getValue() < 1) {
flightPlanController.currentToWptIndex.setValue(1);
} else if (flightPlanController.num[2].getValue() > 2) { # The Airbus doesn't display anything past the previous waypoint after advancing
flightPlanController.autoSequencing();
}
}
}
}
@ -600,7 +601,7 @@ var ITAF = {
Custom.showHdg.setBoolValue(1);
me.armTextCheck();
} else if (n == 1) {
if (FPLN.num.getValue() > 0 and FPLN.active.getBoolValue()) {
if (flightPlanController.num[2].getValue() > 0 and FPLN.active.getBoolValue()) {
Output.lnavArm.setBoolValue(1);
Custom.showHdg.setBoolValue(0);
me.armTextCheck();
@ -647,7 +648,10 @@ var ITAF = {
Text.vert.setValue("ALT CAP");
} else if (n == 4) { # FLCH
Output.apprArm.setBoolValue(0);
if (abs(Input.altDiff) >= 125) { # SPD CLB or SPD DES
Output.vert.setValue(1);
Internal.alt.setValue(Input.alt.getValue());
Internal.altDiff = Internal.alt.getValue() - Position.indicatedAltitudeFt.getValue();
if (abs(Internal.altDiff) >= 250) { # SPD CLB or SPD DES
if (Input.alt.getValue() >= Position.indicatedAltitudeFt.getValue()) { # Usually set Thrust Mode Selector, but we do it now due to timer lag
Text.vert.setValue("SPD CLB");
} else {
@ -734,7 +738,7 @@ var ITAF = {
}
},
checkLNAV: func(t) {
if (FPLN.num.getValue() > 0 and FPLN.active.getBoolValue() and Position.gearAglFt.getValue() >= 30) {
if (flightPlanController.num[2].getValue() > 0 and FPLN.active.getBoolValue() and Position.gearAglFt.getValue() >= 30) {
me.activateLNAV();
} else if (Output.lat.getValue() != 1 and t != 1) {
Output.lnavArm.setBoolValue(1);

View file

@ -250,10 +250,10 @@ var masterFMGC = maketimer(0.2, func {
setprop("FMGC/status/phase", 5);
}
if (getprop("autopilot/route-manager/route/num") > 0 and getprop("autopilot/route-manager/active") == 1 and getprop("autopilot/route-manager/distance-remaining-nm") <= 15) {
setprop("FMGC/internal/decel", 1);
} else if (getprop("FMGC/internal/decel") == 1 and (phase == 0 or phase == 6)) {
setprop("FMGC/internal/decel", 0);
if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and flightPlanController.arrivalDist <= 15) {
setprop("/FMGC/internal/decel", 1);
} else if (getprop("/FMGC/internal/decel") == 1 and (phase == 0 or phase == 6)) {
setprop("/FMGC/internal/decel", 0);
}
#handle go-around
@ -477,6 +477,7 @@ var reset_FMGC = func {
alt = getprop("it-autoflight/input/alt");
ITAF.init();
FMGCinit();
flightPlanController.reset();
mcdu.MCDU_reset(0);
mcdu.MCDU_reset(1);
setprop("it-autoflight/input/fd1", fd1);

551
Nasal/FMGC/flightplan.nas Normal file
View file

@ -0,0 +1,551 @@
# A3XX FMGC Flightplan Driver
# Copyright (c) 2019 Jonathan Redpath (2019)
var wpDep = nil;
var wpArr = nil;
var pos = nil;
var geoPosPrev = geo.Coord.new();
var currentLegCourseDist = nil;
var courseDistanceFrom = nil;
var courseDistanceFromPrev = nil;
var sizeWP = nil;
var magTrueError = 0;
# Props.getNode
var magHDG = props.globals.getNode("/orientation/heading-magnetic-deg", 1);
var trueHDG = props.globals.getNode("/orientation/heading-deg", 1);
var FMGCdep = props.globals.getNode("/FMGC/internal/dep-arpt", 1);
var FMGCarr = props.globals.getNode("/FMGC/internal/arr-arpt", 1);
var toFromSet = props.globals.getNode("/FMGC/internal/tofrom-set", 1);
# Props.initNode
var wpID = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/id", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/id", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/id", "", "STRING")]];
var wpLat = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/lat", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/lat", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/lat", 0, "DOUBLE")]];
var wpLon = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/lon", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/lon", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/lon", 0, "DOUBLE")]];
var wpCourse = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/course", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/course", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/course", 0, "DOUBLE")]];
var wpDistance = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/distance", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/distance", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/distance", 0, "DOUBLE")]];
var wpCoursePrev = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/course-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/course-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/course-from-prev", 0, "DOUBLE")]];
var wpDistancePrev = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/distance-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/distance-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/distance-from-prev", 0, "DOUBLE")]];
var flightPlanController = {
flightplans: [createFlightplan(), createFlightplan(), createFlightplan()],
temporaryFlag: [0, 0],
# These flags are only for the main flgiht-plan
active: props.globals.initNode("/FMGC/flightplan[2]/active", 0, "BOOL"),
currentToWpt: nil, # container for the current TO waypoint ghost
currentToWptIndex: props.globals.initNode("/FMGC/flightplan[2]/current-wp", 0, "INT"),
currentToWptID: props.globals.initNode("/FMGC/flightplan[2]/current-leg", "", "STRING"),
courseToWpt: props.globals.initNode("/FMGC/flightplan[2]/current-leg-course", 0, "DOUBLE"),
courseMagToWpt: props.globals.initNode("/FMGC/flightplan[2]/current-leg-course-mag", 0, "DOUBLE"),
distToWpt: props.globals.initNode("/FMGC/flightplan[2]/current-leg-dist", 0, "DOUBLE"),,
distanceToDest: [0, 0, 0],
num: [props.globals.initNode("/FMGC/flightplan[0]/num", 0, "INT"), props.globals.initNode("/FMGC/flightplan[1]/num", 0, "INT"), props.globals.initNode("/FMGC/flightplan[2]/num", 0, "INT")],
arrivalIndex: [0, 0, 0],
arrivalDist: 0,
_arrivalDist: 0,
fromWptTime: nil,
fromWptAlt: nil,
_timeTemp: nil,
_altTemp: nil,
reset: func() {
me.temporaryFlag[0] = 0;
me.temporaryFlag[1] = 0;
me.resetFlightplan(0);
me.resetFlightplan(1);
me.resetFlightplan(2);
},
resetFlightplan: func(n) {
me.flightplans[n].cleanPlan();
me.flightplans[n].departure = nil;
me.flightplans[n].destination = nil;
},
createTemporaryFlightPlan: func(n) {
me.resetFlightplan(n);
me.flightplans[n] = me.flightplans[2].clone();
me.temporaryFlag[n] = 1;
if (canvas_mcdu.myDirTo[n] != nil) {
canvas_mcdu.myDirTo[n].updateTmpy();
}
me.flightPlanChanged(n);
},
destroyTemporaryFlightPlan: func(n, a) { # a = 1 activate, a = 0 erase
if (a == 1) {
flightPlanTimer.stop();
me.resetFlightplan(2);
me.flightplans[2] = me.flightplans[n].clone();
me.flightPlanChanged(2);
flightPlanTimer.start();
}
me.resetFlightplan(n);
me.temporaryFlag[n] = 0;
if (canvas_mcdu.myDirTo[n] != nil) {
canvas_mcdu.myDirTo[n].updateTmpy();
}
},
updateAirports: func(dep, arr, plan) {
me.resetFlightplan(plan);
me.flightplans[plan].departure = airportinfo(dep);
me.flightplans[plan].destination = airportinfo(arr);
if (plan == 2) {
me.currentToWptIndex.setValue(0);
}
me.addDiscontinuity(1, plan);
#todo if plan = 2, kill any tmpy flightplan
me.flightPlanChanged(plan);
},
autoSequencing: 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;
}
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")) {
me.fromWptAlt = "FL" ~ math.round(me._altTemp / 100);
} else {
if (me._altTemp > 0) {
me.fromWptAlt = math.round(me._altTemp);
} else {
me.fromWptAlt = "M" ~ math.round(me._altTemp);
}
}
# todo setlistener on sim/time/warp to recompute predictions
if (me.num[2].getValue() > 2) {
if (me.temporaryFlag[0] == 1 and wpID[0][0] == wpID[2][0]) {
me.deleteWP(0, 0);
}
if (me.temporaryFlag[1] == 1 and wpID[1][0] == wpID[2][0]) {
me.deleteWP(0, 1);
}
me.deleteWP(0, 2, 0, 1);
}
},
# for these two remember to call flightPlanChanged
addDiscontinuity: func(index, plan) {
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);
}
} else {
if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY") {
me.flightplans[plan].insertWP(createDiscontinuity(), index);
}
}
},
insertPPOS: func(n) {
me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "PPOS"), 0);
},
insertTP: func(n) {
me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "T-P"), 1);
},
directTo: func(waypointGhost, plan) {
if (me.flightplans[plan].indexOfWP(waypointGhost) == -1) {
me.insertTP(plan);
me.flightplans[plan].insertWP(createWPFrom(waypointGhost), 2);
me.addDiscontinuity(3, plan);
me.deleteWP(0, plan);
} else {
var timesToDelete = me.flightplans[plan].indexOfWP(waypointGhost); # delete four times, so on last iteration it equals one and then goes to zero, leave it without subtracting one
while (timesToDelete > 1) {
me.deleteWP(1, plan, 1);
timesToDelete -= 1;
}
me.insertTP(plan);
# we want to delete the intermediate waypoints up to but not including the waypoint. Leave index 0, we delete it later.
# example - waypoint dirto is index 5, we want to delete indexes 1 -> 4. 5 - 1 = 4.
# so four individual deletions. Delete index 1 four times.
}
me.flightPlanChanged(plan);
var curAircraftPosDirTo = geo.aircraft_position();
canvas_mcdu.myDirTo[plan].updateDist(me.flightplans[plan].getWP(1).courseAndDistanceFrom(curAircraftPosDirTo)[1]);
},
deleteWP: func(index, n, a = 0, s = 0) { # a = 1, means adding a waypoint via deleting intermediate. s = 1, means autosequencing
var wp = wpID[n][index].getValue();
if (((s == 0 and left(wp, 4) != FMGCdep.getValue() and left(wp, 4) != FMGCarr.getValue()) or (s == 1)) and me.flightplans[n].getPlanSize() > 2) {
if (me.flightplans[n].getWP(index).id != "DISCONTINUITY" and a == 0) { # if it is a discont, don't make a new one
me.flightplans[n].deleteWP(index);
if (me.flightplans[n].getWP(index) != nil and s == 0) {
if (me.flightplans[n].getWP(index).id != "DISCONTINUITY") { # else, if the next one isn't a discont, add one
me.addDiscontinuity(index, n);
}
}
} else {
me.flightplans[n].deleteWP(index);
}
me.flightPlanChanged(n);
canvas_nd.A3XXRouteDriver.triggerSignal("fp-removed");
return 2;
} else {
return 1;
}
},
insertAirport: func(text, index, plan, override = 0, overrideIndex = -1) {
if (index == 0) {
return 1;
}
var airport = findAirportsByICAO(text);
if (size(airport) == 0) {
return 0;
}
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;
}
} 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;
}
}
} elsif (size(airport) >= 1) {
if (canvas_mcdu.myDuplicate[plan] != nil) {
canvas_mcdu.myDuplicate[plan].del();
}
canvas_mcdu.myDuplicate[plan] = nil;
canvas_mcdu.myDuplicate[plan] = mcdu.duplicateNamesPage.new(airport, index, 0, plan);
setprop("MCDU[" ~ plan ~ "]/page", "DUPLICATENAMES");
return 2;
}
},
insertFix: func(text, index, plan, override = 0, overrideIndex = -1) { # override - means always choose [0]
if (index == 0) {
return 1;
}
var fix = findFixesByID(text);
if (size(fix) == 0) {
return 0;
}
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;
}
} 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;
}
}
} elsif (size(fix) >= 1) {
if (canvas_mcdu.myDuplicate[plan] != nil) {
canvas_mcdu.myDuplicate[plan].del();
}
canvas_mcdu.myDuplicate[plan] = nil;
canvas_mcdu.myDuplicate[plan] = mcdu.duplicateNamesPage.new(fix, index, 0, plan);
setprop("MCDU[" ~ plan ~ "]/page", "DUPLICATENAMES");
return 2;
}
},
insertLatLonFix: func(text, index, plan) {
if (index == 0) {
return 1;
}
var lat = split("/", text)[0];
var lon = split("/", text)[1];
var latDecimal = mcdu.stringToDegrees(lat, "lat");
var lonDecimal = mcdu.stringToDegrees(lon, "lon");
if (latDecimal > 90 or latDecimal < -90 or lonDecimal > 180 or lonDecimal < -180) {
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 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) {
if (canvas_mcdu.myDuplicate[plan] != nil) {
canvas_mcdu.myDuplicate[plan].del();
}
canvas_mcdu.myDuplicate[plan] = nil;
canvas_mcdu.myDuplicate[plan] = mcdu.duplicateNamesPage.new(navaid, index, 1, plan);
setprop("MCDU[" ~ plan ~ "]/page", "DUPLICATENAMES");
return 2;
}
},
scratchpad: func(text, index, plan) { # return 0 not in database, 1 not allowed, 2 success, 3 = not allowed due to dir to
if (mcdu.dirToFlag) {
return 3;
}
if (!fmgc.flightPlanController.temporaryFlag[plan]) {
if (text == "CLR" and me.flightplans[2].getWP(index).wp_name == "DISCONTINUITY") {
var thePlan = 2;
} else {
fmgc.flightPlanController.createTemporaryFlightPlan(plan);
var thePlan = plan;
}
} else {
var thePlan = plan;
}
if (text == "CLR") {
return me.deleteWP(index, thePlan, 0);
} elsif (size(text) == 16) {
return me.insertLatLonFix(text, index, thePlan);
} elsif (size(text) == 5) {
return me.insertFix(text, index, thePlan);
} elsif (size(text) == 4) {
return me.insertAirport(text, index, thePlan);
} elsif (size(text) == 3 or size(text) == 2) {
return me.insertNavaid(text, index, thePlan);
} else {
return 1;
}
},
flightPlanChanged: func(n) {
sizeWP = size(wpID[n]);
for (var counter = sizeWP; counter < me.flightplans[n].getPlanSize(); counter += 1) { # create new properties if they are required
append(wpID[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/text", "", "STRING"));
append(wpLat[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/lat", 0, "DOUBLE"));
append(wpLon[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/lon", 0, "DOUBLE"));
append(wpCourse[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/course", 0, "DOUBLE"));
append(wpDistance[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/distance", 0, "DOUBLE"));
append(wpCoursePrev[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/course-from-prev", 0, "DOUBLE"));
append(wpDistancePrev[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/distance-from-prev", 0, "DOUBLE"));
}
me.updatePlans();
canvas_nd.A3XXRouteDriver.triggerSignal("fp-added");
},
updatePlans: func() {
me.updateCurrentWaypoint();
me._arrivalDist = 0;
for (var n = 0; n <= 2; n += 1) {
for (var wpt = 0; wpt < me.flightplans[n].getPlanSize(); wpt += 1) { # Iterate through the waypoints and update their data
var curAircraftPos = geo.aircraft_position(); # don't want to get this corrupted so make sure it is a local variable
var waypointHashStore = me.flightplans[n].getWP(wpt);
courseDistanceFrom = waypointHashStore.courseAndDistanceFrom(curAircraftPos);
wpID[n][wpt].setValue(waypointHashStore.wp_name);
wpLat[n][wpt].setValue(waypointHashStore.wp_lat);
wpLon[n][wpt].setValue(waypointHashStore.wp_lon);
wpCourse[n][wpt].setValue(waypointHashStore.courseAndDistanceFrom(curAircraftPos)[0]);
wpDistance[n][wpt].setValue(waypointHashStore.courseAndDistanceFrom(curAircraftPos)[1]);
if (wpt == 1) {
if (me.flightplans[n].getWP(wpt).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt).wp_type != "vectors" and me.flightplans[n].getWP(wpt).wp_type != "hdgToAlt" and wpt <= me.arrivalIndex[n]) {
me._arrivalDist += courseDistanceFrom[1]; # distance to next waypoint, therafter to end of flightplan
}
}
if (left(wpID[n][wpt].getValue(), 4) == FMGCarr.getValue() and wpt != 0) {
if (me.arrivalIndex[n] != wpt) {
me.arrivalIndex[n] = wpt;
}
}
if (wpt > 0) {
geoPosPrev.set_latlon(me.flightplans[n].getWP(wpt - 1).lat, me.flightplans[n].getWP(wpt - 1).lon);
courseDistanceFromPrev = waypointHashStore.courseAndDistanceFrom(geoPosPrev);
wpCoursePrev[n][wpt].setValue(courseDistanceFromPrev[0]);
wpDistancePrev[n][wpt].setValue(courseDistanceFromPrev[1]);
if (wpt > 1) {
if (me.flightplans[n].getWP(wpt - 1).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt - 1).wp_type != "vectors" and me.flightplans[n].getWP(wpt - 1).wp_type != "hdgToAlt" and me.flightplans[n].getWP(wpt).wp_type != "vectors" and me.flightplans[n].getWP(wpt).wp_type != "hdgToAlt" and wpt <= me.arrivalIndex[n]) {
me._arrivalDist += courseDistanceFromPrev[1]; # todo - buggy. Neglect discontinuity
}
}
} else {
# use PPOS for the first waypoint
wpCoursePrev[n][wpt].setValue(courseDistanceFrom[0]);
wpDistancePrev[n][wpt].setValue(courseDistanceFrom[1]);
}
if (left(wpID[n][wpt].getValue(), 4) == FMGCarr.getValue() and wpt != 0) {
if (me.arrivalIndex[n] != wpt) { # don't merge line 397 and 398 if statements
if (canvas_mcdu.myFpln[0] != nil) {
canvas_mcdu.myFpln[0].destInfo();
}
if (canvas_mcdu.myFpln[1] != nil) {
canvas_mcdu.myFpln[1].destInfo();
}
}
}
}
}
me.arrivalDist = me._arrivalDist;
me.updateMCDUDriver(n);
},
updateCurrentWaypoint: func() {
for (var india = 0; india <= 2; india += 1) {
if (toFromSet.getBoolValue() and me.flightplans[india].departure != nil and me.flightplans[india].destination != nil) { # check if flightplan exists
var curAircraftPos = geo.aircraft_position(); # don't want to get this corrupted so make sure it is a local variable
if (india == 2) { # main plan
if (!me.active.getBoolValue()) {
me.active.setValue(1);
}
if (me.currentToWptIndex.getValue() > me.flightplans[india].getPlanSize()) {
me.currentToWptIndex.setValue(me.flightplans[india].getPlanSize());
}
me.currentToWpt = me.flightplans[india].getWP(me.currentToWptIndex.getValue());
if (me.currentToWptID.getValue() != me.currentToWpt.wp_name) {
me.currentToWptID.setValue(me.currentToWpt.wp_name);
}
me.courseToWpt.setValue(me.currentToWpt.courseAndDistanceFrom(curAircraftPos)[0]);
me.distToWpt.setValue(me.currentToWpt.courseAndDistanceFrom(curAircraftPos)[1]);
magTrueError = magHDG.getValue() - trueHDG.getValue();
me.courseMagToWpt.setValue(me.courseToWpt.getValue() + magTrueError);
}
if (me.num[india].getValue() != me.flightplans[india].getPlanSize()) {
me.num[india].setValue(me.flightplans[india].getPlanSize());
}
} else {
if (india == 2) {
if (me.active.getBoolValue()) {
me.active.setValue(0);
}
if (me.currentToWptID.getValue() != "") {
me.currentToWptID.setValue("");
}
}
if (me.num[india].getValue() != 0) {
me.num[india].setValue(0);
}
}
}
},
updateMCDUDriver: func() {
for (var i = 0; i <= 1; i += 1) {
if (canvas_mcdu.myFpln[i] != nil) {
canvas_mcdu.myFpln[i].updatePlan();
}
if (canvas_mcdu.myDirTo[i] != nil) {
canvas_mcdu.myDirTo[i].updateFromFpln();
}
}
},
};
var flightPlanTimer = maketimer(0.1, flightPlanController, flightPlanController.updatePlans);

526
Nasal/MCDU/ARRIVAL.nas Normal file
View file

@ -0,0 +1,526 @@
var arrivalPage = {
title: [nil, nil, nil],
subtitle: [nil, 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"],
arrAirport: nil,
runways: nil,
selectedApproach: nil,
selectedVIA: nil,
selectedSTAR: nil,
selectedTransition: nil,
stars: nil,
transitions: nil,
vias: nil,
computer: nil,
enableScrollApproach: 0,
enableScrollStars: 0,
scrollApproach: 0,
scrollStars: 0,
activePage: 0, # runways, stars, trans
hasPressNoTrans: 0, # temporary
_approaches: nil,
_stars: nil,
_transitions: nil,
new: func(icao, computer) {
var lr = {parents:[arrivalPage]};
lr.id = icao;
lr.computer = computer;
lr._setupPageWithData();
return lr;
},
del: func() {
return nil;
},
_setupPageWithData: func() {
me.title = ["ARRIVAL", " TO ", left(me.id, 4)];
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[2].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
}
if (fmgc.flightPlanController.flightplans[2].star != nil) {
me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star;
}
} else {
if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach;
} elsif (fmgc.flightPlanController.flightplans[2].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
}
if (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
me.selectedSTAR = fmgc.flightPlanController.flightplans[me.computer].star;
} elsif (fmgc.flightPlanController.flightplans[2].star != nil) {
me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star;
}
}
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.L6 = [" RETURN END", nil, "wht"];
} else {
me.L6 = [" F-PLN", " TMPY", "yel"];
me.arrowsColour[0][5] = "yel";
}
if (me.activePage == 0) {
me.updateApproaches();
} else {
me.updateSTARs();
}
me.updateActiveApproach();
me.updateActiveSTARs();
me.updateActiveTransitions();
},
_clearPage: func() {
me.L1 = [nil, nil, "ack"];
me.L2 = [nil, nil, "ack"];
me.L3 = [nil, nil, "ack"];
me.L4 = [nil, nil, "ack"];
me.L5 = [nil, nil, "ack"];
me.L6 = [nil, nil, "ack"];
me.C1 = [nil, nil, "ack"];
me.C2 = [nil, nil, "ack"];
me.C3 = [nil, nil, "ack"];
me.C4 = [nil, nil, "ack"];
me.C5 = [nil, nil, "ack"];
me.C6 = [nil, nil, "ack"];
me.R1 = [nil, nil, "ack"];
me.R2 = [nil, nil, "ack"];
me.R3 = [nil, nil, "ack"];
me.R4 = [nil, nil, "ack"];
me.R5 = [nil, nil, "ack"];
me.R6 = [nil, nil, "ack"];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
},
updatePage: func() {
me._clearPage();
me._setupPageWithData();
},
updateActiveApproach: func() {
if (me.selectedApproach != nil) {
if (fmgc.flightPlanController.flightplans[2].approach != nil) {
if (fmgc.flightPlanController.flightplans[2].approach == me.selectedApproach) {
me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].approach.id, " APPR", "yel"];
} else {
me.L1 = ["---", " APPR", "wht"];
}
} elsif (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].approach.id, " APPR", "yel"];
} else {
me.L1 = ["---", " APPR", "wht"];
}
} else {
me.L1 = ["---", " APPR", "wht"];
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateActiveSTARs: func() {
if (me.selectedSTAR != nil) {
if (fmgc.flightPlanController.flightplans[2].star != nil) {
if (fmgc.flightPlanController.flightplans[2].star == me.selectedSTAR) {
me.C1 = [fmgc.flightPlanController.flightplans[2].star.id, "SID", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "SID", "yel"];
} else {
me.C1 = ["------- ", "STAR", "wht"];
}
} elsif (fmgc.flightPlanController.flightplans[me.computer].star.id != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "SID", "yel"];
} else {
me.C1 = ["------- ", "STAR", "wht"];
}
} else {
me.C1 = ["------- ", "STAR", "wht"];
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateActiveTransitions: func() {
if (!me.hasPressNoTrans) {
if (me.selectedTransition != nil) {
if (fmgc.flightPlanController.flightplans[2].star_trans != nil) {
if (fmgc.flightPlanController.flightplans[2].star_trans == me.selectedTransition) {
me.R1 = [fmgc.flightPlanController.flightplans[2].star_trans.id, "TRANS", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) {
me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "TRANS", "yel"];
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} elsif (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "SID", "yel"];
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} else {
me.R1 = ["NONE", "TRANS ", "yel"];
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateApproaches: func() {
if (me.arrAirport == nil) {
me.arrAirport = findAirportsByICAO(left(me.id, 4));
}
me._approaches = me.arrAirport[0].getApproachList();
me.approaches = sort(me._approaches,func(a,b) cmp(a,b));
if (size(me.approaches) >= 1) {
me.L3 = [" " ~ me.approaches[0 + me.scrollApproach], " APPR", "blu"];
me.C3 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).runways[0]].length) ~ "M", "AVAILABLE ", "blu"];
me.R3 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).runways[0]].heading), nil, "blu"];
if (me.approaches[0 + me.scrollApproach] != me.selectedApproach) {
me.arrowsMatrix[0][2] = 1;
me.arrowsColour[0][2] = "blu";
} else {
me.arrowsMatrix[0][2] = 0;
me.arrowsColour[0][2] = "ack";
}
}
if (size(me.approaches) >= 2) {
me.L4 = [" " ~ me.approaches[1 + me.scrollApproach], nil, "blu"];
if (me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).radio == "ILS") {
me.C4 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].length) ~ "M", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).runways[0]].ils.id ~ "/" ~ sprintf("%7.2f", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).runways[0]].ils_frequency_mhz), "blu"];
} else {
me.C4 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].length) ~ "M", nil, "blu"];
}
me.R4 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].heading), nil, "blu"];
if (me.approaches[1 + me.scrollApproach] != me.selectedApproach) {
me.arrowsMatrix[0][3] = 1;
me.arrowsColour[0][3] = "blu";
} else {
me.arrowsMatrix[0][3] = 0;
me.arrowsColour[0][3] = "ack";
}
}
if (size(me.approaches) >= 3) {
me.L5 = [" " ~ me.approaches[2 + me.scrollApproach], nil, "blu"];
if (me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).radio == "ILS") {
me.C5 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].length) ~ "M", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].ils.id ~ "/" ~ sprintf("%7.2f", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].ils_frequency_mhz), "blu"];
} else {
me.C5 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].length) ~ "M", nil, "blu"];
}
me.R5 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].heading), nil, "blu"];
if (me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).radio == "ILS") {
me.C6[1] = me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].ils.id ~ "/" ~ sprintf("%7.2f", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].ils_frequency_mhz);
}
if (me.approaches[2 + me.scrollApproach] != me.selectedApproach) {
me.arrowsMatrix[0][4] = 1;
me.arrowsColour[0][4] = "blu";
} else {
me.arrowsMatrix[0][3] = 0;
me.arrowsColour[0][3] = "ack";
}
}
if (size(me.approaches) > 3) {
me.enableScrollApproach = 1;
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateSTARs: func() {
if (me.arrAirport == nil) {
me.arrAirport = findAirportsByICAO(left(me.id, 4));
}
if (me.selectedApproach != nil) {
me._stars = me.arrAirport[0].stars(me.selectedApproach.runways[0]);
} else {
me._stars = me.arrAirport[0].stars();
}
me.stars = sort(me._stars,func(a,b) cmp(a,b));
if (size(me.stars) >= 1) {
me.L2 = [" " ~ me.stars[0 + me.scrollStars], "STARS", "blu"];
if (me.stars[0 + me.scrollStars] != me.selectedSTAR) {
me.arrowsMatrix[0][1] = 1;
me.arrowsColour[0][1] = "blu";
} else {
me.arrowsMatrix[0][1] = 0;
me.arrowsColour[0][1] = "ack";
}
}
if (size(me.stars) >= 2) {
me.L3 = [" " ~ me.stars[1 + me.scrollStars], nil, "blu"];
if (me.stars[1 + me.scrollStars] != me.selectedSTAR) {
me.arrowsMatrix[0][2] = 1;
me.arrowsColour[0][2] = "blu";
} else {
me.arrowsMatrix[0][2] = 0;
me.arrowsColour[0][2] = "ack";
}
}
if (size(me.stars) >= 3) {
me.L4 = [" " ~ me.stars[2 + me.scrollStars], nil, "blu"];
if (me.stars[2 + me.scrollStars] != me.selectedSTAR) {
me.arrowsMatrix[0][3] = 1;
me.arrowsColour[0][3] = "blu";
} else {
me.arrowsMatrix[0][3] = 0;
me.arrowsColour[0][3] = "ack";
}
}
if (size(me.stars) >= 4) {
me.L5 = [" " ~ me.stars[3 + me.scrollStars], nil, "blu"];
if (me.stars[3 + me.scrollStars] != me.selectedSTAR) {
me.arrowsMatrix[0][4] = 1;
me.arrowsColour[0][4] = "blu";
} else {
me.arrowsMatrix[0][4] = 0;
me.arrowsColour[0][4] = "ack";
}
}
me.C2 = [nil, "AVAILABLE", "wht"];
me.R2 = [nil, "TRANS ", "wht"];
if (size(me.stars) > 4) {
me.enableScrollStars = 1;
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
clearTransitions: func() {
me.R2 = [nil, "TRANS", "wht"];
me.R3 = [nil, "TRANS", "wht"];
me.R4 = [nil, "TRANS", "wht"];
me.R5 = [nil, "TRANS", "wht"];
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
me.arrowsMatrix[1][2] = 0;
me.arrowsColour[1][2] = "ack";
me.arrowsMatrix[1][3] = 0;
me.arrowsColour[1][3] = "ack";
me.arrowsMatrix[1][4] = 0;
me.arrowsColour[1][4] = "ack";
},
updateTransitions: func() {
if (me.arrAirport == nil) {
me.arrAirport = findAirportsByICAO(left(me.id, 4));
}
if (me.selectedSTAR == nil) {
me.R2 = ["NO TRANS ", "TRANS", "blu"];
if (!me.hasPressNoTrans) {
me.arrowsMatrix[1][1] = 1;
me.arrowsColour[1][1] = "blu";
} else {
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
}
return;
}
me._transitions = me.arrAirport[0].getStar(me.selectedSTAR).transitions;
me.transitions = sort(me._transitions,func(a,b) cmp(a,b));
if (size(me.transitions) == 0) {
me.R2 = ["NO TRANS ", "TRANS", "blu"];
if (!me.hasPressNoTrans) {
me.arrowsMatrix[1][1] = 1;
me.arrowsColour[1][1] = "blu";
} else {
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
}
} elsif (size(me.transitions) >= 1) {
me.R2 = [me.transitions[0] ~ " ", "TRANS", "blu"];
if (me.transitions[0] != me.selectedTransition) {
me.arrowsMatrix[1][1] = 1;
me.arrowsColour[1][1] = "blu";
} else {
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
}
} elsif (size(me.transitions) >= 2) {
me.R3 = [me.transitions[1] ~ " ", nil, "blu"];
if (me.transitions[1] != me.selectedTransition) {
me.arrowsMatrix[1][2] = 1;
me.arrowsColour[1][2] = "blu";
} else {
me.arrowsMatrix[1][2] = 0;
me.arrowsColour[1][2] = "ack";
}
} elsif (size(me.transitions) >= 3) {
me.R4 = [me.transitions[2] ~ " ", nil, "blu"];
if (me.transitions[2] != me.selectedTransition) {
me.arrowsMatrix[1][3] = 1;
me.arrowsColour[1][3] = "blu";
} else {
me.arrowsMatrix[1][3] = 0;
me.arrowsColour[1][3] = "ack";
}
} elsif (size(me.transitions) >= 4) {
me.R5 = [me.transitions[3] ~ " ", nil, "blu"];
if (me.transitions[3] != me.selectedTransition) {
me.arrowsMatrix[1][4] = 1;
me.arrowsColour[1][4] = "blu";
} else {
me.arrowsMatrix[1][4] = 0;
me.arrowsColour[1][4] = "ack";
}
}
},
makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (!dirToFlag) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
me.L6 = [" F-PLN", " TMPY", "yel"];
me.arrowsColour[0][5] = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else {
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
}
},
scrollUp: func() {
if (me.activePage == 0) {
if (me.enableScrollApproach) {
me.scrollApproach += 1;
if (me.scrollApproach > size(me.approaches) - 4) {
me.scrollApproach = 0;
}
me.updateApproaches();
}
} else {
if (me.enableScrollStars) {
me.scrollStars += 1;
if (me.scrollStars > size(me.stars) - 4) {
me.scrollStars = 0;
}
me.updateSTARs();
if (me.selectedSTAR == nil) {
me.clearTransitions();
} else {
me.updateTransitions();
}
me.hasPressNoTrans = 0;
}
}
},
scrollDn: func() {
if (me.activePage == 0) {
if (me.enableScrollApproach) {
me.scrollApproach -= 1;
if (me.scrollApproach < 0) {
me.scrollApproach = size(me.approaches) - 4;
}
me.updateApproaches();
}
} else {
if (me.enableScrollStars) {
me.scrollStars -= 1;
if (me.scrollStars < 0) {
me.scrollStars = size(me.stars) - 4;
}
me.updateSTARs();
if (me.selectedSTAR == nil) {
me.clearTransitions();
} else {
me.updateTransitions();
}
me.hasPressNoTrans = 0;
}
}
},
scrollLeft: func() {
me.activePage = !me.activePage;
me.updatePage();
},
scrollRight: func() {
me.activePage = !me.activePage;
me.updatePage();
},
arrPushbuttonLeft: func(index) {
if (me.activePage == 0) {
if (size(me.approaches) >= (index - 1) and index != 2) {
if (!dirToFlag) {
me.selectedApproach = me.arrAirport[0].getIAP(me.approaches[index - 3 + me.scrollApproach]);
me.makeTmpy();
fmgc.flightPlanController.flightplans[me.computer].destination_runway = me.arrAirport[0].runways[me.selectedApproach.runways[0]];
fmgc.flightPlanController.flightplans[me.computer].approach = me.selectedApproach;
me.updateActiveApproach();
me.updateApproaches();
fmgc.flightPlanController.flightPlanChanged(me.computer);
me.scrollRight();
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} else {
notAllowed(me.computer);
}
} else {
if (size(me.stars) >= (index - 1)) {
if (!dirToFlag) {
me.selectedSTAR = me.stars[index - 2 + me.scrollStars];
me.makeTmpy();
fmgc.flightPlanController.flightplans[me.computer].star = me.arrAirport[0].getStar(me.selectedSTAR);
me.updateActiveSTARs();
me.updateSTARs();
me.hasPressNoTrans = 0;
me.updateTransitions();
me.updateActiveTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} else {
notAllowed(me.computer);
}
}
},
arrPushbuttonRight: func(index) {
if (index == 2 and size(me.transitions) == 0) {
if (!dirToFlag) {
me.hasPressNoTrans = 1;
me.updateActiveTransitions();
me.updateTransitions();
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} elsif (size(me.transitions) >= (index - 1)) {
if (!dirToFlag) {
me.selectedTransition = me.transitions[index - 2];
me.makeTmpy();
fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition;
me.updateActiveTransitions();
me.updateTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} else {
notAllowed(me.computer);
}
},
};

528
Nasal/MCDU/DEPARTURE.nas Normal file
View file

@ -0,0 +1,528 @@
var departurePage = {
title: [nil, nil, nil],
subtitle: [nil, 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"],
depAirport: nil,
runways: nil,
selectedRunway: nil,
selectedSID: nil,
selectedTransition: nil,
sids: nil,
transitions: nil,
computer: nil,
enableScrollRwy: 0,
enableScrollSids: 0,
scrollRwy: 0,
scrollSids: 0,
activePage: 0, # runways, sids, trans
hasPressNoTrans: 0, # temporary
_runways: nil,
_sids: nil,
_transitions: nil,
new: func(icao, computer) {
var lr = {parents:[departurePage]};
lr.id = icao;
lr.computer = computer;
lr._setupPageWithData();
return lr;
},
del: func() {
return nil;
},
_setupPageWithData: func() {
me.title = ["DEPARTURE", " FROM ", left(me.id, 4)];
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) {
me.selectedRunway = fmgc.flightPlanController.flightplans[2].departure_runway;
}
if (fmgc.flightPlanController.flightplans[2].sid != nil) {
me.selectedSID = fmgc.flightPlanController.flightplans[2].sid;
}
} else {
if (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) {
me.selectedRunway = fmgc.flightPlanController.flightplans[me.computer].departure_runway;
} elsif (fmgc.flightPlanController.flightplans[2].departure_runway != nil) {
me.selectedRunway = fmgc.flightPlanController.flightplans[2].departure_runway;
}
if (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
me.selectedSID = fmgc.flightPlanController.flightplans[me.computer].sid;
} elsif (fmgc.flightPlanController.flightplans[2].sid != nil) {
me.selectedSID = fmgc.flightPlanController.flightplans[2].sid;
}
}
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.L6 = [" RETURN END", nil, "wht"];
} else {
me.L6 = [" F-PLN", " TMPY", "yel"];
me.arrowsColour[0][5] = "yel";
}
if (me.activePage == 0) {
me.updateRunways();
} else {
me.updateSIDs();
}
me.updateActiveRunway();
me.updateActiveSIDs();
me.updateActiveTransitions();
},
_clearPage: func() {
me.L1 = [nil, nil, "ack"];
me.L2 = [nil, nil, "ack"];
me.L3 = [nil, nil, "ack"];
me.L4 = [nil, nil, "ack"];
me.L5 = [nil, nil, "ack"];
me.L6 = [nil, nil, "ack"];
me.C1 = [nil, nil, "ack"];
me.C2 = [nil, nil, "ack"];
me.C3 = [nil, nil, "ack"];
me.C4 = [nil, nil, "ack"];
me.C5 = [nil, nil, "ack"];
me.C6 = [nil, nil, "ack"];
me.R1 = [nil, nil, "ack"];
me.R2 = [nil, nil, "ack"];
me.R3 = [nil, nil, "ack"];
me.R4 = [nil, nil, "ack"];
me.R5 = [nil, nil, "ack"];
me.R6 = [nil, nil, "ack"];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
},
updatePage: func() {
me._clearPage();
me._setupPageWithData();
},
updateActiveRunway: func() {
if (me.selectedRunway != nil) {
if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) {
if (fmgc.flightPlanController.flightplans[2].departure_runway.id == me.selectedRunway.id) {
me.L1 = [fmgc.flightPlanController.flightplans[2].departure_runway.id, " RWY", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].departure_runway.id, " RWY", "yel"];
} else {
me.L1 = ["---", " RWY", "wht"];
}
} elsif (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].departure_runway.id, " RWY", "yel"];
} else {
me.L1 = ["---", " RWY", "wht"];
}
} else {
me.L1 = ["---", " RWY", "wht"];
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateActiveSIDs: func() {
if (me.selectedSID != nil) {
if (fmgc.flightPlanController.flightplans[2].sid != nil) {
if (fmgc.flightPlanController.flightplans[2].sid == me.selectedSID) {
me.C1 = [fmgc.flightPlanController.flightplans[2].sid.id, "SID", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid.id, "SID", "yel"];
} else {
me.C1 = ["------- ", "SID", "wht"];
}
} elsif (fmgc.flightPlanController.flightplans[me.computer].sid.id != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid.id, "SID", "yel"];
} else {
me.C1 = ["------- ", "SID", "wht"];
}
} else {
me.C1 = ["------- ", "SID", "wht"];
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateActiveTransitions: func() {
if (!me.hasPressNoTrans) {
if (me.selectedTransition != nil) {
if (fmgc.flightPlanController.flightplans[2].sid_trans != nil) {
if (fmgc.flightPlanController.flightplans[2].sid_trans == me.selectedTransition) {
me.R1 = [fmgc.flightPlanController.flightplans[2].sid_trans.id, "TRANS", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].sid_trans != nil) {
me.R1 = [fmgc.flightPlanController.flightplans[me.computer].sid_trans.id, "TRANS", "yel"];
} else {
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"];
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} else {
me.R1 = ["NONE", "TRANS ", "yel"];
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateRunways: func() {
if (me.depAirport == nil) {
me.depAirport = findAirportsByICAO(left(me.id, 4));
}
me._runways = keys(me.depAirport[0].runways);
me.runways = sort(me._runways,func(a,b) cmp(a,b));
if (size(me.runways) >= 1) {
me.L2 = [" " ~ me.runways[0 + me.scrollRwy], nil, "blu"];
me.C2 = [math.round(me.depAirport[0].runways[me.runways[0 + me.scrollRwy]].length) ~ "M", "AVAILABLE RUNWAYS", "blu"];
me.R2 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[0 + me.scrollRwy]].heading), nil, "blu"];
if (me.runways[0 + me.scrollRwy] != me.selectedRunway) {
me.arrowsMatrix[0][1] = 1;
me.arrowsColour[0][1] = "blu";
} else {
me.arrowsMatrix[0][1] = 0;
me.arrowsColour[0][1] = "ack";
}
}
if (size(me.runways) >= 2) {
me.L3 = [" " ~ me.runways[1 + me.scrollRwy], nil, "blu"];
me.C3 = [math.round(me.depAirport[0].runways[me.runways[1 + me.scrollRwy]].length) ~ "M", nil, "blu"];
me.R3 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[1 + me.scrollRwy]].heading), nil, "blu"];
if (me.runways[1 + me.scrollRwy] != me.selectedRunway) {
me.arrowsMatrix[0][2] = 1;
me.arrowsColour[0][2] = "blu";
} else {
me.arrowsMatrix[0][2] = 0;
me.arrowsColour[0][2] = "ack";
}
}
if (size(me.runways) >= 3) {
me.L4 = [" " ~ me.runways[2 + me.scrollRwy], nil, "blu"];
me.C4 = [math.round(me.depAirport[0].runways[me.runways[2 + me.scrollRwy]].length) ~ "M", nil, "blu"];
me.R4 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[2 + me.scrollRwy]].heading), nil, "blu"];
if (me.runways[2 + me.scrollRwy] != me.selectedRunway) {
me.arrowsMatrix[0][3] = 1;
me.arrowsColour[0][3] = "blu";
} else {
me.arrowsMatrix[0][3] = 0;
me.arrowsColour[0][3] = "ack";
}
}
if (size(me.runways) >= 4) {
me.L5 = [" " ~ me.runways[3 + me.scrollRwy], nil, "blu"];
me.C5 = [math.round(me.depAirport[0].runways[me.runways[3 + me.scrollRwy]].length) ~ "M", nil, "blu"];
me.R5 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[3 + me.scrollRwy]].heading), nil, "blu"];
if (me.runways[3 + me.scrollRwy] != me.selectedRunway) {
me.arrowsMatrix[0][4] = 1;
me.arrowsColour[0][4] = "blu";
} else {
me.arrowsMatrix[0][4] = 0;
me.arrowsColour[0][4] = "ack";
}
}
if (size(me.runways) > 4) {
me.enableScrollRwy = 1;
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateSIDs: func() {
if (me.depAirport == nil) {
me.depAirport = findAirportsByICAO(left(me.id, 4));
}
if (me.selectedRunway != nil) {
me._sids = me.depAirport[0].sids(me.selectedRunway.id);
if (size(me._sids) == 0) { # account for cases such as EGJJ where runway code does not match SIDS
me._sids = me.depAirport[0].sids();
}
} else {
me._sids = me.depAirport[0].sids();
}
me.sids = sort(me._sids,func(a,b) cmp(a,b));
if (size(me.sids) >= 1) {
me.L2 = [" " ~ me.sids[0 + me.scrollSids], "SIDS", "blu"];
if (me.sids[0 + me.scrollSids] != me.selectedSID) {
me.arrowsMatrix[0][1] = 1;
me.arrowsColour[0][1] = "blu";
} else {
me.arrowsMatrix[0][1] = 0;
me.arrowsColour[0][1] = "ack";
}
}
if (size(me.sids) >= 2) {
me.L3 = [" " ~ me.sids[1 + me.scrollSids], nil, "blu"];
if (me.sids[1 + me.scrollSids] != me.selectedSID) {
me.arrowsMatrix[0][2] = 1;
me.arrowsColour[0][2] = "blu";
} else {
me.arrowsMatrix[0][2] = 0;
me.arrowsColour[0][2] = "ack";
}
}
if (size(me.sids) >= 3) {
me.L4 = [" " ~ me.sids[2 + me.scrollSids], nil, "blu"];
if (me.sids[2 + me.scrollSids] != me.selectedSID) {
me.arrowsMatrix[0][3] = 1;
me.arrowsColour[0][3] = "blu";
} else {
me.arrowsMatrix[0][3] = 0;
me.arrowsColour[0][3] = "ack";
}
}
if (size(me.sids) >= 4) {
me.L5 = [" " ~ me.sids[3 + me.scrollSids], nil, "blu"];
if (me.sids[3 + me.scrollSids] != me.selectedSID) {
me.arrowsMatrix[0][4] = 1;
me.arrowsColour[0][4] = "blu";
} else {
me.arrowsMatrix[0][4] = 0;
me.arrowsColour[0][4] = "ack";
}
}
me.C2 = [nil, "AVAILABLE", "wht"];
me.R2 = [nil, "TRANS ", "wht"];
if (size(me.sids) > 4) {
me.enableScrollSids = 1;
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
clearTransitions: func() {
me.R2 = [nil, "TRANS", "wht"];
me.R3 = [nil, "TRANS", "wht"];
me.R4 = [nil, "TRANS", "wht"];
me.R5 = [nil, "TRANS", "wht"];
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
me.arrowsMatrix[1][2] = 0;
me.arrowsColour[1][2] = "ack";
me.arrowsMatrix[1][3] = 0;
me.arrowsColour[1][3] = "ack";
me.arrowsMatrix[1][4] = 0;
me.arrowsColour[1][4] = "ack";
},
updateTransitions: func() {
if (me.depAirport == nil) {
me.depAirport = findAirportsByICAO(left(me.id, 4));
}
if (me.selectedSID == nil) {
me.R2 = ["NO TRANS ", "TRANS", "blu"];
if (!me.hasPressNoTrans) {
me.arrowsMatrix[1][1] = 1;
me.arrowsColour[1][1] = "blu";
} else {
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
}
return;
}
me._transitions = me.depAirport[0].getSid(me.selectedSID).transitions;
me.transitions = sort(me._transitions,func(a,b) cmp(a,b));
if (size(me.transitions) == 0) {
me.R2 = ["NO TRANS ", "TRANS", "blu"];
if (!me.hasPressNoTrans) {
me.arrowsMatrix[1][1] = 1;
me.arrowsColour[1][1] = "blu";
} else {
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
}
} elsif (size(me.transitions) >= 1) {
me.R2 = [me.transitions[0] ~ " ", "TRANS", "blu"];
if (me.transitions[0] != me.selectedTransition) {
me.arrowsMatrix[1][1] = 1;
me.arrowsColour[1][1] = "blu";
} else {
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
}
} elsif (size(me.transitions) >= 2) {
me.R3 = [me.transitions[1] ~ " ", nil, "blu"];
if (me.transitions[1] != me.selectedTransition) {
me.arrowsMatrix[1][2] = 1;
me.arrowsColour[1][2] = "blu";
} else {
me.arrowsMatrix[1][2] = 0;
me.arrowsColour[1][2] = "ack";
}
} elsif (size(me.transitions) >= 3) {
me.R4 = [me.transitions[2] ~ " ", nil, "blu"];
if (me.transitions[2] != me.selectedTransition) {
me.arrowsMatrix[1][3] = 1;
me.arrowsColour[1][3] = "blu";
} else {
me.arrowsMatrix[1][3] = 0;
me.arrowsColour[1][3] = "ack";
}
} elsif (size(me.transitions) >= 4) {
me.R5 = [me.transitions[3] ~ " ", nil, "blu"];
if (me.transitions[3] != me.selectedTransition) {
me.arrowsMatrix[1][4] = 1;
me.arrowsColour[1][4] = "blu";
} else {
me.arrowsMatrix[1][4] = 0;
me.arrowsColour[1][4] = "ack";
}
}
},
makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (!dirToFlag) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
me.L6 = [" F-PLN", " TMPY", "yel"];
me.arrowsColour[0][5] = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else {
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
}
},
scrollUp: func() {
if (me.activePage == 0) {
if (me.enableScrollRwy) {
me.scrollRwy += 1;
if (me.scrollRwy > size(me.runways) - 4) {
me.scrollRwy = 0;
}
me.updateRunways();
}
} else {
if (me.enableScrollSids) {
me.scrollSids += 1;
if (me.scrollSids > size(me.sids) - 4) {
me.scrollSids = 0;
}
me.updateSIDs();
if (me.selectedSID == nil) {
me.clearTransitions();
} else {
me.updateTransitions();
}
me.hasPressNoTrans = 0;
}
}
},
scrollDn: func() {
if (me.activePage == 0) {
if (me.enableScrollRwy) {
me.scrollRwy -= 1;
if (me.scrollRwy < 0) {
me.scrollRwy = size(me.runways) - 4;
}
me.updateRunways();
}
} else {
if (me.enableScrollSids) {
me.scrollSids -= 1;
if (me.scrollSids < 0) {
me.scrollSids = size(me.sids) - 4;
}
me.updateSIDs();
if (me.selectedSID == nil) {
me.clearTransitions();
} else {
me.updateTransitions();
}
me.hasPressNoTrans = 0;
}
}
},
scrollLeft: func() {
me.activePage = !me.activePage;
me.updatePage();
},
scrollRight: func() {
me.activePage = !me.activePage;
me.updatePage();
},
depPushbuttonLeft: func(index) {
if (me.activePage == 0) {
if (size(me.runways) >= (index - 1)) {
if (!dirToFlag) {
me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2 + me.scrollRwy]);
me.makeTmpy();
fmgc.flightPlanController.flightplans[me.computer].departure_runway = me.selectedRunway;
me.updateActiveRunway();
me.updateRunways();
fmgc.flightPlanController.flightPlanChanged(me.computer);
me.scrollRight();
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} else {
notAllowed(me.computer);
}
} else {
if (size(me.sids) >= (index - 1)) {
if (!dirToFlag) {
me.selectedSID = me.sids[index - 2 + me.scrollSids];
me.makeTmpy();
fmgc.flightPlanController.flightplans[me.computer].sid = me.selectedSID;
me.updateActiveSIDs();
me.updateSIDs();
me.hasPressNoTrans = 0;
me.updateTransitions();
me.updateActiveTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} else {
notAllowed(me.computer);
}
}
},
depPushbuttonRight: func(index) {
if (index == 2 and size(me.transitions) == 0) {
if (!dirToFlag) {
me.hasPressNoTrans = 1;
me.updateActiveTransitions();
me.updateTransitions();
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} elsif (size(me.transitions) >= (index - 1)) {
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);
me.updateActiveTransitions();
me.updateTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} else {
notAllowed(me.computer);
}
},
};

275
Nasal/MCDU/DIRTO.nas Normal file
View file

@ -0,0 +1,275 @@
var dirToFlag = 0;
var dirTo = {
title: [nil],
subtitle: [nil, 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"],
R1: [nil, nil, "ack"],
R2: [nil, nil, "ack"],
R3: [nil, nil, "ack"],
R4: [nil, nil, "ack"],
R5: [nil, nil, "ack"],
R6: [nil, nil, "ack"],
scroll: 0,
vector: [],
index: nil,
computer: nil,
new: func(computer) {
var dt = {parents:[dirTo]};
dt.computer = computer;
dt._setupPageWithData();
return dt;
},
del: func() {
return nil;
},
_setupPageWithData: func() {
me.title = ["DIR TO"];
me.titleColour = "wht";
me.L1 = [" [ ]", " WAYPOINT", "blu"];
me.L2 = [nil, " F-PLN WPTS", "blu"];
me.L3 = [nil, nil, "blu"];
me.L4 = [nil, nil, "blu"];
me.L5 = [nil, nil, "blu"];
me.R1 = ["---- --- ", "UTC DIST ", "wht"];
me.R2 = ["DIRECT TO ", nil, "blu"];
me.R3 = ["ABEAM PTS ", "WITH ", "blu"];
me.R4 = ["[ ] ", "RADIAL IN ", "blu"];
me.R5 = ["[ ] ", "RADIAL OUT ", "blu"];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "blu", "blu", "blu", "blu", "ack"], ["ack", "blu", "blu", "ack", "ack", "ack"]];
me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]];
me.updateFromFpln();
me.updateTmpy();
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
}
dirToFlag = 1;
},
insertDirTo: func() {
dirToFlag = 0;
},
updateTmpy: func() {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.L1[2] = "yel";
me.R2[2] = "yel";
me.arrowsMatrix[1][2] = 1;
me.titleColour = "yel";
} else {
me.L1[2] = "blu";
me.R2[2] = "blu";
me.arrowsMatrix[1][2] = 0;
me.titleColour = "wht";
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateFromFpln: func() {
if (canvas_mcdu.myFpln[me.computer] == nil) {
canvas_mcdu.myFpln[me.computer] = fplnPage.new(2, me.computer);
}
var x = 0;
me.vector = [];
for (var i = 1 + (me.scroll); i < size(canvas_mcdu.myFpln[me.computer].planList) - 2; i = i + 1) {
if (canvas_mcdu.myFpln[me.computer].planList[i].wp.wp_name == "DISCONTINUITY" or canvas_mcdu.myFpln[me.computer].planList[i].wp.wp_name == "VECTORS" or canvas_mcdu.myFpln[me.computer].planList[i].wp.wp_name == "T-P" or canvas_mcdu.myFpln[me.computer].planList[i].wp.wp_type == "hdgToAlt") { continue; } # can't ever have tmpy with dir to
if (canvas_mcdu.myFpln[me.computer].planList[i].index > fmgc.flightPlanController.arrivalIndex[2]) {
continue;
}
append(me.vector, canvas_mcdu.myFpln[me.computer].planList[i].wp);
x += 1;
if (x == 4) { break; }
}
if (size(me.vector) > 0) {
me.L2[0] = " " ~ me.vector[0].wp_name;
me.arrowsMatrix[0][1] = 1;
} else {
me.L2[0] = nil;
me.arrowsMatrix[0][1] = 0;
}
if (size(me.vector) > 1) {
me.L3[0] = " " ~ me.vector[1].wp_name;
me.arrowsMatrix[0][2] = 1;
} else {
me.L3[0] = nil;
me.arrowsMatrix[0][2] = 0;
}
if (size(me.vector) > 2) {
me.L4[0] = " " ~ me.vector[2].wp_name;
me.arrowsMatrix[0][3] = 1;
} else {
me.L4[0] = nil;
me.arrowsMatrix[0][3] = 0;
}
if (size(me.vector) > 3) {
me.L5[0] = " " ~ me.vector[3].wp_name;
me.arrowsMatrix[0][4] = 1;
} else {
me.L5[0] = nil;
me.arrowsMatrix[0][4] = 0;
}
me.updateTmpy();
},
scrollUp: func() {
if (size(canvas_mcdu.myFpln[me.computer].planList) > 4) {
me.scroll += 1;
if (me.scroll > size(canvas_mcdu.myFpln[me.computer].planList) - 6) {
me.scroll = 0;
}
} else {
me.scroll = 0;
}
me.updateFromFpln();
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
scrollDn: func() {
if (size(canvas_mcdu.myFpln[me.computer].planList) > 4) {
me.scroll -= 1;
if (me.scroll < 0) {
me.scroll = size(canvas_mcdu.myFpln[me.computer].planList) - 6;
}
} else {
me.scroll = 0;
}
me.updateFromFpln();
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
fieldL1: func(text, override = 0, overrideIndex = -1) {
me.makeTmpy();
me.L1[0] = text;
if (size(text) == 16) {
# lat lon
var lat = split("/", text)[0];
var lon = split("/", text)[1];
var latDecimal = mcdu.stringToDegrees(lat, "lat");
var lonDecimal = mcdu.stringToDegrees(lon, "lon");
if (latDecimal > 90 or latDecimal < -90 or lonDecimal > 180 or lonDecimal < -180) {
notAllowed(me.computer);
}
var myWpLatLon = createWP(latDecimal, lonDecimal, "LL" ~ 01);
fmgc.flightPlanController.directTo(myWpLatLon, me.computer);
} elsif (size(text) == 5) {
# fix
var fix = findFixesByID(text);
if (size(fix) == 0) {
notInDataBase(me.computer);
}
if (size(fix) == 1 or override) {
if (!override) {
fmgc.flightPlanController.directTo(fix[0], me.computer);
} else {
fmgc.flightPlanController.directTo(fix[overrideIndex], me.computer);
}
} elsif (size(fix) >= 1) {
if (canvas_mcdu.myDuplicate[me.computer] != nil) {
canvas_mcdu.myDuplicate[me.computer].del();
}
canvas_mcdu.myDuplicate[me.computer] = nil;
canvas_mcdu.myDuplicate[me.computer] = mcdu.duplicateNamesPage.new(fix, 0, 0, me.computer);
setprop("MCDU[" ~ me.computer ~ "]/page", "DUPLICATENAMES");
}
} elsif (size(text) == 4) {
# airport
var airport = findAirportsByICAO(text);
if (size(airport) == 0) {
notInDataBase(me.computer);
}
if (size(airport) == 1 or override) {
if (!override) {
fmgc.flightPlanController.directTo(airport[0], me.computer);
} else {
fmgc.flightPlanController.directTo(airport[overrideIndex], me.computer);
}
} elsif (size(airport) >= 1) {
if (canvas_mcdu.myDuplicate[me.computer] != nil) {
canvas_mcdu.myDuplicate[me.computer].del();
}
canvas_mcdu.myDuplicate[me.computer] = nil;
canvas_mcdu.myDuplicate[me.computer] = mcdu.duplicateNamesPage.new(airport, 0, 0, me.computer);
setprop("MCDU[" ~ me.computer ~ "]/page", "DUPLICATENAMES");
}
} elsif (size(text) == 3 or size(text) == 2) {
# navaid
var navaid = findNavaidsByID(text);
if (size(navaid) == 0) {
notInDataBase(me.computer);
}
if (size(navaid) == 1 or override) {
if (!override) {
fmgc.flightPlanController.directTo(navaid[0], me.computer);
} else {
fmgc.flightPlanController.directTo(navaid[overrideIndex], me.computer);
}
} elsif (size(navaid) >= 1) {
if (canvas_mcdu.myDuplicate[me.computer] != nil) {
canvas_mcdu.myDuplicate[me.computer].del();
}
canvas_mcdu.myDuplicate[me.computer] = nil;
canvas_mcdu.myDuplicate[me.computer] = mcdu.duplicateNamesPage.new(navaid, 0, 0, me.computer);
setprop("MCDU[" ~ me.computer ~ "]/page", "DUPLICATENAMES");
}
} else {
notAllowed(me.computer);
}
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", "");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "");
},
leftFieldBtn: func(index) {
me.makeTmpy();
me.L1[0] = me.vector[index + me.scroll - 2].wp_name;
fmgc.flightPlanController.directTo(me.vector[index + me.scroll - 2], me.computer);
me.arrowsMatrix[0][1] = 0;
# FIGURE OUT HOW TO MAKE IT SO IT DOESN'T DELETE THE WAYPOINTS ON DIR TO BUT DOES IN FLIGHTPLAN
#for (var i = 2; i != 6; i = i + 1) {
# if (i == index) {
# me.arrowsMatrix[0][i - 1] = 0;
# } else {
# me.arrowsMatrix[0][i - 1] = 1;
# }
#}
},
fieldL6: func() {
if (fmgc.flightPlanController.temporaryFlag[me.computer] and dirToFlag) {
dirToFlag = 0;
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
} else {
notAllowed(me.computer);
}
me.L1 = [" [ ]", " WAYPOINT", "blu"];
me.R1 = ["---- --- ", "UTC DIST ", "wht"];
},
fieldR6: func() {
if (fmgc.flightPlanController.temporaryFlag[me.computer] and dirToFlag) {
dirToFlag = 0;
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
} else {
notAllowed(me.computer);
}
me.L1 = [" [ ]", " WAYPOINT", "blu"];
me.R1 = ["---- --- ", "UTC DIST ", "wht"];
setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); # todo - remember horizontal srcoll of f-plna?
},
updateDist: func(dist) {
me.R1 = ["---- " ~ sprintf("%.0f", dist) ~ " ", "UTC DIST ", "wht"];
},
};

149
Nasal/MCDU/DUPLICATE.nas Normal file
View file

@ -0,0 +1,149 @@
var duplicateNamesPage = {
title: nil,
subtitle: [nil, 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"],
vector: nil,
type: nil,
computer: nil,
enableScroll: 0,
scroll: 0,
distances: nil,
new: func(vector, index, type, computer) {
var fp = {parents:[duplicateNamesPage]};
fp.vector = vector;
fp.index = index;
fp.type = type; # 0 = other, 1 = navaid
fp.computer = computer;
fp._setupPageWithData();
fp.distances = [];
return fp;
},
del: func() {
return nil;
},
_setupPageWithData: func() {
me.title = "DUPLICATE NAMES";
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
me.distances = [];
for (var i = 0; i < size(me.vector); i += 1) {
append(me.distances, math.round(courseAndDistance(me.vector[i])[1]));
}
me.C1[1] = "LAT/LONG";
me.R1[1] = "FREQ";
if (size(me.vector) >= 1) {
me.L1 = [" " ~ me.vector[0 + me.scroll].id, " " ~ me.distances[0 + me.scroll] ~ "NM", "blu"];
me.arrowsMatrix[0][0] = 1;
me.arrowsColour[0][0] = "blu";
me.C1 = [" " ~ decimalToShortString(me.vector[0 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[0 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
if (me.type == 1) {
if (me.vector[0 + me.scroll].frequency != nil) {
me.R1 = [sprintf("%7.2f", me.vector[0 + me.scroll].frequency / 100), "FREQ", "grn"];
}
}
}
if (size(me.vector) >= 2) {
me.L2 = [" " ~ me.vector[0 + me.scroll].id, " " ~ me.distances[1 + me.scroll] ~ "NM", "blu"];
me.arrowsMatrix[0][1] = 1;
me.arrowsColour[0][1] = "blu";
me.C2 = [" " ~ decimalToShortString(me.vector[1 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[1 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
if (me.type == 1) {
if (me.vector[1 + me.scroll].frequency != nil) {
me.R2 = [sprintf("%7.2f", me.vector[1 + me.scroll].frequency / 100), "FREQ", "grn"];
}
}
}
if (size(me.vector) >= 3) {
me.L3 = [" " ~ me.vector[0 + me.scroll].id, " " ~ me.distances[2 + me.scroll] ~ "NM", "blu"];
me.arrowsMatrix[0][2] = 1;
me.arrowsColour[0][2] = "blu";
me.C3 = [" " ~ decimalToShortString(me.vector[2 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[2 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
if (me.type == 1) {
if (me.vector[2 + me.scroll].frequency != nil) {
me.R3 = [sprintf("%7.2f", me.vector[2 + me.scroll].frequency / 100), "FREQ", "grn"];
}
}
}
if (size(me.vector) >= 4) {
me.L4 = [" " ~ me.vector[0 + me.scroll].id, " " ~ me.distances[3 + me.scroll] ~ "NM", "blu"];
me.arrowsMatrix[0][3] = 1;
me.arrowsColour[0][3] = "blu";
me.C4 = [" " ~ decimalToShortString(me.vector[3 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[3 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
if (me.type == 1) {
if (me.vector[3 + me.scroll].frequency != nil) {
me.R4 = [sprintf("%7.2f", me.vector[3 + me.scroll].frequency / 100), "FREQ", "grn"];
}
}
}
if (size(me.vector) >= 5) {
me.L5 = [" " ~ me.vector[0 + me.scroll].id, " " ~ me.distances[4 + me.scroll] ~ "NM", "blu"];
me.arrowsMatrix[0][4] = 1;
me.arrowsColour[0][4] = "blu";
me.C5 = [" " ~ decimalToShortString(me.vector[4 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[4 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
if (me.type == 1) {
if (me.vector[4 + me.scroll].frequency != nil) {
me.R5 = [sprintf("%7.2f", me.vector[4 + me.scroll].frequency / 100), "FREQ", "grn"];
}
}
}
if (size(me.vector) > 5) { me.enableScroll = 1; }
me.L6 = [" RETURN", nil, "wht"];
},
scrollUp: func() {
if (me.enableScroll) {
me.scroll += 1;
if (me.scroll > size(me.vector) - 5) {
me.scroll = 0;
}
}
},
scrollDn: func() {
if (me.enableScroll) {
me.scroll -= 1;
if (me.scroll < 0) {
me.scroll = size(me.vector) - 5;
}
}
},
pushButtonLeft: func(indexSelect) {
if (!dirToFlag) {
if (size(me.vector[0].id) == 5) {
fmgc.flightPlanController.insertFix(me.vector[0].id, me.index, me.computer, 1, indexSelect - 1);
setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
} elsif (size(me.vector[0].id) == 4) {
fmgc.flightPlanController.insertAirport(me.vector[0].id, me.index, me.computer, 1, indexSelect - 1);
setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
} elsif (size(me.vector[0].id) == 3 or size(me.vector[0].id)== 2) {
fmgc.flightPlanController.insertNavaid(me.vector[0].id, me.index, me.computer, 1, indexSelect - 1);
setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
}
} else {
canvas_mcdu.myDirTo[me.computer].fieldL1(me.vector[0].id, 1, indexSelect - 1);
setprop("MCDU[" ~ me.computer ~ "]/page", "DIRTO");
}
},
};

424
Nasal/MCDU/F-PLN.nas Normal file
View file

@ -0,0 +1,424 @@
var fplnItem = {
new: func(wp, index, plan, computer, colour = "grn") {
var fI = {parents:[fplnItem]};
fI.wp = wp;
fI.index = index;
fI.plan = plan;
fI.computer = computer;
fI.colour = colour;
return fI;
},
updateLeftText: func() {
if (me.wp != nil) {
if (me.wp.wp_name == "T-P") {
return ["T-P", nil, me.colour];
} elsif (me.wp.wp_name != "DISCONTINUITY") {
var wptName = split("-", me.wp.wp_name);
if (wptName[0] == "VECTORS") {
return ["MANUAL", nil, me.colour];
} else {
if (size(wptName) == 2) {
return[wptName[0] ~ wptName[1], nil, me.colour];
} else {
return [me.wp.wp_name, nil, me.colour];
}
}
} else {
return [nil, nil, "ack"];
}
} else {
return ["problem", nil, "ack"];
}
},
updateCenterText: func() {
if (me.wp != nil) {
if (me.wp.wp_name != "DISCONTINUITY") {
if (me.index != (fmgc.flightPlanController.currentToWptIndex.getValue() - 1) or fmgc.flightPlanController.fromWptTime == nil) {
me.brg = me.getBrg();
me.track = me.getTrack();
return ["---- ", nil, me.colour];
} else {
me.brg = me.getBrg();
me.track = me.getTrack();
return [fmgc.flightPlanController.fromWptTime ~ " ", nil, me.colour];
}
} else {
return ["---F-PLN DISCONTINUITY--", nil, "wht"];
}
} else {
return ["problem", nil, "ack"];
}
},
updateRightText: func() {
if (me.wp != nil) {
if (me.wp.wp_name != "DISCONTINUITY") {
me.spd = me.getSpd();
me.alt = me.getAlt();
me.dist = me.getDist();
return [me.spd ~ "/" ~ me.alt, " " ~ me.dist ~ "NM ", me.colour];
} else {
return [nil, nil, "ack"];
}
} else {
return ["problem", nil, "ack"];
}
},
getBrg: func() {
return nil;
},
getTrack: func() {
return nil;
},
getSpd: func() {
return "---";
},
getAlt: func() {
if (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1) and fmgc.flightPlanController.fromWptAlt != nil) {
return " " ~ fmgc.flightPlanController.fromWptAlt;
} else {
return "-----";
}
},
getDist: func() {
return "--";
},
pushButtonLeft: func() {
if (canvas_mcdu.myLatRev[me.computer] != nil) {
canvas_mcdu.myLatRev[me.computer].del();
}
canvas_mcdu.myLatRev[me.computer] = nil;
if (me.wp.wp_name == "DISCONTINUITY") {
canvas_mcdu.myLatRev[me.computer] = latRev.new(4, "DISCON", me.index, me.computer);
} elsif (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) {
canvas_mcdu.myLatRev[me.computer] = latRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer);
} elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) {
canvas_mcdu.myLatRev[me.computer] = latRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer);
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
canvas_mcdu.myLatRev[me.computer] = latRev.new(2, me.wp.wp_name, me.index, me.computer);
} else {
canvas_mcdu.myLatRev[me.computer] = latRev.new(3, me.wp.wp_name, me.index, me.computer);
}
} else {
if (me.index == fmgc.flightPlanController.arrivalIndex[2]) {
canvas_mcdu.myLatRev[me.computer] = latRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer);
} elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[2].departure.id) {
canvas_mcdu.myLatRev[me.computer] = latRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer);
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
canvas_mcdu.myLatRev[me.computer] = latRev.new(2, me.wp.wp_name, me.index, me.computer);
} else {
canvas_mcdu.myLatRev[me.computer] = latRev.new(3, me.wp.wp_name, me.index, me.computer);
}
}
setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV");
},
pushButtonRight: func() {
if (canvas_mcdu.myVertRev[me.computer] != nil) {
canvas_mcdu.myVertRev[me.computer].del();
}
canvas_mcdu.myVertRev[me.computer] = nil;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer);
} if (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) {
notAllowed(me.computer);
return;
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer);
} else {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer);
}
} else {
if (me.index == fmgc.flightPlanController.arrivalIndex[2]) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer);
} elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[2].departure.id) {
notAllowed(me.computer);
return;
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer);
} else {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer);
}
}
setprop("MCDU[" ~ me.computer ~ "]/page", "VERTREV");
},
};
var staticText = {
new: func(computer, text) {
var sT = {parents:[staticText]};
sT.computer = computer;
sT.text = text;
return sT;
},
updateLeftText: func() {
return [nil, nil, "ack"];
},
updateCenterText: func() {
return [me.text, nil, "wht"];
},
updateRightText: func() {
return [nil, nil, "ack"];
},
pushButtonLeft: func() {
notAllowed(me.computer);
},
pushButtonRight: func() {
notAllowed(me.computer);
},
};
var fplnPage = { # this one is only created once, and then updated - remember this
fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
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"],
# init conditions
# line 1 = FROM
# line 2 = TO
# line 6 = DEST
# neither pseudo nor markers may be FROM waypoint
# bearing between FROM and TO waypoints
# track between line 2 and line 3 waypoints
# name of LEG above TO waypoint - is airway identifier, or waypoint name
# DEST in LINE 6 time prediction, distance along flightplan, and EFOB
# dashes if no predictions
planList: [],
outputList: [],
scroll: 0,
temporaryFlagFpln: 0,
new: func(plan, computer) {
var fp = {parents:[fplnPage]};
fp.plan = fmgc.flightPlanController.flightplans[plan];
fp.planIndex = plan;
fp.computer = computer;
fp.planList = [];
fp.outputList = [];
return fp;
},
_setupPageWithData: func() {
me.destInfo();
me.createPlanList();
},
updatePlan: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.planIndex = 2;
me.plan = fmgc.flightPlanController.flightplans[2];
me.temporaryFlagFpln = 0;
} else {
me.planIndex = me.computer;
me.plan = fmgc.flightPlanController.flightplans[me.computer];
me.temporaryFlagFpln = 1;
}
me._setupPageWithData();
},
getText: func(type) {
if (type == "fplnEnd") {
return "------END OF F-PLN------";
} else if (type == "altnFplnEnd") {
return "----END OF ALTN F-PLN---";
} else if (type == "noAltnFpln") {
return "------NO ALTN F-PLN-----";
} else if (type == "empty") {
return "";
}
},
createPlanList: func() {
me.planList = [];
if (me.temporaryFlagFpln) {
for (var i = 0; i < me.plan.getPlanSize(); i += 1) {
append(me.planList, fplnItem.new(me.plan.getWP(i), i, me.plan, me.computer, "yel"));
}
} else {
for (var i = 0; i < me.plan.getPlanSize(); i += 1) {
append(me.planList, fplnItem.new(me.plan.getWP(i), i, me.plan, me.computer));
}
}
append(me.planList, staticText.new(me.computer, me.getText("fplnEnd")));
append(me.planList, staticText.new(me.computer, me.getText("noAltnFpln")));
me.basePage();
},
basePage: func() {
me.outputList = [];
for (var i = 0; i + me.scroll < size(me.planList); i += 1) {
append(me.outputList, me.planList[i + me.scroll] );
}
if (size(me.outputList) >= 1) {
me.L1 = me.outputList[0].updateLeftText();
me.C1 = me.outputList[0].updateCenterText();
me.C1[1] = "TIME ";
me.R1 = me.outputList[0].updateRightText();
me.R1[1] = "SPD/ALT ";
} else {
me.L1 = [nil, nil, "ack"];
me.C1 = [nil, nil, "ack"];
me.R1 = [nil, nil, "ack"];
}
if (size(me.outputList) >= 2) {
me.L2 = me.outputList[1].updateLeftText();
me.C2 = me.outputList[1].updateCenterText();
me.R2 = me.outputList[1].updateRightText();
} else {
me.L2 = [nil, nil, "ack"];
me.C2 = [nil, nil, "ack"];
me.R2 = [nil, nil, "ack"];
}
if (size(me.outputList) >= 3) {
me.L3 = me.outputList[2].updateLeftText();
me.C3 = me.outputList[2].updateCenterText();
me.R3 = me.outputList[2].updateRightText();
} else {
me.L3 = [nil, nil, "ack"];
me.C3 = [nil, nil, "ack"];
me.R3 = [nil, nil, "ack"];
}
if (size(me.outputList) >= 4) {
me.L4 = me.outputList[3].updateLeftText();
me.C4 = me.outputList[3].updateCenterText();
me.R4 = me.outputList[3].updateRightText();
} else {
me.L4 = [nil, nil, "ack"];
me.C4 = [nil, nil, "ack"];
me.R4 = [nil, nil, "ack"];
}
if (size(me.outputList) >= 5) {
me.L5 = me.outputList[4].updateLeftText();
me.C5 = me.outputList[4].updateCenterText();
me.R5 = me.outputList[4].updateRightText();
} else {
me.L5 = [nil, nil, "ack"];
me.C5 = [nil, nil, "ack"];
me.R5 = [nil, nil, "ack"];
}
},
destInfo: func() {
if (me.plan.getWP(fmgc.flightPlanController.arrivalIndex[me.planIndex]) != nil) {
me.L6 = [left(me.plan.getWP(fmgc.flightPlanController.arrivalIndex[me.planIndex]).wp_name, 4), " DEST", "wht"];
} else {
me.L6 = ["----", " DEST", "wht"];
}
if (fmgc.flightPlanController.arrivalDist != nil) {
me.C6 = ["---- " ~ int(fmgc.flightPlanController.arrivalDist), "TIME DIST", "wht"];
} else {
me.C6 = ["---- ----", "TIME DIST", "wht"];
}
me.R6 = ["--.-", "EFOB", "wht"];
},
update: func() {
#me.basePage();
},
scrollUp: func() {
if (size(me.planList) > 5) {
me.scroll += 1;
if (me.scroll > size(me.planList) - 5) {
me.scroll = 0;
}
} else {
me.scroll = 0;
}
},
scrollDn: func() {
if (size(me.planList) > 5) {
me.scroll -= 1;
if (me.scroll < 0) {
me.scroll = size(me.planList) - 5;
}
} else {
me.scroll = 0;
}
},
pushButtonLeft: func(index) {
if (index == 6) {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
} else {
if (canvas_mcdu.myLatRev[me.computer] != nil) {
canvas_mcdu.myLatRev[me.computer].del();
}
canvas_mcdu.myLatRev[me.computer] = nil;
canvas_mcdu.myLatRev[me.computer] = latRev.new(1, me.L6[0], fmgc.flightPlanController.arrivalIndex[me.computer], me.computer);
setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV");
}
} else {
if (size(me.outputList) >= index) {
if (size(getprop("MCDU[" ~ me.computer ~ "]/scratchpad")) > 0) {
var returny = fmgc.flightPlanController.scratchpad(getprop("MCDU[" ~ me.computer ~ "]/scratchpad"), (index - 1 + me.scroll), me.computer);
if (returny == 3) {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
} elsif (returny == 0) {
notInDataBase(me.computer);
} elsif (returny == 1) {
notAllowed(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", "");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "");
}
} else {
me.outputList[index - 1].pushButtonLeft();
}
} else {
notAllowed(me.computer);
}
}
},
pushButtonRight: func(index) {
if (index == 6) {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (dirToFlag) { dirToFlag = 0; }
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
} else {
notAllowed(me.computer);
}
} else {
if (size(me.outputList) >= index) {
if (size(getprop("MCDU[" ~ me.computer ~ "]/scratchpad")) > 0) {
notAllowed(me.computer);
} else {
me.outputList[index - 1].pushButtonRight();
}
} else {
notAllowed(me.computer);
}
}
},
};
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"));
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "NOT IN DATABASE");
}
var decimalToShortString = func(dms, type) {
var degrees = split(".", sprintf(dms))[0];
if (type == "lat") {
var sign = degrees >= 0 ? "N" : "S";
} else {
var sign = degrees >= 0 ? "E" : "W";
}
return abs(degrees) ~ sign;
}

76
Nasal/MCDU/HOLD.nas Normal file
View file

@ -0,0 +1,76 @@
var holdPage = {
title: [nil, nil, nil],
subtitle: [nil, 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"],
scroll: 0,
vector: [],
index: nil,
computer: nil,
new: func(computer, waypoint) {
var hp = {parents:[holdPage]};
hp.computer = computer;
hp.waypoint = waypoint;
hp.updateTmpy();
hp._setupPageWithData();
return hp;
},
del: func() {
return nil;
},
_setupPageWithData: func() {
# me.title = ["LAT REV", " AT ", me.waypoint.wp_name]; TODO FIXME LATREV
me.title = ["HOLD", " AT ", me.waypoint];
me.titleColour = "wht";
me.L1 = [" [ ]", " INB CRS", "blu"];
me.L2 = [" R", " TURN", "blu"];
if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) {
me.L2 = [" 1.5/----", "TIME/DIST", "blu"];
} else {
me.L2 = [" 1.0/----", "TIME/DIST", "blu"];
}
me.L6 = [" RETURN", nil, "wht"];
me.C4 = ["LAST EXIT", nil, "wht"];
me.C5 = ["---- ---.-", "UTC FUEL", "wht"];
me.R1 = ["COMPUTED ", nil, "blu"];
me.R2 = ["DATABASE ", nil, "blu"];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["blu", "blu", "ack", "ack", "ack", "ack"]];
me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
}
},
updateTmpy: func() {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.L6 = [" F-PLN", " TMPY", "yel"];
me.arrowsColour[0][5] = "yel";
me.R2[2] = "yel";
me.R3[2] = "yel";
me.R4[2] = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}
}
};

View file

@ -99,10 +99,11 @@ var initInputA = func(key, i) {
}
} else if (key == "R1") {
if (scratchpad == "CLR") {
clearFPLNComputer();
setprop("FMGC/internal/dep-arpt", "");
setprop("FMGC/internal/arr-arpt", "");
setprop("FMGC/internal/tofrom-set", 0);
fmgc.updateARPT();
fmgc.flightPlanController.reset();
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (scratchpad == "") {
@ -119,7 +120,7 @@ var initInputA = func(key, i) {
setprop("FMGC/internal/arr-arpt", fromto[1]);
setprop("FMGC/internal/tofrom-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateARPT();
fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2);
setprop("FMGC/internal/alt-selected", 0);
setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else {

191
Nasal/MCDU/LATREV.nas Normal file
View file

@ -0,0 +1,191 @@
var latRev = {
title: [nil, nil, nil],
subtitle: [nil, 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"],
R1: [nil, nil, "ack"],
R2: [nil, nil, "ack"],
R3: [nil, nil, "ack"],
R4: [nil, nil, "ack"],
R5: [nil, nil, "ack"],
R6: [nil, nil, "ack"],
depAirport: nil,
arrAirport: nil,
index: nil,
computer: nil,
new: func(type, id, index, computer) {
var lr = {parents:[latRev]};
lr.type = type; # 0 = origin 1 = destination 2 = ppos (from waypoint) 3 = generic wpt, 4 = discon
lr.id = id;
lr.index = index;
lr.computer = computer;
lr._setupPageWithData();
lr._checkTmpy();
return lr;
},
del: func() {
return nil;
},
_checkTmpy: func() {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.L6 = [" F-PLN", " TMPY", "yel"];
me.arrowsColour[0][5] = "yel";
me.R2[2] = "yel";
me.R3[2] = "yel";
me.R4[2] = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}
},
_setupPageWithData: func() {
if (me.type == 2) {
me.title = ["LAT REV", " FROM ", "PPOS"];
me.L2 = [" OFFSET", nil, "wht"];
me.L3 = [" HOLD", nil, "wht"];
me.L6 = [" RETURN", nil, "wht"];
me.R1 = ["FIX INFO ", nil, "wht"];
me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"];
me.arrowsMatrix = [[0, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "wht", "wht", "ack", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0]];
} elsif (me.type == 4) {
me.title = ["LAT REV", " FROM ", "DISCON"];
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
me.R4 = ["[ ]", "NEW DEST", "blu"];
me.L6 = [" RETURN", nil, "wht"];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0]];
} else {
me.title = ["LAT REV", " FROM ", me.id];
if (me.type == 0) {
if (size(me.id) > 4) {
me.depAirport = findAirportsByICAO(left(me.id, 4));
} else {
me.depAirport = findAirportsByICAO(me.id);
}
me.subtitle = [dmsToString(sprintf(me.depAirport[0].lat), "lat"), dmsToString(sprintf(me.depAirport[0].lon), "lon")];
me.L1 = [" DEPARTURE", nil, "wht"];
me.L2 = [" OFFSET", nil, "wht"];
me.L6 = [" RETURN", nil, "wht"];
me.R1 = ["FIX INFO ", nil, "wht"];
me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"];
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
me.R4 = ["[ ]", "NEW DEST", "blu"];
me.arrowsMatrix = [[1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0]];
me.arrowsColour = [["wht", "wht", "ack", "ack", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0]];
} elsif (me.type == 1) {
if (size(me.id) > 4) {
me.arrAirport = findAirportsByICAO(left(me.id, 4));
} else {
me.arrAirport = findAirportsByICAO(me.id);
}
me.subtitle = [dmsToString(sprintf(me.arrAirport[0].lat), "lat"), dmsToString(sprintf(me.arrAirport[0].lon), "lon")];
me.L3 = [" ALTN", nil, "wht"];
me.L4 = [" ALTN", " ENABLE", "blu"];
me.L6 = [" RETURN", nil, "wht"];
me.R1 = ["ARRIVAL ", nil, "wht"];
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
me.arrowsMatrix = [[0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "wht", "blu", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0]];
} elsif (me.type == 3) {
if (size(me.id) == 2 or size(me.id) == 3) {
me.wpt = findNavaidsByID(me.id);
} elsif (size(me.id) == 4) {
me.wpt = findAirportsByICAO(me.id);
} elsif (size(me.id) == 5) {
me.wpt = findFixesByID(me.id);
}
if (me.wpt[0] != nil) {
me.subtitle = [dmsToString(sprintf(me.wpt[0].lat), "lat"), dmsToString(sprintf(me.wpt[0].lon), "lon")];
}
me.L3 = [" HOLD", nil, "wht"];
me.L4 = [" ALTN", " ENABLE", "blu"];
me.L6 = [" RETURN", nil, "wht"];
me.R1 = ["FIX INFO ", nil, "wht"];
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
me.R4 = ["[ ]", "NEW DEST", "blu"];
me.R5 = ["AIRWAYS ", nil, "wht"];
me.arrowsMatrix = [[0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 1, 0]];
me.arrowsColour = [["ack", "ack", "wht", "blu", "ack", "wht"], ["wht", "ack", "ack", "ack", "wht", "ack"]];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0]];
}
}
},
makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (!dirToFlag) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
me._checkTmpy();
}
},
nextWpt: func() {
me.makeTmpy();
var returny = fmgc.flightPlanController.scratchpad(getprop("/MCDU[" ~ me.computer ~ "]/scratchpad"), me.index + 1, me.computer);
if (returny == 0) {
notInDataBase(me.computer);
} elsif (returny == 1) {
notAllowed(me.computer);
} else {
setprop("/MCDU[" ~ me.computer ~ "]/scratchpad-msg", "");
setprop("/MCDU[" ~ me.computer ~ "]/scratchpad", "");
fmgc.flightPlanController.flightPlanChanged(me.computer);
if (getprop("/MCDU[" ~ me.computer ~ "]/page") != "DUPLICATENAMES") {
setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
}
}
},
};
var dmsToString = func(dms, type) {
var degrees = int(dms);
var minutes = sprintf("%.1f",abs((dms - degrees) * 60));
if (type == "lat") {
var sign = degrees >= 0 ? "N" : "S";
} else {
var sign = degrees >= 0 ? "E" : "W";
}
return abs(degrees) ~ "g" ~ minutes ~ " " ~ sign;
}
var stringToDegrees = func(string, type) {
if (type == "lat") {
var degrees = left(string, 2);
var minutesStr = right(string, 5);
} else {
var degrees = left(string, 3);
var minutesStr = right(string, 5);
}
var minutes = left(minutesStr, 4);
var sign = right(minutesStr, 1);
var decimal = degrees + (minutes / 60);
if (type == "lat") {
if (sign == "N") {
return decimal;
} else {
return -decimal;
}
} else {
if (sign == "E") {
return decimal;
} else {
return -decimal;
}
}
}

View file

@ -202,6 +202,23 @@ var lskbutton = func(btn, i) {
printInput("L1",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("L1",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "LATREV") {
if (canvas_mcdu.myLatRev[i].type == 0) {
if (canvas_mcdu.myDeparture[i] != nil) {
canvas_mcdu.myDeparture[i].del();
}
canvas_mcdu.myDeparture[i] = nil;
canvas_mcdu.myDeparture[i] = departurePage.new(canvas_mcdu.myLatRev[i].title[2], i);
setprop("MCDU[" ~ i ~ "]/page", "DEPARTURE");
} else {
notAllowed(i);
}
} else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(1);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].fieldL1(getprop("MCDU[" ~ i ~ "]/scratchpad"));
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
canvas_mcdu.myDuplicate[i].pushButtonLeft(1);
} else {
notAllowed(i);
}
@ -228,6 +245,16 @@ var lskbutton = func(btn, i) {
printInput("L2",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("L2",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(2);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].depPushbuttonLeft(2);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonLeft(2);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].leftFieldBtn(2);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
canvas_mcdu.myDuplicate[i].pushButtonLeft(2);
} else {
notAllowed(i);
}
@ -250,6 +277,27 @@ var lskbutton = func(btn, i) {
printInput("L3",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("L3",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(3);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].depPushbuttonLeft(3);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonLeft(3);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].leftFieldBtn(3);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "LATREV") {
if (canvas_mcdu.myLatRev[i].type != 0 and canvas_mcdu.myLatRev[i].type != 1) {
if (canvas_mcdu.myHold[i] != nil) {
canvas_mcdu.myHold[i].del();
}
canvas_mcdu.myHold[i] = nil;
canvas_mcdu.myHold[i] = holdPage.new(i, canvas_mcdu.myLatRev[i].id);
setprop("MCDU[" ~ i ~ "]/page", "HOLD");
} else {
notAllowed(i);
}
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
canvas_mcdu.myDuplicate[i].pushButtonLeft(3);
} else {
notAllowed(i);
}
@ -268,6 +316,16 @@ var lskbutton = func(btn, i) {
radnavInput("L4",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("L4",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(4);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].depPushbuttonLeft(4);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonLeft(4);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].leftFieldBtn(4);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
canvas_mcdu.myDuplicate[i].pushButtonLeft(4);
} else {
notAllowed(i);
}
@ -296,6 +354,16 @@ var lskbutton = func(btn, i) {
printInput("L5",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("L5",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(5);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].depPushbuttonLeft(5);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonLeft(5);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].leftFieldBtn(5);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
canvas_mcdu.myDuplicate[i].pushButtonLeft(5);
} else {
notAllowed(i);
}
@ -318,6 +386,18 @@ var lskbutton = func(btn, i) {
perfGAInput("L6",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("L6",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(6);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "LATREV" or getprop("MCDU[" ~ i ~ "]/page") == "VERTREV" or getprop("MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
setprop("MCDU[" ~ i ~ "]/page", "F-PLNA");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE" or getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL" or getprop("MCDU[" ~ i ~ "]/page") == "HOLD") {
if (fmgc.flightPlanController.temporaryFlag[i]) {
setprop("MCDU[" ~ i ~ "]/page", "F-PLNA");
} else {
setprop("MCDU[" ~ i ~ "]/page", "LATREV");
}
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].fieldL6();
} else {
notAllowed(i);
}
@ -340,6 +420,19 @@ var rskbutton = func(btn, i) {
printInput("R1",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("R1",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "LATREV") {
if (canvas_mcdu.myLatRev[i].type == 1) {
if (canvas_mcdu.myArrival[i] != nil) {
canvas_mcdu.myArrival[i].del();
}
canvas_mcdu.myArrival[i] = nil;
canvas_mcdu.myArrival[i] = arrivalPage.new(canvas_mcdu.myLatRev[i].title[2], i);
setprop("MCDU[" ~ i ~ "]/page", "ARRIVAL");
} else {
notAllowed(i);
}
} else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(1);
} else {
notAllowed(i);
}
@ -354,6 +447,12 @@ var rskbutton = func(btn, i) {
printInput("R2",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("R2",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].depPushbuttonRight(2);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonRight(2);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(2);
} else {
notAllowed(i);
}
@ -372,6 +471,18 @@ var rskbutton = func(btn, i) {
printInput("R3",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("R3",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].depPushbuttonRight(3);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonRight(3);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "LATREV") {
if (canvas_mcdu.myLatRev[i].type != 2) {
canvas_mcdu.myLatRev[i].nextWpt();
} else {
notAllowed(i);
}
} else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(3);
} else {
notAllowed(i);
}
@ -384,6 +495,12 @@ var rskbutton = func(btn, i) {
radnavInput("R4",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("R4",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].depPushbuttonRight(4);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonRight(4);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(4);
} else {
notAllowed(i);
}
@ -400,6 +517,12 @@ var rskbutton = func(btn, i) {
radnavInput("R5",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
dataInput("R5",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].depPushbuttonRight(5);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonRight(5);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(5);
} else {
notAllowed(i);
}
@ -436,6 +559,12 @@ var rskbutton = func(btn, i) {
setprop("MCDU[" ~ i ~ "]/scratchpad", "AOC DISABLED");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
initInputA("R6",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(6);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "VERTREV") {
setprop("MCDU/[" ~ i ~ "]/page", "F-PLNA");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].fieldR6();
} else {
notAllowed(i);
}
@ -452,8 +581,7 @@ var arrowbutton = func(btn, i) {
setprop("MCDU[" ~ i ~ "]/page", "DATA2");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA2") {
setprop("MCDU[" ~ i ~ "]/page", "DATA");
}
if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
} else if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) {
setprop("MCDU[" ~ i ~ "]/page", "INITB");
} else {
@ -461,19 +589,21 @@ var arrowbutton = func(btn, i) {
}
} else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB" or getprop("MCDU[" ~ i ~ "]/page") == "FUELPRED") {
setprop("MCDU[" ~ i ~ "]/page", "INITA");
}
if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC2");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].scrollLeft();
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].scrollLeft();
}
} else if (btn == "right") {
if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
setprop("MCDU[" ~ i ~ "]/page", "DATA2");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA2") {
setprop("MCDU[" ~ i ~ "]/page", "DATA");
}
if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
} else if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) {
setprop("MCDU[" ~ i ~ "]/page", "INITB");
} else {
@ -481,16 +611,35 @@ var arrowbutton = func(btn, i) {
}
} else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB" or getprop("MCDU[" ~ i ~ "]/page") == "FUELPRED") {
setprop("MCDU[" ~ i ~ "]/page", "INITA");
}
if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC2");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].scrollRight();
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].scrollRight();
}
} else if (btn == "up") {
# Nothing for now
if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].scrollUp();
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].scrollUp();
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].scrollUp();
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].scrollUp();
}
} else if (btn == "down") {
# Nothing for now
if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].scrollDn();
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].scrollDn();
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].scrollDn();
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].scrollDn();
}
}
}
@ -532,9 +681,31 @@ var pagebutton = func(btn, i) {
setprop("MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM");
setprop("MCDU[" ~ i ~ "]/page", "MCDU");
} else if (btn == "f-pln") {
if (fmgc.flightPlanController.active.getBoolValue()) {
if (canvas_mcdu.myFpln[i] == nil) {
canvas_mcdu.myFpln[i] = fplnPage.new(2, i);
}
setprop("MCDU[" ~ i ~ "]/page", "F-PLNA");
} else {
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "ERROR. INITIALIZE ROUTE"); # Should be ERROR:, but the : character doesn't show in our MCDU font right now...
}
} else if (btn == "fuel-pred") {
setprop("MCDU[" ~ i ~ "]/page", "FUELPRED");
} else if (btn == "dirto") {
if (fmgc.flightPlanController.active.getBoolValue()) {
if (fmgc.flightPlanController.temporaryFlag[i] and !dirToFlag) {
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "INSRT / ERASE TMPY FIRST");
return;
} elsif (canvas_mcdu.myDirTo[i] == nil) {
canvas_mcdu.myDirTo[i] = dirTo.new(i);
}
setprop("MCDU[" ~ i ~ "]/page", "DIRTO");
} else {
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "ERROR. INITIALIZE ROUTE"); # Should be ERROR:, but the : character doesn't show in our MCDU font right now...
}
}
}
}
@ -703,6 +874,18 @@ var notAllowed = func(i) {
setprop("MCDU[" ~ i ~ "]/scratchpad", "NOT ALLOWED");
}
var formatError = func(i) {
if (getprop("MCDU[" ~ i ~ "]/scratchpad") != "FORMAT ERROR") {
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
} else {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
}
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "FORMAT ERROR");
}
var screenFlash = func(time, i) {
var page = getprop("MCDU[" ~ i ~ "]/page");
setprop("MCDU[" ~ i ~ "]/page", "NONE");

110
Nasal/MCDU/VERTREV.nas Normal file
View file

@ -0,0 +1,110 @@
var vertRev = {
title: [nil, nil, nil],
subtitle: [nil, 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"],
R1: [nil, nil, "ack"],
R2: [nil, nil, "ack"],
R3: [nil, nil, "ack"],
R4: [nil, nil, "ack"],
R5: [nil, nil, "ack"],
R6: [nil, nil, "ack"],
depAirport: nil,
arrAirport: nil,
index: nil,
computer: nil,
new: func(type, id, index, computer) {
var vr = {parents:[vertRev]};
vr.type = type; # 0 = origin 1 = destination 2 = wpt not ppos 3 = ppos 4 = cruise wpt 5 = climb wpt (3 + 4 not needed yet)
vr.id = id;
vr.index = index;
vr.computer = computer;
vr._setupPageWithData();
vr._checkTmpy();
return vr;
},
del: func() {
return nil;
},
_checkTmpy: func() {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.L6 = [" F-PLN", " TMPY", "yel"];
me.arrowsColour[0][5] = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}
},
_setupPageWithData: func() {
if (me.type == 3) {
me.title = ["VERT REV", " AT ", "PPOS"];
me.L1 = ["", " EFOB ---.-", "wht"];
me.R1 = ["", "EXTRA ---.- ", "wht"];
me.L2 = [" 250/10000", " CLB SPD LIM", "mag"];
me.L4 = [" CONSTANT MACH", nil, "wht"];
me.L5 = [" WIND DATA", nil, "wht"];
me.L6 = [" RETURN", nil, "wht"];
me.R5 = ["STEP ALTS ", nil, "wht"];
me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]];
me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "wht"], ["ack", "ack", "ack", "ack", "wht", "wht"]];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
} if (me.type == 2) {
me.title = ["VERT REV", " AT ", me.id];
me.L1 = ["", " EFOB ---.-", "wht"];
me.R1 = ["", "EXTRA ---.- ", "wht"];
me.L2 = [" 250/10000", " CLB SPD LIM", "mag"];
me.L3 = [" [ ]", " SPD CSTR", "blu"];
me.L4 = [" CONSTANT MACH", nil, "wht"];
me.L5 = [" WIND DATA", nil, "wht"];
me.L6 = [" CLB", nil, "wht"];
me.R2 = ["[ ] ", "UTC CSTR ", "blu"];
me.R3 = ["[ ] ", "ALT CSTR ", "blu"];
me.R5 = ["STEP ALTS ", nil, "wht"];
me.R6 = ["DES ", nil, "wht"];
me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]];
me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "wht"], ["ack", "ack", "ack", "ack", "wht", "wht"]];
me.fontMatrix = [[0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0]];
} else {
me.title = ["VERT REV", " AT ", me.id];
if (me.type == 0) {
# dunno
} elsif (me.type == 1) {
if (size(me.id) > 4) {
me.arrAirport = findAirportsByICAO(left(me.id, 4));
} else {
me.arrAirport = findAirportsByICAO(me.id);
}
me.L1 = ["", " EFOB ---.-", "wht"];
me.R1 = ["", "EXTRA ---.- ", "wht"];
me.L2 = [" 250/10000", " DES SPD LIM", "mag"];
me.L4 = [" CONSTANT MACH", nil, "wht"];
me.L5 = [" WIND DATA", nil, "wht"];
me.L6 = [" CLB", nil, "wht"];
me.R2 = ["[ ] ", "UTC CSTR ", "blu"];
me.R3 = ["[ ]", "G/S INTCPT ", "grn"];
me.R5 = ["STEP ALTS ", nil, "wht"];
me.R6 = ["DES ", nil, "wht"];
me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]];
me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "wht"], ["ack", "ack", "ack", "ack", "wht", "wht"]];
me.fontMatrix = [[0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0]];
}
}
},
makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (!dirToFlag) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
me._checkTmpy();
}
},
};

View file

@ -205,6 +205,7 @@ var systemsInit = func {
systems.eng_init();
systems.fire_init();
systems.autobrake_init();
fmgc.flightPlanController.reset();
fadec.FADEC.init();
fmgc.ITAF.init();
fmgc.FMGCinit();
@ -226,6 +227,7 @@ var systemsInit = func {
setlistener("/sim/signals/fdm-initialized", func {
systemsInit();
fmgc.flightPlanTimer.start();
});
var systemsLoop = maketimer(0.1, func {

View file

@ -73,6 +73,9 @@ var Instrumentation = {
AirspeedIndicator: {
indicatedSpdKt: props.globals.getNode("instrumentation/airspeed-indicator/indicated-speed-kt"),
},
Altimeter: {
indicatedFt: props.globals.getNode("instrumentation/altimeter[0]/indicated-altitude-ft"),
},
TCAS: {
Inputs: {
mode: props.globals.getNode("instrumentation/tcas/inputs/mode"),

View file

@ -1557,9 +1557,11 @@
<mode>once</mode>
<type>avionics</type>
<condition>
<property>/sim/current-view/internal</property>
<property>/sim/sound/warnings/chime</property>
</condition>
<volume>
<property>/sim/current-view/internal</property>
</volume>
<reference-dist>10</reference-dist>
<max-dist>100</max-dist>
</chime>

View file

@ -449,7 +449,7 @@
</condition>
<expression>
<sum>
<property>/autopilot/route-manager/wp[0]/true-bearing-deg</property>
<property>/FMGC/flightplan[2]/current-leg-course</property>
<product>
<property>/it-autoflight/internal/drift-angle-deg</property>
<value>-1.0</value>

View file

@ -296,6 +296,16 @@
<legend>DIR</legend>
<pref-height>25</pref-height>
<pref-width>40</pref-width>
<binding>
<command>nasal</command>
<script>mcdu.pagebutton("dirto", 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

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