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> <dialog-name>autopilot</dialog-name>
</binding> </binding>
</item> </item>
<item>
<label>Route Manager</label>
<binding>
<command>dialog-show</command>
<dialog-name>route-manager</dialog-name>
</binding>
</item>
</menu> </menu>
<menu n="102"> <menu n="102">
<label>DU</label> <label>DU</label>
@ -432,7 +425,7 @@
<z-offset-max-m type="float">300.0</z-offset-max-m> <z-offset-max-m type="float">300.0</z-offset-max-m>
</current-view> </current-view>
<minimum-fg-version>2019.2.0</minimum-fg-version> <minimum-fg-version>2019.1.2</minimum-fg-version>
</sim> </sim>
<consumables> <consumables>
@ -3911,11 +3904,20 @@
<file>Aircraft/A320-family/Nasal/FMGC/FCU.nas</file> <file>Aircraft/A320-family/Nasal/FMGC/FCU.nas</file>
</fcu> </fcu>
<fmgc> <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.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/FMGC-b.nas</file> <file>Aircraft/A320-family/Nasal/FMGC/FMGC-b.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/FMGC-c.nas</file> <file>Aircraft/A320-family/Nasal/FMGC/FMGC-c.nas</file>
</fmgc> </fmgc>
<mcdu> <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/MCDU.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/INITA.nas</file> <file>Aircraft/A320-family/Nasal/MCDU/INITA.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/IRSINIT.nas</file> <file>Aircraft/A320-family/Nasal/MCDU/IRSINIT.nas</file>

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

@ -30,6 +30,14 @@
</emission> </emission>
</animation> </animation>
<effect>
<inherits-from>Effects/model-interior-display</inherits-from>
<object-name>mcdu1.screen</object-name>
<parameters>
<contrast>0.7</contrast>
</parameters>
</effect>
<animation> <animation>
<type>pick</type> <type>pick</type>
<object-name>BRT</object-name> <object-name>BRT</object-name>
@ -276,6 +284,31 @@
</action> </action>
</animation> </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> <animation>
<type>pick</type> <type>pick</type>
<object-name>L1</object-name> <object-name>L1</object-name>

View file

@ -30,6 +30,14 @@
</emission> </emission>
</animation> </animation>
<effect>
<inherits-from>Effects/model-interior-display</inherits-from>
<object-name>mcdu2.screen</object-name>
<parameters>
<contrast>0.7</contrast>
</parameters>
</effect>
<animation> <animation>
<type>pick</type> <type>pick</type>
<object-name>BRT</object-name> <object-name>BRT</object-name>
@ -276,6 +284,31 @@
</action> </action>
</animation> </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> <animation>
<type>pick</type> <type>pick</type>
<object-name>L1</object-name> <object-name>L1</object-name>

View file

@ -872,6 +872,579 @@
y="83.814453" 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> 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>
<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 <g
inkscape:label="INITA" inkscape:label="INITA"
id="INITA" id="INITA"
@ -1973,4 +2546,4 @@
id="tspan1144" id="tspan1144"
sodipodi:role="line">=</tspan></text> sodipodi:role="line">=</tspan></text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 135 KiB

View file

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

View file

@ -37,4 +37,12 @@
</emission> </emission>
</animation> </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> </PropertyList>

View file

@ -5,8 +5,8 @@
# Copyright (c) 2019 Joshua Davidson (Octal450) # Copyright (c) 2019 Joshua Davidson (Octal450)
var get_local_path = func(file){ 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; return "Aircraft/" ~ aircraft_dir ~ "/Models/Instruments/ND/canvas/"~ file;
}; };
var version = getprop("sim/version/flightgear"); var version = getprop("sim/version/flightgear");

View file

@ -5,107 +5,118 @@
# Copyright (c) 2019 Joshua Davidson (Octal450) # Copyright (c) 2019 Joshua Davidson (Octal450)
var A3XXRouteDriver = { var A3XXRouteDriver = {
new: func(){ new: func(){
var m = { var m = {
parents: [A3XXRouteDriver], parents: [A3XXRouteDriver],
}; };
m.init(); m.init();
return m; return m;
}, },
init: func(){ init: func(){
me.update(); me.update();
}, },
update: func(){ update: func(){
me.flightplan = flightplan(); me.flightplan = fmgc.flightPlanController.flightplans[2];
}, },
getNumberOfFlightPlans: func(){1}, getNumberOfFlightPlans: func(){1},
getFlightPlanType: func(fpNum){"current"}, getFlightPlanType: func(fpNum){"current"},
getFlightPlan: func(fpNum){me.flightplan}, getFlightPlan: func(fpNum){me.flightplan},
getPlanSize: func(fpNum){me.flightplan.getPlanSize()}, getPlanSize: func(fpNum){me.flightplan.getPlanSize()},
getWP: func(fpNum, idx){me.flightplan.getWP(idx)}, getWP: func(fpNum, idx){me.flightplan.getWP(idx)},
getPlanModeWP: func(plan_wp_idx){me.flightplan.getWP(plan_wp_idx)}, getPlanModeWP: func(plan_wp_idx){me.flightplan.getWP(plan_wp_idx)},
hasDiscontinuity: func(fpNum, wptID){0}, hasDiscontinuity: func(fpNum, wptID){0},
getListeners: func(){[]}, triggerSignal: func(signal){
shouldUpdate: func 1 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
}; };
var MultiA3XXRouteDriver = { var MultiA3XXRouteDriver = {
parents: [A3XXRouteDriver], parents: [A3XXRouteDriver],
new: func(){ new: func(){
var m = { var m = {
parents: [MultiA3XXRouteDriver], parents: [MultiA3XXRouteDriver],
_flightplans: [], _flightplans: [],
currentFlightPlan: 0 currentFlightPlan: 0
}; };
m.init(); m.init();
return m; return m;
}, },
addFlightPlan: func(type, plan){ addFlightPlan: func(type, plan){
append(me._flightplans, { append(me._flightplans, {
type: type, type: type,
flightplan: plan flightplan: plan
}); });
}, },
removeFlightPlanAtIndex: func(idx){ removeFlightPlanAtIndex: func(idx){
var sz = size(me._flightplans); var sz = size(me._flightplans);
if(idx < sz){ if(idx < sz){
if(sz == 1) if(sz == 1)
me._flightplans = []; me._flightplans = [];
elsif(sz == 2 and idx == 0) elsif(sz == 2 and idx == 0)
me._flightplans = [me._flightplans[1]]; me._flightplans = [me._flightplans[1]];
elsif(sz == 2 and idx == 1) elsif(sz == 2 and idx == 1)
pop(me._flightplans); pop(me._flightplans);
else { else {
var subv_l = subvec(me._flightplans, 0, idx); var subv_l = subvec(me._flightplans, 0, idx);
var subv_r = subvec(me._flightplans, idx + 1); var subv_r = subvec(me._flightplans, idx + 1);
me._flightplans = subv_l ~ subv_r; me._flightplans = subv_l ~ subv_r;
} }
} }
me.triggerSignal("fp-added"); me.triggerSignal("fp-added");
}, },
removeFlightPlanOfType: func(type){ removeFlightPlanOfType: func(type){
var new_vec = []; var new_vec = [];
foreach(var fp; me._flightplans){ foreach(var fp; me._flightplans){
if(fp["type"] != type) if(fp["type"] != type)
append(new_vec, fp); append(new_vec, fp);
} }
me._flightplans = new_vec; me._flightplans = new_vec;
me.triggerSignal("fp-removed"); me.triggerSignal("fp-removed");
}, },
getNumberOfFlightPlans: func(){ getNumberOfFlightPlans: func(){
size(me._flightplans); size(me._flightplans);
}, },
getFlightPlanType: func(fpNum){ getFlightPlanType: func(fpNum){
if(fpNum >= size(me._flightplans)) return nil; if(fpNum >= size(me._flightplans)) return nil;
var fp = me._flightplans[fpNum]; var fp = me._flightplans[fpNum];
return fp.type; return fp.type;
}, },
getFlightPlan: func(fpNum){ getFlightPlan: func(fpNum){
if(fpNum >= size(me._flightplans)) return nil; if(fpNum >= size(me._flightplans)) return nil;
return me._flightplans[fpNum]; return me._flightplans[fpNum];
}, },
getPlanSize: func(fpNum){ getPlanSize: func(fpNum){
if(fpNum >= size(me._flightplans)) return 0; if(fpNum >= size(me._flightplans)) return 0;
return me._flightplans[fpNum].getPlanSize(); return me._flightplans[fpNum].getPlanSize();
}, },
getWP: func(fpNum, idx){ getWP: func(fpNum, idx){
if(fpNum >= size(me._flightplans)) return nil; if(fpNum >= size(me._flightplans)) return nil;
var fp = me._flightplans[fpNum].getPlanSize(); var fp = me._flightplans[fpNum].getPlanSize();
return fp.getWP(idx); return fp.getWP(idx);
}, },
getPlanModeWP: func(idx){ getPlanModeWP: func(idx){
if(me.currentFlightPlan >= size(me._flightplans)) return nil; if(me.currentFlightPlan >= size(me._flightplans)) return nil;
var fp = me._flightplans[me.currentFlightPlan]; var fp = me._flightplans[me.currentFlightPlan];
return fp.getWP(idx); return fp.getWP(idx);
}, },
triggerSignal: func(signal){ 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; signalPath: func(signal){
}, "autopilot/route-manager/signals/rd-"~ signal;
getListeners: func(){[ },
me.getSignal("fp-added"), getListeners: func(){[
me.getSignal("fp-removed") me.getSignal("fp-added"),
]} me.getSignal("fp-removed")
]}
}; };

View file

@ -5,23 +5,23 @@
# Copyright (c) 2019 Joshua Davidson (Octal450) # Copyright (c) 2019 Joshua Davidson (Octal450)
canvas.NDConfig = { canvas.NDConfig = {
properties: { properties: {
des_apt: "/autopilot/route-manager/destination/airport", des_apt: "/autopilot/route-manager/destination/airport",
dep_apt: "/autopilot/route-manager/departure/airport", dep_apt: "/autopilot/route-manager/departure/airport",
des_rwy: "/autopilot/route-manager/destination/runway", des_rwy: "/autopilot/route-manager/destination/runway",
dep_rwy: "/autopilot/route-manager/departure/runway", dep_rwy: "/autopilot/route-manager/departure/runway",
fplan_active: "autopilot/route-manager/active", fplan_active: "autopilot/route-manager/active",
athr: "/it-autoflight/output/athr", athr: "/it-autoflight/output/athr",
cur_wp: "/autopilot/route-manager/current-wp", cur_wp: "/autopilot/route-manager/current-wp",
vnav_node: "/autopilot/route-manager/vnav/", vnav_node: "/autopilot/route-manager/vnav/",
spd_node: "/autopilot/route-manager/spd/", spd_node: "/autopilot/route-manager/spd/",
holding: "/flight-management/hold", holding: "/flight-management/hold",
holding_points: "/flight-management/hold/points", holding_points: "/flight-management/hold/points",
adf1_frq: "instrumentation/adf[0]/frequencies/selected-khz", adf1_frq: "instrumentation/adf[0]/frequencies/selected-khz",
adf2_frq: "instrumentation/adf[1]/frequencies/selected-khz", adf2_frq: "instrumentation/adf[1]/frequencies/selected-khz",
nav1_frq: "instrumentation/nav[0]/frequencies/selected-mhz", nav1_frq: "instrumentation/nav[0]/frequencies/selected-mhz",
nav2_frq: "instrumentation/nav[1]/frequencies/selected-mhz", nav2_frq: "instrumentation/nav[1]/frequencies/selected-mhz",
lat_ctrl: "/it-autoflight/output/lat", lat_ctrl: "/it-autoflight/output/lat",
ver_ctrl: "/it-autoflight/output/vert", ver_ctrl: "/it-autoflight/output/vert",
} }
}; };

View file

@ -5,141 +5,141 @@
# Copyright (c) 2019 Joshua Davidson (Octal450) # Copyright (c) 2019 Joshua Davidson (Octal450)
var SymbolPainter = { var SymbolPainter = {
aircraft_dir: nil, aircraft_dir: nil,
getOpts: func(opts){ getOpts: func(opts){
if(opts == nil) opts = {}; if(opts == nil) opts = {};
var defOpts = {id:nil,color:nil,scale:1,create_group:0,update_center:0}; var defOpts = {id:nil,color:nil,scale:1,create_group:0,update_center:0};
if(contains(opts, "id")) if(contains(opts, "id"))
defOpts.id = opts.id; defOpts.id = opts.id;
if(contains(opts, "color")) if(contains(opts, "color"))
defOpts.color = opts.color; defOpts.color = opts.color;
if(contains(opts, "scale")) if(contains(opts, "scale"))
defOpts.scale = opts.scale; defOpts.scale = opts.scale;
if(contains(opts, "create_group")) if(contains(opts, "create_group"))
defOpts.create_group = opts.create_group; defOpts.create_group = opts.create_group;
if(contains(opts, "update_center")) if(contains(opts, "update_center"))
defOpts.update_center = opts.update_center; defOpts.update_center = opts.update_center;
return defOpts; return defOpts;
}, },
getAircraftDir: func(){ getAircraftDir: func(){
if(me.aircraft_dir == nil) 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; return me.aircraft_dir;
}, },
svgPath: func(file){ svgPath: func(file){
return "Aircraft/" ~ me.getAircraftDir() ~ "/Models/Instruments/ND/canvas/res/"~file; return "Aircraft/" ~ me.getAircraftDir() ~ "/Models/Instruments/ND/canvas/res/"~file;
}, },
drawFIX : func(grp, opts = nil){ drawFIX : func(grp, opts = nil){
var icon_fix = nil; var icon_fix = nil;
opts = me.getOpts(opts); opts = me.getOpts(opts);
var sym_id = opts.id; var sym_id = opts.id;
if(sym_id != nil) if(sym_id != nil)
icon_fix = grp.createChild("path", sym_id); icon_fix = grp.createChild("path", sym_id);
else else
icon_fix = grp.createChild("path"); icon_fix = grp.createChild("path");
var color = opts.color; var color = opts.color;
if(color == nil){ if(color == nil){
color = { color = {
r: 0.69, r: 0.69,
g: 0, g: 0,
b: 0.39 b: 0.39
}; };
} }
var scale = opts.scale; var scale = opts.scale;
if(scale == nil) scale = 0.8; if(scale == nil) scale = 0.8;
icon_fix.moveTo(-10,0) icon_fix.moveTo(-10,0)
.lineTo(0,-17) .lineTo(0,-17)
.lineTo(10,0) .lineTo(10,0)
.lineTo(0,17) .lineTo(0,17)
.close() .close()
.setStrokeLineWidth(3) .setStrokeLineWidth(3)
.setColor(color.r,color.g,color.b) .setColor(color.r,color.g,color.b)
.setScale(scale,scale); .setScale(scale,scale);
return icon_fix; return icon_fix;
}, },
drawVOR: func(grp, opts = nil){ drawVOR: func(grp, opts = nil){
opts = me.getOpts(opts); opts = me.getOpts(opts);
if(opts.create_group){ if(opts.create_group){
var sym_id = opts.id; var sym_id = opts.id;
if(sym_id != nil) if(sym_id != nil)
grp = grp.createChild("group", sym_id); grp = grp.createChild("group", sym_id);
else else
grp = grp.createChild("group"); grp = grp.createChild("group");
} }
var svg_path = me.svgPath("airbus_vor.svg"); var svg_path = me.svgPath("airbus_vor.svg");
canvas.parsesvg(grp, svg_path); canvas.parsesvg(grp, svg_path);
var scale = opts.scale; var scale = opts.scale;
if(scale == nil) scale = 0.8; if(scale == nil) scale = 0.8;
grp.setScale(scale,scale); grp.setScale(scale,scale);
if(opts.update_center) if(opts.update_center)
grp.setTranslation(-24 * scale,-24 * scale); grp.setTranslation(-24 * scale,-24 * scale);
if(!contains(grp, "setColor")){ if(!contains(grp, "setColor")){
grp.setColor = func { grp.setColor = func {
var layer1 = grp.getElementById("layer1"); var layer1 = grp.getElementById("layer1");
if(layer1 == nil) return; if(layer1 == nil) return;
var children = layer1.getChildren(); var children = layer1.getChildren();
foreach(var c; children){ foreach(var c; children){
if(isa(c, canvas.Path)) if(isa(c, canvas.Path))
c.setColor(arg); c.setColor(arg);
} }
}; };
} }
return grp; return grp;
}, },
drawNDB: func(grp, opts = nil){ drawNDB: func(grp, opts = nil){
var icon_ndb = nil; var icon_ndb = nil;
opts = me.getOpts(opts); opts = me.getOpts(opts);
var sym_id = opts.id; var sym_id = opts.id;
if(sym_id != nil) if(sym_id != nil)
icon_ndb = grp.createChild("path", sym_id); icon_ndb = grp.createChild("path", sym_id);
else else
icon_ndb = grp.createChild("path"); icon_ndb = grp.createChild("path");
var color = opts.color; var color = opts.color;
var color = opts.color; var color = opts.color;
if(color == nil){ if(color == nil){
color = { color = {
r: 0.69, r: 0.69,
g: 0, g: 0,
b: 0.39 b: 0.39
}; };
} }
var scale = opts.scale; var scale = opts.scale;
if(scale == nil) scale = 0.8; if(scale == nil) scale = 0.8;
icon_ndb.moveTo(-15,15) icon_ndb.moveTo(-15,15)
.lineTo(0,-15) .lineTo(0,-15)
.lineTo(15,15) .lineTo(15,15)
.close() .close()
.setStrokeLineWidth(3) .setStrokeLineWidth(3)
.setColor(color.r,color.g,color.b) .setColor(color.r,color.g,color.b)
.setScale(scale,scale); .setScale(scale,scale);
return icon_ndb; return icon_ndb;
}, },
drawAirport: func(grp, opts = nil){ drawAirport: func(grp, opts = nil){
opts = me.getOpts(opts); opts = me.getOpts(opts);
if(opts.create_group){ if(opts.create_group){
var sym_id = opts.id; var sym_id = opts.id;
if(sym_id != nil) if(sym_id != nil)
grp = grp.createChild("group", sym_id); grp = grp.createChild("group", sym_id);
else else
grp = grp.createChild("group"); grp = grp.createChild("group");
} }
var svg_path = me.svgPath("airbus_airport.svg"); var svg_path = me.svgPath("airbus_airport.svg");
canvas.parsesvg(grp, svg_path); canvas.parsesvg(grp, svg_path);
var scale = opts.scale; var scale = opts.scale;
if(scale == nil) scale = 0.8; if(scale == nil) scale = 0.8;
grp.setScale(scale,scale); grp.setScale(scale,scale);
if(opts.update_center) if(opts.update_center)
grp.setTranslation(-24 * scale,-24 * scale); grp.setTranslation(-24 * scale,-24 * scale);
return grp; return grp;
}, },
draw: func(type, grp, opts = nil){ draw: func(type, grp, opts = nil){
if(type == "VOR" or type == "vor") if(type == "VOR" or type == "vor")
return me.drawVOR(grp, opts); return me.drawVOR(grp, opts);
elsif(type == "NDB" or type == "ndb") elsif(type == "NDB" or type == "ndb")
return me.drawNDB(grp, opts); return me.drawNDB(grp, opts);
elsif(type == "ARPT" or type == "arpt") elsif(type == "ARPT" or type == "arpt")
return me.drawAirport(grp, opts); return me.drawAirport(grp, opts);
else else
return me.drawFIX(grp, opts); return me.drawFIX(grp, opts);
} }
}; };

View file

@ -10,78 +10,78 @@ version = num(v[0]~"."~v[1]);
setlistener("/nasal/canvas/loaded", func() { setlistener("/nasal/canvas/loaded", func() {
####### LOAD FILES ####### ####### LOAD FILES #######
#print("loading files"); #print("loading files");
(func { (func {
var aircraft_root = getprop("sim/aircraft-dir"); var aircraft_root = getprop("/sim/aircraft-dir");
var load = func(file, name) { var load = func(file, name) {
#print("Loading ..." ~ file); #print("Loading ..." ~ file);
if (name == nil) if (name == nil)
var name = split("/", file)[-1]; var name = split("/", file)[-1];
if (substr(name, size(name)-4) == ".draw") if (substr(name, size(name)-4) == ".draw")
name = substr(name, 0, size(name)-5); name = substr(name, 0, size(name)-5);
#print("reading file"); #print("reading file");
var code = io.readfile(file); var code = io.readfile(file);
#print("compiling file"); #print("compiling file");
# This segfaults for some reason: # This segfaults for some reason:
#var code = call(compile, [code], var err=[]); #var code = call(compile, [code], var err=[]);
var code = call(func compile(code, file), [code], var err=[]); var code = call(func compile(code, file), [code], var err=[]);
if (size(err)) { if (size(err)) {
#print("handling error"); #print("handling error");
if (substr(err[0], 0, 12) == "Parse error:") { # hack around Nasal feature if (substr(err[0], 0, 12) == "Parse error:") { # hack around Nasal feature
var e = split(" at line ", err[0]); var e = split(" at line ", err[0]);
if (size(e) == 2) if (size(e) == 2)
err[0] = string.join("", [e[0], "\n at ", file, ", line ", e[1], "\n "]); err[0] = string.join("", [e[0], "\n at ", file, ", line ", e[1], "\n "]);
} }
for (var i = 1; (var c = caller(i)) != nil; i += 1) for (var i = 1; (var c = caller(i)) != nil; i += 1)
err ~= subvec(c, 2, 2); err ~= subvec(c, 2, 2);
debug.printerror(err); debug.printerror(err);
return; return;
} }
#print("calling code"); #print("calling code");
call(code, nil, nil, var hash = {}); call(code, nil, nil, var hash = {});
#debug.dump(keys(hash)); #debug.dump(keys(hash));
return hash; return hash;
}; };
var load_deps = func(name) { var load_deps = func(name) {
print("Loading MapStructure Layer: "~ name); print("Loading MapStructure Layer: "~ name);
load(aircraft_root~"/Models/Instruments/ND/map/"~name~".lcontroller", name); load(aircraft_root~"/Models/Instruments/ND/map/"~name~".lcontroller", name);
load(aircraft_root~"/Models/Instruments/ND/map/"~name~".symbol", name); load(aircraft_root~"/Models/Instruments/ND/map/"~name~".symbol", name);
if(version < 3.2) if(version < 3.2)
load(aircraft_root~"/Models/Instruments/ND/map/"~name~".scontroller", name); load(aircraft_root~"/Models/Instruments/ND/map/"~name~".scontroller", name);
} }
#foreach( var name; ["APS","ALT-profile","SPD-profile","RTE","WPT","DECEL","NDB"] ) #foreach( var name; ["APS","ALT-profile","SPD-profile","RTE","WPT","DECEL","NDB"] )
#load_deps( name ); #load_deps( name );
var dep_names = [ var dep_names = [
# With these extensions, in this order: # With these extensions, in this order:
"lcontroller", "lcontroller",
"symbol", "symbol",
"scontroller", "scontroller",
"controller", "controller",
]; ];
var map_root = aircraft_root~"/Models/Instruments/ND/canvas/map/"; var map_root = aircraft_root~"/Models/Instruments/ND/canvas/map/";
var files = directory(map_root); var files = directory(map_root);
var deps = {}; var deps = {};
foreach (var d; dep_names) deps[d] = []; foreach (var d; dep_names) deps[d] = [];
foreach(var f; files){ foreach(var f; files){
var ext = size(var s=split(".", f)) > 1 ? s[-1] : nil; var ext = size(var s=split(".", f)) > 1 ? s[-1] : nil;
foreach (var d; dep_names) { foreach (var d; dep_names) {
if (ext == d) { if (ext == d) {
append(deps[d], f); append(deps[d], f);
break break
} }
} }
} }
foreach (var d; dep_names) { foreach (var d; dep_names) {
foreach (var f; deps[d]) { foreach (var f; deps[d]) {
var name = split(".", f)[0]; var name = split(".", f)[0];
load(map_root~f, name); load(map_root~f, name);
} }
} }
})(); })();

View file

@ -8,5 +8,5 @@ var new = func(model) ; # this controller doesn't need an instance
var LayerController = SymbolLayer.Controller.registry[name]; var LayerController = SymbolLayer.Controller.registry[name];
var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model); var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model);
var query_range = func() var query_range = func()
die(name~".scontroller.query_range /MUST/ be provided by implementation"); die(name~".scontroller.query_range /MUST/ be provided by implementation");
#var model = props.globals.getNode('/position'); #var model = props.globals.getNode('/position');

View file

@ -8,5 +8,5 @@ var new = func(model) ; # this controller doesn't need an instance
var LayerController = canvas.SymbolLayer.Controller.registry[name]; var LayerController = canvas.SymbolLayer.Controller.registry[name];
var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model); var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model);
var query_range = func() var query_range = func()
die(name~".scontroller.query_range /MUST/ be provided by implementation"); die(name~".scontroller.query_range /MUST/ be provided by implementation");
#var model = props.globals.getNode('/position'); #var model = props.globals.getNode('/position');

View file

@ -11,6 +11,6 @@ var query_range = func()
die(name~".scontroller.query_range /MUST/ be provided by implementation"); die(name~".scontroller.query_range /MUST/ be provided by implementation");
var getpos = func(model){ var getpos = func(model){
[model.lat, model.lon]; [model.lat, model.lon];
} }

View file

@ -6,66 +6,66 @@ var __self__ = caller(0)[0];
canvas.SymbolLayer.Controller.add(name, __self__); canvas.SymbolLayer.Controller.add(name, __self__);
canvas.SymbolLayer.add(name, { canvas.SymbolLayer.add(name, {
parents: [canvas.MultiSymbolLayer], parents: [canvas.MultiSymbolLayer],
type: name, # Symbol type type: name, # Symbol type
df_controller: __self__, # controller to use by default -- this one df_controller: __self__, # controller to use by default -- this one
df_options: { df_options: {
update_t : 'autopilot/route-manager/debug/update_t', update_t : 'autopilot/route-manager/debug/update_t',
listen: ['update_t'] listen: ['update_t']
}, },
df_style: { df_style: {
default_color: [1,0,0], default_color: [1,0,0],
} }
}); });
var new = func(layer) { var new = func(layer) {
var m = { var m = {
parents: [__self__], parents: [__self__],
layer: layer, layer: layer,
map: layer.map, map: layer.map,
listeners: [], listeners: [],
}; };
layer.searcher._equals = func(a,b) a.equals(b); layer.searcher._equals = func(a,b) a.equals(b);
return m; return m;
}; };
var del = func() { var del = func() {
foreach (var l; me.listeners) foreach (var l; me.listeners)
removelistener(l); removelistener(l);
}; };
var searchCmd = func { var searchCmd = func {
var result = []; var result = [];
#return result; #return result;
var node = me['node']; var node = me['node'];
if (node == nil) { if (node == nil) {
node = props.globals.getNode('autopilot/route-manager/debug/', 1); node = props.globals.getNode('autopilot/route-manager/debug/', 1);
me.node = node; me.node = node;
} }
var points = me.node.getNode('points', 1).getChildren(); var points = me.node.getNode('points', 1).getChildren();
#var count = getprop('autopilot/route-manager/debug/num') or 0; #var count = getprop('autopilot/route-manager/debug/num') or 0;
var count = size(points); var count = size(points);
#print('Map DEBUG: querying '~ count ~' results.'); #print('Map DEBUG: querying '~ count ~' results.');
for(var idx = 0; idx < count; idx += 1){ for(var idx = 0; idx < count; idx += 1){
var point = points[idx]; var point = points[idx];
#var id = getprop('autopilot/route-manager/debug/point['~idx~']/id'); #var id = getprop('autopilot/route-manager/debug/point['~idx~']/id');
#var lat = getprop('autopilot/route-manager/debug/point['~idx~']/lat'); #var lat = getprop('autopilot/route-manager/debug/point['~idx~']/lat');
#var lon = getprop('autopilot/route-manager/debug/point['~idx~']/lon'); #var lon = getprop('autopilot/route-manager/debug/point['~idx~']/lon');
var id = point.getValue('id'); var id = point.getValue('id');
var lat = point.getValue('lat'); var lat = point.getValue('lat');
var lon = point.getValue('lon'); var lon = point.getValue('lon');
if (id == nil or id == '') continue; if (id == nil or id == '') continue;
#print('Map DEBUG: found '~ id ~' debug point.'); #print('Map DEBUG: found '~ id ~' debug point.');
var model = { var model = {
id: id, id: id,
lat: lat, lat: lat,
lon: lon, lon: lon,
equals: func(o){ equals: func(o){
me.id == o.id and me.lat == o.lat and me.lon == o.lon me.id == o.id and me.lat == o.lat and me.lon == o.lon
} }
}; };
append(result, model); append(result, model);
} }
return result; return result;
} }

View file

@ -8,20 +8,20 @@ canvas.DotSym.makeinstance( name, __self__ );
var element_type = "group"; var element_type = "group";
var init = func { var init = func {
me.text_wps = me.element.createChild("text", "dbg-text-" ~ me.model.id) me.text_wps = me.element.createChild("text", "dbg-text-" ~ me.model.id)
.setDrawMode( canvas.Text.TEXT ) .setDrawMode( canvas.Text.TEXT )
.setText(me.model.id) .setText(me.model.id)
.setFont("LiberationFonts/LiberationSans-Regular.ttf") .setFont("LiberationFonts/LiberationSans-Regular.ttf")
.setFontSize(28) .setFontSize(28)
.setTranslation(25,15) .setTranslation(25,15)
.setColor(1,0,0); .setColor(1,0,0);
me.text_alt = nil; me.text_alt = nil;
me.sym = me.element.createChild("path"). me.sym = me.element.createChild("path").
setStrokeLineWidth(4). setStrokeLineWidth(4).
moveTo(-16,0). moveTo(-16,0).
arcSmallCW(16,16,0,32,0). arcSmallCW(16,16,0,32,0).
arcSmallCW(16,16,0,-32,0). arcSmallCW(16,16,0,-32,0).
setColor(1,0,0); setColor(1,0,0);
} }
var draw = func{ var draw = func{

View file

@ -6,32 +6,32 @@ var __self__ = caller(0)[0];
canvas.SymbolLayer.Controller.add(name, __self__); canvas.SymbolLayer.Controller.add(name, __self__);
canvas.SymbolLayer.add(name, { canvas.SymbolLayer.add(name, {
parents: [MultiSymbolLayer], parents: [MultiSymbolLayer],
type: name, # Symbol type type: name, # Symbol type
df_controller: __self__, # controller to use by default -- this one df_controller: __self__, # controller to use by default -- this one
df_options : { # default configuration options df_options : { # default configuration options
decel_node: "/autopilot/route-manager/vnav/decel/" decel_node: "/autopilot/route-manager/vnav/decel/"
} }
}); });
var new = func(layer) { var new = func(layer) {
var m = { var m = {
parents: [__self__], parents: [__self__],
layer: layer, layer: layer,
map: layer.map, map: layer.map,
listeners: [], listeners: [],
}; };
layer.searcher._equals = func(a,b) a.getName() == b.getName(); layer.searcher._equals = func(a,b) a.getName() == b.getName();
return m; return m;
}; };
var del = func() { var del = func() {
foreach (var l; me.listeners) foreach (var l; me.listeners)
removelistener(l); removelistener(l);
}; };
var searchCmd = func { var searchCmd = func {
var results = []; var results = [];
var symNode = props.globals.getNode(me.layer.options.decel_node); var symNode = props.globals.getNode(me.layer.options.decel_node);
if (symNode != nil and symNode.getValue('longitude-deg') != nil) if (symNode != nil and symNode.getValue('longitude-deg') != nil)
append(results, symNode); append(results, symNode);
return results; return results;
} }

View file

@ -8,5 +8,5 @@ var new = func(model) ; # this controller doesn't need an instance
var LayerController = canvas.SymbolLayer.Controller.registry[name]; var LayerController = canvas.SymbolLayer.Controller.registry[name];
var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model); var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model);
var query_range = func() var query_range = func()
die(name~".scontroller.query_range /MUST/ be provided by implementation"); die(name~".scontroller.query_range /MUST/ be provided by implementation");
#var model = props.globals.getNode('/position'); #var model = props.globals.getNode('/position');

View file

@ -12,21 +12,21 @@ canvas.DotSym.makeinstance( name, __self__ );
var element_type = "group"; var element_type = "group";
var init = func { var init = func {
var svg_path = me.getStyle('svg_path'); var svg_path = me.getStyle('svg_path');
if(svg_path == nil) if(svg_path == nil)
svg_path = get_local_path('res/airbus_decel.svg'); svg_path = get_local_path('res/airbus_decel.svg');
me.decel_grp = me.element.createChild("group","decel"); me.decel_grp = me.element.createChild("group","decel");
canvas.parsesvg(me.decel_grp, svg_path); canvas.parsesvg(me.decel_grp, svg_path);
me.decel_grp.set('z-index', 5); me.decel_grp.set('z-index', 5);
} }
var draw = func{ var draw = func{
if(me.decel_grp != nil){ if(me.decel_grp != nil){
var spd_ctrl = getprop(me.options.spd_ctrl); var spd_ctrl = getprop(me.options.spd_ctrl);
var spd_managed = (spd_ctrl == me.options.managed_val); var spd_managed = (spd_ctrl == me.options.managed_val);
if(spd_managed) if(spd_managed)
me.decel_grp.setColor(me.style.managed_color); me.decel_grp.setColor(me.style.managed_color);
else else
me.decel_grp.setColor(me.style.selected_color); me.decel_grp.setColor(me.style.selected_color);
} }
} }

View file

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

View file

@ -8,5 +8,5 @@ var new = func(model) ; # this controller doesn't need an instance
var LayerController = canvas.SymbolLayer.Controller.registry[name]; var LayerController = canvas.SymbolLayer.Controller.registry[name];
var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model); var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model);
var query_range = func() var query_range = func()
die(name~".scontroller.query_range /MUST/ be provided by implementation"); die(name~".scontroller.query_range /MUST/ be provided by implementation");
#var model = props.globals.getNode('/position'); #var model = props.globals.getNode('/position');

View file

@ -9,72 +9,72 @@ DotSym.makeinstance( name, __self__ );
var element_type = "group"; var element_type = "group";
var style = { # style to use by default var style = { # style to use by default
zoom: 20, zoom: 20,
color: [1,1,1], color: [1,1,1],
center_line_len: 0.75, center_line_len: 0.75,
line_width: 3 line_width: 3
}; };
SymbolLayer.get(name).df_style = style; SymbolLayer.get(name).df_style = style;
#var already_drawn = 0; #var already_drawn = 0;
var init = func { var init = func {
#if(me.already_drawn) return; #if(me.already_drawn) return;
var lat = me.model.lat; var lat = me.model.lat;
var lon = me.model.lon; var lon = me.model.lon;
var rwyhdg = me.model.heading; var rwyhdg = me.model.heading;
var width = me.model.width; var width = me.model.width;
var length = me.model.length; var length = me.model.length;
var group = me.element; var group = me.element;
var ctr_len = length * me.getStyle('center_line_len', 0.75); var ctr_len = length * me.getStyle('center_line_len', 0.75);
var crds = []; var crds = [];
var coord = geo.Coord.new(); var coord = geo.Coord.new();
width = width * me.getStyle('zoom', 20); # Else rwy is too thin to be visible width = width * me.getStyle('zoom', 20); # Else rwy is too thin to be visible
var line_w = me.getStyle('line_width', 3); var line_w = me.getStyle('line_width', 3);
var color = me.getStyle('color', [1,1,1]); var color = me.getStyle('color', [1,1,1]);
coord.set_latlon(lat, lon); coord.set_latlon(lat, lon);
coord.apply_course_distance(rwyhdg, -(ctr_len / 2)); coord.apply_course_distance(rwyhdg, -(ctr_len / 2));
append(crds,"N"~coord.lat()); append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon()); append(crds,"E"~coord.lon());
coord.apply_course_distance(rwyhdg, (ctr_len)); coord.apply_course_distance(rwyhdg, (ctr_len));
append(crds,"N"~coord.lat()); append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon()); append(crds,"E"~coord.lon());
icon_rwy = group.createChild("path", "rwy-cl") icon_rwy = group.createChild("path", "rwy-cl")
.setStrokeLineWidth(line_w) .setStrokeLineWidth(line_w)
.setDataGeo([2,4],crds) .setDataGeo([2,4],crds)
.setColor(color); .setColor(color);
#.setStrokeDashArray([10, 20, 10, 20, 10]); #.setStrokeDashArray([10, 20, 10, 20, 10]);
#icon_rwy.hide(); #icon_rwy.hide();
var crds = []; var crds = [];
coord.set_latlon(lat, lon); coord.set_latlon(lat, lon);
append(crds,"N"~coord.lat()); append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon()); append(crds,"E"~coord.lon());
coord.apply_course_distance(rwyhdg + 90, width/2); coord.apply_course_distance(rwyhdg + 90, width/2);
append(crds,"N"~coord.lat()); append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon()); append(crds,"E"~coord.lon());
coord.apply_course_distance(rwyhdg, length); coord.apply_course_distance(rwyhdg, length);
append(crds,"N"~coord.lat()); append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon()); append(crds,"E"~coord.lon());
icon_rwy = group.createChild("path", "rwy") icon_rwy = group.createChild("path", "rwy")
.setStrokeLineWidth(line_w) .setStrokeLineWidth(line_w)
.setDataGeo([2,4,4],crds) .setDataGeo([2,4,4],crds)
.setColor(color); .setColor(color);
var crds = []; var crds = [];
append(crds,"N"~coord.lat()); append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon()); append(crds,"E"~coord.lon());
coord.apply_course_distance(rwyhdg - 90, width); coord.apply_course_distance(rwyhdg - 90, width);
append(crds,"N"~coord.lat()); append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon()); append(crds,"E"~coord.lon());
coord.apply_course_distance(rwyhdg, -length); coord.apply_course_distance(rwyhdg, -length);
append(crds,"N"~coord.lat()); append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon()); append(crds,"E"~coord.lon());
coord.apply_course_distance(rwyhdg + 90, width / 2); coord.apply_course_distance(rwyhdg + 90, width / 2);
append(crds,"N"~coord.lat()); append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon()); append(crds,"E"~coord.lon());
icon_rwy = group.createChild("path", "rwy") icon_rwy = group.createChild("path", "rwy")
.setStrokeLineWidth(line_w) .setStrokeLineWidth(line_w)
.setDataGeo([2,4,4,4],crds) .setDataGeo([2,4,4,4],crds)
.setColor(color); .setColor(color);
}; };
var draw = func{} var draw = func{}

View file

@ -5,47 +5,47 @@ var parents = [canvas.SymbolLayer.Controller];
var __self__ = caller(0)[0]; var __self__ = caller(0)[0];
var _options = { # default configuration options var _options = { # default configuration options
alts: [100,140,250,260,'wp'] alts: [100,140,250,260,'wp']
}; };
canvas.SymbolLayer.Controller.add(name, __self__); canvas.SymbolLayer.Controller.add(name, __self__);
canvas.SymbolLayer.add(name, { canvas.SymbolLayer.add(name, {
parents: [MultiSymbolLayer], parents: [MultiSymbolLayer],
type: name, # Symbol type type: name, # Symbol type
df_controller: __self__, # controller to use by default -- this one df_controller: __self__, # controller to use by default -- this one
df_options: _options df_options: _options
}); });
var new = func(layer) { var new = func(layer) {
var m = { var m = {
parents: [__self__], parents: [__self__],
layer: layer, layer: layer,
#map: layer.map, #map: layer.map,
listeners: [], listeners: [],
}; };
layer.searcher._equals = func(a,b) a.getName() == b.getName(); layer.searcher._equals = func(a,b) a.getName() == b.getName();
#append(m.listeners, setlistener(layer.options.fplan_active, func m.layer.update() )); #append(m.listeners, setlistener(layer.options.fplan_active, func m.layer.update() ));
#m.addVisibilityListener(); #m.addVisibilityListener();
return m; return m;
}; };
var del = func() { var del = func() {
foreach (var l; me.listeners) foreach (var l; me.listeners)
removelistener(l); removelistener(l);
}; };
var searchCmd = func { var searchCmd = func {
var results = []; var results = [];
var spdNode = props.globals.getNode(me.layer.options.spd_node); var spdNode = props.globals.getNode(me.layer.options.spd_node);
if (spdNode != nil) { if (spdNode != nil) {
var limits = spdNode.getChildren(); var limits = spdNode.getChildren();
foreach (var limit; limits) { foreach (var limit; limits) {
#t = 'spd-change-point' ~ '-' ~ alt; #t = 'spd-change-point' ~ '-' ~ alt;
#print('SPD-Controller, search for '~t); #print('SPD-Controller, search for '~t);
#var n = spdNode.getNode(t); #var n = spdNode.getNode(t);
if (limit != nil and limit.getValue('longitude-deg') != nil){ if (limit != nil and limit.getValue('longitude-deg') != nil){
#print('SPD-Controller -> Append'); #print('SPD-Controller -> Append');
append(results, limit); append(results, limit);
} }
} }
} }
return results; return results;
} }

View file

@ -8,5 +8,5 @@ var new = func(model) ; # this controller doesn't need an instance
var LayerController = canvas.SymbolLayer.Controller.registry[name]; var LayerController = canvas.SymbolLayer.Controller.registry[name];
var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model); var isActive = func(model) {return 1};#LayerController.a_instance.isActive(model);
var query_range = func() var query_range = func()
die(name~".scontroller.query_range /MUST/ be provided by implementation"); die(name~".scontroller.query_range /MUST/ be provided by implementation");
#var model = props.globals.getNode('/position'); #var model = props.globals.getNode('/position');

View file

@ -32,9 +32,9 @@ var draw = func{
# var name = me.model.getName(); # var name = me.model.getName();
# var sym_group = me.element.getElementById(name); # var sym_group = me.element.getElementById(name);
# sym_group.set('z-index', 5); # sym_group.set('z-index', 5);
if(me.spd_sym == nil){ if(me.spd_sym == nil){
me.spd_sym = me.getElementById("airbus-spd-sym"); me.spd_sym = me.getElementById("airbus-spd-sym");
me.spd_sym.setTranslation(-24, -24).set('z-index', 5); me.spd_sym.setTranslation(-24, -24).set('z-index', 5);
} }
} }

View file

@ -5,58 +5,58 @@ var parents = [SymbolLayer.Controller];
var __self__ = caller(0)[0]; var __self__ = caller(0)[0];
SymbolLayer.Controller.add(name, __self__); SymbolLayer.Controller.add(name, __self__);
SymbolLayer.add(name, { SymbolLayer.add(name, {
parents: [NavaidSymbolLayer], parents: [NavaidSymbolLayer],
type: name, # Symbol type type: name, # Symbol type
df_controller: __self__, # controller to use by default -- this one df_controller: __self__, # controller to use by default -- this one
df_options: { df_options: {
vor1_frq: 'instrumentation/nav[2]/frequencies/selected-mhz', vor1_frq: 'instrumentation/nav[2]/frequencies/selected-mhz',
vor2_frq: 'instrumentation/nav[3]/frequencies/selected-mhz' vor2_frq: 'instrumentation/nav[3]/frequencies/selected-mhz'
}, },
df_style: { df_style: {
scale: 1 scale: 1
} }
}); });
var new = func(layer) { var new = func(layer) {
var m = { var m = {
parents: [__self__], parents: [__self__],
layer: layer, layer: layer,
map: layer.map, map: layer.map,
active_vors: [], active_vors: [],
navNs: props.globals.getNode("instrumentation").getChildren("nav"), navNs: props.globals.getNode("instrumentation").getChildren("nav"),
listeners: [], listeners: [],
query_type:'vor', query_type:'vor',
}; };
setsize(m.active_vors, size(m.navNs)); setsize(m.active_vors, size(m.navNs));
foreach (var navN; m.navNs) { foreach (var navN; m.navNs) {
append(m.listeners, setlistener( append(m.listeners, setlistener(
navN.getNode("frequencies/selected-mhz"), navN.getNode("frequencies/selected-mhz"),
func m.changed_freq() func m.changed_freq()
)); ));
} }
#call(debug.dump, keys(layer)); #call(debug.dump, keys(layer));
m.changed_freq(update:0); m.changed_freq(update:0);
m.addVisibilityListener(); m.addVisibilityListener();
return m; return m;
}; };
var del = func() { var del = func() {
printlog(_MP_dbg_lvl, name,".lcontroller.del()"); printlog(_MP_dbg_lvl, name,".lcontroller.del()");
foreach (var l; me.listeners) foreach (var l; me.listeners)
removelistener(l); removelistener(l);
}; };
# Controller methods # Controller methods
var isActive = func(model) { var isActive = func(model) {
var my_freq = model.frequency/100; var my_freq = model.frequency/100;
foreach (var freq; me.active_vors) foreach (var freq; me.active_vors)
if (freq == my_freq) return 1; if (freq == my_freq) return 1;
return 0; return 0;
}; };
var changed_freq = func(update=1) { var changed_freq = func(update=1) {
#debug.dump(me.active_vors); #debug.dump(me.active_vors);
foreach (var navN; me.navNs) foreach (var navN; me.navNs)
me.active_vors[ navN.getIndex() ] = navN.getValue("frequencies/selected-mhz"); me.active_vors[ navN.getIndex() ] = navN.getValue("frequencies/selected-mhz");
if (update) me.layer.update(); if (update) me.layer.update();
}; };
var searchCmd = NavaidSymbolLayer.make('vor'); var searchCmd = NavaidSymbolLayer.make('vor');

View file

@ -11,33 +11,33 @@ var svg_path = get_local_path('res/airbus_vor.svg');
var vor_sym = nil; var vor_sym = nil;
var draw = func{ var draw = func{
if(me.vor_sym == nil) if(me.vor_sym == nil)
me.vor_sym = me.element.getElementById("airbus-vor-sym"); me.vor_sym = me.element.getElementById("airbus-vor-sym");
me.vor_sym.setTranslation(-24,-24); me.vor_sym.setTranslation(-24,-24);
if(me.text_vor == nil){ if(me.text_vor == nil){
var transl = me.getStyle('translation', [25,10]); var transl = me.getStyle('translation', [25,10]);
var text_color = me.getStyle('text_color', [1,1,1]); var text_color = me.getStyle('text_color', [1,1,1]);
me.text_vor = me.element.createChild("text") me.text_vor = me.element.createChild("text")
.setDrawMode( canvas.Text.TEXT ) .setDrawMode( canvas.Text.TEXT )
.setText(me.model.id) .setText(me.model.id)
.setFont("LiberationFonts/LiberationSans-Regular.ttf") .setFont("LiberationFonts/LiberationSans-Regular.ttf")
.setFontSize(28) .setFontSize(28)
.setColor(text_color) .setColor(text_color)
.setTranslation(transl); .setTranslation(transl);
} }
var frq = me.model.frequency; var frq = me.model.frequency;
if(frq != nil){ if(frq != nil){
var dfcolor = me.getStyle('color', [0.9,0,0.47]); var dfcolor = me.getStyle('color', [0.9,0,0.47]);
var tuned_color = me.getStyle('tuned_color', [0,0.62,0.84]); var tuned_color = me.getStyle('tuned_color', [0,0.62,0.84]);
frq = frq / 100; frq = frq / 100;
var vor1_frq = getprop(me.options.vor1_frq); var vor1_frq = getprop(me.options.vor1_frq);
var vor2_frq = getprop(me.options.vor2_frq); var vor2_frq = getprop(me.options.vor2_frq);
if(vor1_frq == frq or vor2_frq == frq){ if(vor1_frq == frq or vor2_frq == frq){
me.element.setColor(tuned_color); me.element.setColor(tuned_color);
} else { } else {
me.element.setColor(dfcolor); me.element.setColor(dfcolor);
} }
} }
me.text_vor.setColor(me.getStyle('text_color', [1,1,1])); me.text_vor.setColor(me.getStyle('text_color', [1,1,1]));
} }

View file

@ -6,132 +6,132 @@ var __self__ = caller(0)[0];
canvas.SymbolLayer.Controller.add(name, __self__); canvas.SymbolLayer.Controller.add(name, __self__);
canvas.SymbolLayer.add(name, { canvas.SymbolLayer.add(name, {
parents: [canvas.MultiSymbolLayer], parents: [canvas.MultiSymbolLayer],
type: name, # Symbol type type: name, # Symbol type
df_controller: __self__, # controller to use by default -- this one df_controller: __self__, # controller to use by default -- this one
df_options: { # default configuration options df_options: { # default configuration options
fix_symbol: func(group){ fix_symbol: func(group){
group.createChild('path') group.createChild('path')
.moveTo(-10,0) .moveTo(-10,0)
.lineTo(0,-17) .lineTo(0,-17)
.lineTo(10,0) .lineTo(10,0)
.lineTo(0,17) .lineTo(0,17)
.close() .close()
.setStrokeLineWidth(3) .setStrokeLineWidth(3)
.setColor(1,1,1) .setColor(1,1,1)
.setScale(1,1); .setScale(1);
}, },
vor_symbol: 'Nasal/canvas/map/Airbus/Images/airbus_vor.svg', vor_symbol: 'Nasal/canvas/map/Airbus/Images/airbus_vor.svg',
airport_symbol: 'Nasal/canvas/map/Airbus/Images/airbus_airport.svg', airport_symbol: 'Nasal/canvas/map/Airbus/Images/airbus_airport.svg',
ndb_symbol: func(group){ ndb_symbol: func(group){
group.createChild('path') group.createChild('path')
.moveTo(-15,15) .moveTo(-15,15)
.lineTo(0,-15) .lineTo(0,-15)
.lineTo(15,15) .lineTo(15,15)
.close() .close()
.setStrokeLineWidth(3) .setStrokeLineWidth(3)
#.setColor(0.69,0,0.39) #.setColor(0.69,0,0.39)
#.setTranslation(-24, -24), #.setTranslation(-24, -24),
.setScale(1,1); .setScale(1,1);
} }
}, },
df_style: { df_style: {
active_wp_color: [0.4,0.7,0.4], active_wp_color: [0.4,0.7,0.4],
current_wp_color: [1,1,1], current_wp_color: [1,1,1],
translation: { translation: {
'airport': [-24,-24], 'airport': [-24,-24],
'vor': [-24,-24] 'vor': [-24,-24]
} }
}, },
toggle_cstr: 0 toggle_cstr: 0
}); });
var new = func(layer) { var new = func(layer) {
var m = { var m = {
parents: [__self__], parents: [__self__],
layer: layer, layer: layer,
map: layer.map, map: layer.map,
listeners: [], listeners: [],
}; };
layer.searcher._equals = func(a,b) a.equals(b); layer.searcher._equals = func(a,b) a.equals(b);
var driver = opt_member(m.layer.options, 'route_driver'); var driver = opt_member(m.layer.options, 'route_driver');
if(driver == nil){ if(driver == nil){
driver = RouteDriver.new(); driver = RouteDriver.new();
} }
var driver_listeners = driver.getListeners(); var driver_listeners = driver.getListeners();
foreach(var listener; driver_listeners){ foreach(var listener; driver_listeners){
append(m.listeners, setlistener(listener, func m.layer.update())); append(m.listeners, setlistener(listener, func m.layer.update()));
} }
m.route_driver = driver; m.route_driver = driver;
return m; return m;
}; };
var del = func() { var del = func() {
foreach (var l; me.listeners) foreach (var l; me.listeners)
removelistener(l); removelistener(l);
}; };
var WPTModel = { var WPTModel = {
new: func(fp, idx) { new: func(fp, idx) {
var m = { parents:[WPTModel] }; var m = { parents:[WPTModel] };
var wp = fp.getWP(idx); var wp = fp.getWP(idx);
m.id = wp.id; m.id = wp.id;
m.name = wp.wp_name; m.name = wp.wp_name;
m.alt = wp.alt_cstr; m.alt = wp.alt_cstr;
m.spd = wp.speed_cstr; m.spd = wp.speed_cstr;
m.type = wp.wp_type; m.type = wp.wp_type;
(m.lat,m.lon) = (wp.wp_lat,wp.wp_lon); (m.lat,m.lon) = (wp.wp_lat,wp.wp_lon);
var is_rwy = (m.type == 'runway'); var is_rwy = (m.type == 'runway');
var id_len = size(m.id); var id_len = size(m.id);
if(!is_rwy and id_len < 5){ if(!is_rwy and id_len < 5){
if(id_len == 4 and airportinfo(m.id) != nil) if(id_len == 4 and airportinfo(m.id) != nil)
m.navtype = 'airport'; m.navtype = 'airport';
else { else {
var navaid = nil; var navaid = nil;
foreach(var t; ['vor', 'ndb']){ foreach(var t; ['vor', 'ndb']){
navaid = navinfo(m.lat, m.lon, t, m.id); navaid = navinfo(m.lat, m.lon, t, m.id);
if(navaid != nil and size(navaid)){ if(navaid != nil and size(navaid)){
m.navtype = t; m.navtype = t;
break; break;
} }
} }
if(navaid == nil or !size(navaid)) m.navtype = 'fix'; if(navaid == nil or !size(navaid)) m.navtype = 'fix';
} }
} else { } else {
m.navtype = (is_rwy ? 'rwy' : 'fix'); m.navtype = (is_rwy ? 'rwy' : 'fix');
} }
m.wp = wp; m.wp = wp;
idx = wp.index; idx = wp.index;
m.idx = idx; m.idx = idx;
m.is_departure = (idx == 0 and is_rwy); m.is_departure = (idx == 0 and is_rwy);
m.is_destination = (idx > 0 and is_rwy); m.is_destination = (idx > 0 and is_rwy);
return m; return m;
}, },
equals: func(other) { equals: func(other) {
# this is set on symbol init, so use this for equality... # this is set on symbol init, so use this for equality...
me.name == other.name and me.alt == other.alt and me.name == other.name and me.alt == other.alt and
me.type == other.type and me.idx == other.idx and me.type == other.type and me.idx == other.idx and
me.navtype == other.navtype me.navtype == other.navtype
}, },
}; };
var searchCmd = func { var searchCmd = func {
var driver = me.route_driver; var driver = me.route_driver;
if(!driver.shouldUpdate()) return []; if(!driver.shouldUpdate()) return [];
driver.update(); driver.update();
var result = []; var result = [];
var planCount = driver.getNumberOfFlightPlans(); var planCount = driver.getNumberOfFlightPlans();
for(var idx = 0; idx < planCount; idx += 1){ for(var idx = 0; idx < planCount; idx += 1){
var fp = driver.getFlightPlan(idx); var fp = driver.getFlightPlan(idx);
if(fp == nil) continue; if(fp == nil) continue;
var fpSize = fp.getPlanSize(idx); var fpSize = fp.getPlanSize(idx);
for (var i = 0; i < fpSize; i+=1){ for (var i = 0; i < fpSize; i+=1){
if(!driver.shouldUpdate()) return[]; if(!driver.shouldUpdate()) return[];
append(result, WPTModel.new(fp, i)); append(result, WPTModel.new(fp, i));
} }
} }
return result; return result;
} }

View file

@ -8,130 +8,130 @@ canvas.DotSym.makeinstance( name, __self__ );
var element_type = "group"; var element_type = "group";
var init = func { var init = func {
var name = me.model.name; var name = me.model.name;
var alt = me.model.alt; var alt = me.model.alt;
var spd = me.model.spd; var spd = me.model.spd;
var wp_group = me.element; var wp_group = me.element;
me.alt_path = nil; me.alt_path = nil;
var colors = [ var colors = [
'wp_color', 'wp_color',
'current_wp_color', 'current_wp_color',
'constraint_color', 'constraint_color',
'active_constraint_color', 'active_constraint_color',
'missed_constraint_color' 'missed_constraint_color'
]; ];
foreach(col; colors){ foreach(col; colors){
me[col] = me.getStyle(col, me.getOption(col)); me[col] = me.getStyle(col, me.getOption(col));
} }
var idLen = size(me.model.id); var idLen = size(me.model.id);
var draw_sym = nil; var draw_sym = nil;
var navtype = me.model.navtype; var navtype = me.model.navtype;
if (navtype == nil) navtype = 'fix'; if (navtype == nil) navtype = 'fix';
if(navtype == 'airport') if(navtype == 'airport')
draw_sym = me.options.airport_symbol; draw_sym = me.options.airport_symbol;
elsif(navtype == 'vor') elsif(navtype == 'vor')
draw_sym = me.options.vor_symbol; draw_sym = me.options.vor_symbol;
elsif(navtype == 'ndb') elsif(navtype == 'ndb')
draw_sym = me.options.ndb_symbol; draw_sym = me.options.ndb_symbol;
else else
draw_sym = me.options.fix_symbol; draw_sym = me.options.fix_symbol;
me.wp_sym = me.element.createChild('group', 'wp-'~ me.model.idx); me.wp_sym = me.element.createChild('group', 'wp-'~ me.model.idx);
if(typeof(draw_sym) == 'func') if(typeof(draw_sym) == 'func')
draw_sym(me.wp_sym); draw_sym(me.wp_sym);
elsif(typeof(draw_sym) == 'scalar') elsif(typeof(draw_sym) == 'scalar')
canvas.parsesvg(me.wp_sym, draw_sym); canvas.parsesvg(me.wp_sym, draw_sym);
var translation = me.getStyle('translation', {}); var translation = me.getStyle('translation', {});
if(contains(translation, navtype)){ if(contains(translation, navtype)){
me.wp_sym.setTranslation(translation[navtype]); me.wp_sym.setTranslation(translation[navtype]);
} }
me.text_wps = wp_group.createChild("text", "wp-text-" ~ me.model.idx) me.text_wps = wp_group.createChild("text", "wp-text-" ~ me.model.idx)
.setDrawMode( canvas.Text.TEXT ) .setDrawMode( canvas.Text.TEXT )
.setText(me.model.name) .setText(me.model.name)
.setFont("LiberationFonts/LiberationSans-Regular.ttf") .setFont("LiberationFonts/LiberationSans-Regular.ttf")
.setFontSize(28) .setFontSize(28)
.setTranslation(25,15) .setTranslation(25,15)
.setColor(1,1,1); .setColor(1,1,1);
me.text_alt = nil; me.text_alt = nil;
if(alt > 0 or spd > 0){ if(alt > 0 or spd > 0){
var cstr_txt = "\n"; var cstr_txt = "\n";
if(alt > 0){ if(alt > 0){
if(alt > 10000) if(alt > 10000)
cstr_txt ~= sprintf('FL%3.0f', int(alt / 100)); cstr_txt ~= sprintf('FL%3d', int(alt / 100));
else else
cstr_txt ~= sprintf('%4.0f', int(alt)); cstr_txt ~= sprintf('%4d', int(alt));
} }
if(spd > 0){ if(spd > 0){
if(alt > 0) cstr_txt ~= "\n"; if(alt > 0) cstr_txt ~= "\n";
if(spd <= 1) if(spd <= 1)
cstr_txt ~= sprintf('%1.2fM', spd); cstr_txt ~= sprintf('%4.2fM', spd);
else 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) me.text_alt = wp_group.createChild("text", "wp-alt-text-" ~ me.model.idx)
.setDrawMode( canvas.Text.TEXT ) .setDrawMode( canvas.Text.TEXT )
.setText(cstr_txt) .setText(cstr_txt)
.setFont("LiberationFonts/LiberationSans-Regular.ttf") .setFont("LiberationFonts/LiberationSans-Regular.ttf")
.setFontSize(28) .setFontSize(28)
.setTranslation(25,15); .setTranslation(25,15);
} }
} }
var draw = func{ var draw = func{
var wp_group = me.element; var wp_group = me.element;
var alt = me.model.alt; var alt = me.model.alt;
var i = me.model.idx; var i = me.model.idx;
var vnav_actv = getprop(me.options.ver_ctrl) == me.options.managed_val; var vnav_actv = getprop(me.options.ver_ctrl) == me.options.managed_val;
var curwp = getprop(me.options.current_wp); var curwp = getprop(me.options.current_wp);
if(alt > 0){ if(alt > 0){
var wp_d = me.model.wp.distance_along_route; var wp_d = me.model.wp.distance_along_route;
var lvl_off_at = getprop(me.options.level_off_alt); var lvl_off_at = getprop(me.options.level_off_alt);
if(lvl_off_at == nil) lvl_off_at = 0; if(lvl_off_at == nil) lvl_off_at = 0;
if(me.alt_path == nil){ if(me.alt_path == nil){
me.alt_path = wp_group.createChild("path"). me.alt_path = wp_group.createChild("path").
setStrokeLineWidth(4). setStrokeLineWidth(4).
moveTo(-22,0). moveTo(-22,0).
arcSmallCW(22,22,0,44,0). arcSmallCW(22,22,0,44,0).
arcSmallCW(22,22,0,-44,0); arcSmallCW(22,22,0,-44,0);
} }
if(vnav_actv){ if(vnav_actv){
if(lvl_off_at and (lvl_off_at - wp_d) > 0.5 and curwp == i) if(lvl_off_at and (lvl_off_at - wp_d) > 0.5 and curwp == i)
me.alt_path.setColor(me.missed_constraint_color); me.alt_path.setColor(me.missed_constraint_color);
else else
me.alt_path.setColor(me.active_constraint_color); me.alt_path.setColor(me.active_constraint_color);
} }
else else
me.alt_path.setColor(me.constraint_color); me.alt_path.setColor(me.constraint_color);
if(me.layer.toggle_cstr) if(me.layer.toggle_cstr)
me.alt_path.show(); me.alt_path.show();
else else
me.alt_path.hide(); me.alt_path.hide();
} else { } else {
if(me.alt_path != nil) me.alt_path.hide(); if(me.alt_path != nil) me.alt_path.hide();
} }
wp_group.set("z-index",4); wp_group.set("z-index",4);
#var sym = me.element.getElementById('wp-' ~ me.model.idx); #var sym = me.element.getElementById('wp-' ~ me.model.idx);
if(alt > 0 and me.text_alt != nil){ if(alt > 0 and me.text_alt != nil){
if(vnav_actv) if(vnav_actv)
me.text_alt.setColor(me.active_constraint_color); me.text_alt.setColor(me.active_constraint_color);
else else
me.text_alt.setColor(me.constraint_color); me.text_alt.setColor(me.constraint_color);
} }
if(i == curwp) { if(i == curwp) {
me.wp_sym.setColor(me.current_wp_color); me.wp_sym.setColor(me.current_wp_color);
me.text_wps.setColor(me.current_wp_color); me.text_wps.setColor(me.current_wp_color);
} else { } else {
me.wp_sym.setColor(me.wp_color); me.wp_sym.setColor(me.wp_color);
me.text_wps.setColor(me.wp_color); me.text_wps.setColor(me.wp_color);
} }
if(me.model.is_departure or me.model.is_destination){ if(me.model.is_departure or me.model.is_destination){
var prop = (me.model.is_departure ? 'departure' : '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){ if(rwy != nil and size(rwy) > 0){
me.wp_sym.hide(); me.wp_sym.hide();
} else { } else {
me.wp_sym.show(); me.wp_sym.show();
} }
} }
} }

View file

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

View file

@ -6438,17 +6438,17 @@
</axis> </axis>
</animation> </animation>
<animation> <animation>
<type>translate</type> <type>translate</type>
<object-name>Eng1FireBtn</object-name> <object-name>Eng1FireBtn</object-name>
<property>controls/engines/engine[0]/fire-btn</property> <property>controls/engines/engine[0]/fire-btn</property>
<factor>0.025</factor> <factor>0.025</factor>
<axis> <axis>
<x>1</x> <x>1</x>
<y>0</y> <y>0</y>
<z>0</z> <z>0</z>
</axis> </axis>
</animation> </animation>
<animation> <animation>
<type>material</type> <type>material</type>
@ -6791,17 +6791,17 @@
</axis> </axis>
</animation> </animation>
<animation> <animation>
<type>translate</type> <type>translate</type>
<object-name>APUFireBtn</object-name> <object-name>APUFireBtn</object-name>
<property>controls/APU/fire-btn</property> <property>controls/APU/fire-btn</property>
<factor>0.025</factor> <factor>0.025</factor>
<axis> <axis>
<x>1</x> <x>1</x>
<y>0</y> <y>0</y>
<z>0</z> <z>0</z>
</axis> </axis>
</animation> </animation>
<animation> <animation>
<type>material</type> <type>material</type>
@ -6954,33 +6954,33 @@
</axis> </axis>
</animation> </animation>
<animation> <animation>
<type>translate</type> <type>translate</type>
<object-name>Eng2FireBtn</object-name> <object-name>Eng2FireBtn</object-name>
<property>controls/engines/engine[1]/fire-btn</property> <property>controls/engines/engine[1]/fire-btn</property>
<factor>0.025</factor> <factor>0.025</factor>
<axis> <axis>
<x>1</x> <x>1</x>
<y>0</y> <y>0</y>
<z>0</z> <z>0</z>
</axis> </axis>
</animation> </animation>
<animation> <animation>
<type>material</type> <type>material</type>
<object-name>Eng2FireBtn</object-name> <object-name>Eng2FireBtn</object-name>
<condition> <condition>
<or> <or>
<property>systems/fire/engine2/warning-active</property> <property>systems/fire/engine2/warning-active</property>
<property>controls/switches/annun-test</property> <property>controls/switches/annun-test</property>
</or> </or>
</condition> </condition>
<emission> <emission>
<red>1.0</red> <red>1.0</red>
<green>1.0</green> <green>1.0</green>
<blue>1.0</blue> <blue>1.0</blue>
</emission> </emission>
</animation> </animation>
<animation> <animation>
<type>pick</type> <type>pick</type>

View file

@ -36,5 +36,13 @@
<factor-prop>controls/lighting/DU/du1</factor-prop> <factor-prop>controls/lighting/DU/du1</factor-prop>
</emission> </emission>
</animation> </animation>
<effect>
<inherits-from>Effects/model-interior-display</inherits-from>
<object-name>pfd1.screen</object-name>
<parameters>
<contrast>0.7</contrast>
</parameters>
</effect>
</PropertyList> </PropertyList>

View file

@ -36,5 +36,13 @@
<factor-prop>controls/lighting/DU/du6</factor-prop> <factor-prop>controls/lighting/DU/du6</factor-prop>
</emission> </emission>
</animation> </animation>
<effect>
<inherits-from>Effects/model-interior-display</inherits-from>
<object-name>pfd2.screen</object-name>
<parameters>
<contrast>0.7</contrast>
</parameters>
</effect>
</PropertyList> </PropertyList>

View file

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

View file

@ -136,14 +136,14 @@ var phaseLoop = func() {
if (eng == "IAE") { if (eng == "IAE") {
eprlim = getprop("controls/engines/epr-limit"); 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); FWC.toPower.setBoolValue(1);
} else { } else {
FWC.toPower.setBoolValue(0); FWC.toPower.setBoolValue(0);
} }
} else { } else {
n1lim = getprop("controls/engines/n1-limit"); 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); FWC.toPower.setBoolValue(1);
} else { } else {
FWC.toPower.setBoolValue(0); FWC.toPower.setBoolValue(0);
@ -281,4 +281,4 @@ setlistener("/ECAM/buttons/recall-btn", func() {
var clrBtn = func(btn) { var clrBtn = func(btn) {
FWC.Btn.clr.setValue(btn); FWC.Btn.clr.setValue(btn);
} }

View file

@ -48,10 +48,10 @@ var Radio = {
}; };
var FPLN = { var FPLN = {
active: props.globals.getNode("autopilot/route-manager/active", 1), active: props.globals.getNode("/FMGC/flightplan[2]/active", 1),
activeTemp: 0, activeTemp: 0,
currentCourse: 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, currentWPTemp: 0,
deltaAngle: 0, deltaAngle: 0,
deltaAngleRad: 0, deltaAngleRad: 0,
@ -59,12 +59,10 @@ var FPLN = {
maxBank: 0, maxBank: 0,
maxBankLimit: 0, maxBankLimit: 0,
nextCourse: 0, nextCourse: 0,
num: props.globals.getNode("autopilot/route-manager/route/num", 1),
numTemp: 0,
R: 0, R: 0,
radius: 0, radius: 0,
turnDist: 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, wpFlyFrom: 0,
wpFlyTo: 0, wpFlyTo: 0,
}; };
@ -376,7 +374,6 @@ var ITAF = {
Velocity.trueAirspeedKtTemp = Velocity.trueAirspeedKt.getValue(); Velocity.trueAirspeedKtTemp = Velocity.trueAirspeedKt.getValue();
FPLN.activeTemp = FPLN.active.getValue(); FPLN.activeTemp = FPLN.active.getValue();
FPLN.currentWPTemp = FPLN.currentWP.getValue(); FPLN.currentWPTemp = FPLN.currentWP.getValue();
FPLN.numTemp = FPLN.num.getValue();
# Bank Limit # Bank Limit
if (Velocity.trueAirspeedKtTemp >= 420) { 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 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 (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); me.setLatMode(3);
} }
} }
# Waypoint Advance Logic # Waypoint Advance Logic
if (FPLN.numTemp > 0 and FPLN.activeTemp == 1) { if (flightPlanController.num[2].getValue() > 0 and FPLN.activeTemp == 1) {
if ((FPLN.currentWPTemp + 1) < FPLN.numTemp) { if ((FPLN.currentWPTemp + 1) < flightPlanController.num[2].getValue()) {
Velocity.groundspeedMps = Velocity.groundspeedKt.getValue() * 0.5144444444444; Velocity.groundspeedMps = Velocity.groundspeedKt.getValue() * 0.5144444444444;
FPLN.wpFlyFrom = FPLN.currentWPTemp; FPLN.wpFlyFrom = FPLN.currentWPTemp;
if (FPLN.wpFlyFrom < 0) { if (FPLN.wpFlyFrom < 0) {
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; FPLN.wpFlyTo = FPLN.currentWPTemp + 1;
if (FPLN.wpFlyTo < 0) { if (FPLN.wpFlyTo < 0) {
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.maxBankLimit = Internal.bankLimit.getValue();
FPLN.deltaAngle = math.abs(geo.normdeg180(FPLN.currentCourse - FPLN.nextCourse)); FPLN.deltaAngle = math.abs(geo.normdeg180(FPLN.currentCourse - FPLN.nextCourse));
@ -431,7 +428,11 @@ var ITAF = {
Internal.lnavAdvanceNm.setValue(FPLN.turnDist); Internal.lnavAdvanceNm.setValue(FPLN.turnDist);
if (FPLN.wp0Dist.getValue() <= 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); Custom.showHdg.setBoolValue(1);
me.armTextCheck(); me.armTextCheck();
} else if (n == 1) { } 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); Output.lnavArm.setBoolValue(1);
Custom.showHdg.setBoolValue(0); Custom.showHdg.setBoolValue(0);
me.armTextCheck(); me.armTextCheck();
@ -647,7 +648,10 @@ var ITAF = {
Text.vert.setValue("ALT CAP"); Text.vert.setValue("ALT CAP");
} else if (n == 4) { # FLCH } else if (n == 4) { # FLCH
Output.apprArm.setBoolValue(0); 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 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"); Text.vert.setValue("SPD CLB");
} else { } else {
@ -734,7 +738,7 @@ var ITAF = {
} }
}, },
checkLNAV: func(t) { 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(); me.activateLNAV();
} else if (Output.lat.getValue() != 1 and t != 1) { } else if (Output.lat.getValue() != 1 and t != 1) {
Output.lnavArm.setBoolValue(1); Output.lnavArm.setBoolValue(1);

View file

@ -250,10 +250,10 @@ var masterFMGC = maketimer(0.2, func {
setprop("FMGC/status/phase", 5); 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) { if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and flightPlanController.arrivalDist <= 15) {
setprop("FMGC/internal/decel", 1); setprop("/FMGC/internal/decel", 1);
} else if (getprop("FMGC/internal/decel") == 1 and (phase == 0 or phase == 6)) { } else if (getprop("/FMGC/internal/decel") == 1 and (phase == 0 or phase == 6)) {
setprop("FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
#handle go-around #handle go-around
@ -477,6 +477,7 @@ var reset_FMGC = func {
alt = getprop("it-autoflight/input/alt"); alt = getprop("it-autoflight/input/alt");
ITAF.init(); ITAF.init();
FMGCinit(); FMGCinit();
flightPlanController.reset();
mcdu.MCDU_reset(0); mcdu.MCDU_reset(0);
mcdu.MCDU_reset(1); mcdu.MCDU_reset(1);
setprop("it-autoflight/input/fd1", fd1); 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") { } else if (key == "R1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
clearFPLNComputer();
setprop("FMGC/internal/dep-arpt", ""); setprop("FMGC/internal/dep-arpt", "");
setprop("FMGC/internal/arr-arpt", ""); setprop("FMGC/internal/arr-arpt", "");
setprop("FMGC/internal/tofrom-set", 0); setprop("FMGC/internal/tofrom-set", 0);
fmgc.updateARPT(); fmgc.flightPlanController.reset();
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (scratchpad == "") { } else if (scratchpad == "") {
@ -119,7 +120,7 @@ var initInputA = func(key, i) {
setprop("FMGC/internal/arr-arpt", fromto[1]); setprop("FMGC/internal/arr-arpt", fromto[1]);
setprop("FMGC/internal/tofrom-set", 1); setprop("FMGC/internal/tofrom-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateARPT(); fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2);
setprop("FMGC/internal/alt-selected", 0); setprop("FMGC/internal/alt-selected", 0);
setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else { } 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,7 +202,24 @@ var lskbutton = func(btn, i) {
printInput("L1",i); printInput("L1",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("L1",i); printInput2("L1",i);
} else { } 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); notAllowed(i);
} }
} else if (btn == "2") { } else if (btn == "2") {
@ -228,7 +245,17 @@ var lskbutton = func(btn, i) {
printInput("L2",i); printInput("L2",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("L2",i); printInput2("L2",i);
} else { } 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); notAllowed(i);
} }
} else if (btn == "3") { } else if (btn == "3") {
@ -250,7 +277,28 @@ var lskbutton = func(btn, i) {
printInput("L3",i); printInput("L3",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("L3",i); printInput2("L3",i);
} else { } 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); notAllowed(i);
} }
} else if (btn == "4") { } else if (btn == "4") {
@ -268,7 +316,17 @@ var lskbutton = func(btn, i) {
radnavInput("L4",i); radnavInput("L4",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("L4",i); printInput2("L4",i);
} else { } 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); notAllowed(i);
} }
} else if (btn == "5") { } else if (btn == "5") {
@ -296,7 +354,17 @@ var lskbutton = func(btn, i) {
printInput("L5",i); printInput("L5",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("L5",i); printInput2("L5",i);
} else { } 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); notAllowed(i);
} }
} else if (btn == "6") { } else if (btn == "6") {
@ -318,7 +386,19 @@ var lskbutton = func(btn, i) {
perfGAInput("L6",i); perfGAInput("L6",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("L6",i); printInput2("L6",i);
} else { } 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); notAllowed(i);
} }
} }
@ -340,7 +420,20 @@ var rskbutton = func(btn, i) {
printInput("R1",i); printInput("R1",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("R1",i); printInput2("R1",i);
} else { } 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); notAllowed(i);
} }
} else if (btn == "2") { } else if (btn == "2") {
@ -354,7 +447,13 @@ var rskbutton = func(btn, i) {
printInput("R2",i); printInput("R2",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("R2",i); printInput2("R2",i);
} else { } 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); notAllowed(i);
} }
} else if (btn == "3") { } else if (btn == "3") {
@ -372,7 +471,19 @@ var rskbutton = func(btn, i) {
printInput("R3",i); printInput("R3",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("R3",i); printInput2("R3",i);
} else { } 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); notAllowed(i);
} }
} else if (btn == "4") { } else if (btn == "4") {
@ -384,7 +495,13 @@ var rskbutton = func(btn, i) {
radnavInput("R4",i); radnavInput("R4",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
printInput2("R4",i); printInput2("R4",i);
} else { } 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); notAllowed(i);
} }
} else if (btn == "5") { } else if (btn == "5") {
@ -400,7 +517,13 @@ var rskbutton = func(btn, i) {
radnavInput("R5",i); radnavInput("R5",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
dataInput("R5",i); dataInput("R5",i);
} else { } 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); notAllowed(i);
} }
} else if (btn == "6") { } else if (btn == "6") {
@ -436,7 +559,13 @@ var rskbutton = func(btn, i) {
setprop("MCDU[" ~ i ~ "]/scratchpad", "AOC DISABLED"); setprop("MCDU[" ~ i ~ "]/scratchpad", "AOC DISABLED");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
initInputA("R6",i); initInputA("R6",i);
} else { } 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); notAllowed(i);
} }
} }
@ -452,8 +581,7 @@ var arrowbutton = func(btn, i) {
setprop("MCDU[" ~ i ~ "]/page", "DATA2"); setprop("MCDU[" ~ i ~ "]/page", "DATA2");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA2") {
setprop("MCDU[" ~ i ~ "]/page", "DATA"); setprop("MCDU[" ~ i ~ "]/page", "DATA");
} } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) { if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) {
setprop("MCDU[" ~ i ~ "]/page", "INITB"); setprop("MCDU[" ~ i ~ "]/page", "INITB");
} else { } else {
@ -461,19 +589,21 @@ var arrowbutton = func(btn, i) {
} }
} else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB" or getprop("MCDU[" ~ i ~ "]/page") == "FUELPRED") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB" or getprop("MCDU[" ~ i ~ "]/page") == "FUELPRED") {
setprop("MCDU[" ~ i ~ "]/page", "INITA"); setprop("MCDU[" ~ i ~ "]/page", "INITA");
} } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC2"); setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC2");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC"); 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") { } else if (btn == "right") {
if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") { if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") {
setprop("MCDU[" ~ i ~ "]/page", "DATA2"); setprop("MCDU[" ~ i ~ "]/page", "DATA2");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA2") {
setprop("MCDU[" ~ i ~ "]/page", "DATA"); setprop("MCDU[" ~ i ~ "]/page", "DATA");
} } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) { if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) {
setprop("MCDU[" ~ i ~ "]/page", "INITB"); setprop("MCDU[" ~ i ~ "]/page", "INITB");
} else { } else {
@ -481,17 +611,36 @@ var arrowbutton = func(btn, i) {
} }
} else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB" or getprop("MCDU[" ~ i ~ "]/page") == "FUELPRED") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB" or getprop("MCDU[" ~ i ~ "]/page") == "FUELPRED") {
setprop("MCDU[" ~ i ~ "]/page", "INITA"); setprop("MCDU[" ~ i ~ "]/page", "INITA");
} } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC2"); setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC2");
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC"); 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") { } else if (btn == "up") {
# Nothing for now if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
} else if (btn == "down") { canvas_mcdu.myFpln[i].scrollUp();
# Nothing for now } 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") {
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();
}
}
} }
var pagebutton = func(btn, i) { var pagebutton = func(btn, i) {
@ -532,10 +681,32 @@ var pagebutton = func(btn, i) {
setprop("MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM"); setprop("MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM");
setprop("MCDU[" ~ i ~ "]/page", "MCDU"); setprop("MCDU[" ~ i ~ "]/page", "MCDU");
} else if (btn == "f-pln") { } else if (btn == "f-pln") {
setprop("MCDU[" ~ i ~ "]/page", "F-PLNA"); if (fmgc.flightPlanController.active.getBoolValue()) {
} else if (btn == "fuel-pred") { if (canvas_mcdu.myFpln[i] == nil) {
setprop("MCDU[" ~ i ~ "]/page", "FUELPRED"); 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,10 +874,22 @@ var notAllowed = func(i) {
setprop("MCDU[" ~ i ~ "]/scratchpad", "NOT ALLOWED"); 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 screenFlash = func(time, i) {
var page = getprop("MCDU[" ~ i ~ "]/page"); var page = getprop("MCDU[" ~ i ~ "]/page");
setprop("MCDU[" ~ i ~ "]/page", "NONE"); setprop("MCDU[" ~ i ~ "]/page", "NONE");
settimer(func { settimer(func {
setprop("MCDU[" ~ i ~ "]/page", page); setprop("MCDU[" ~ i ~ "]/page", page);
}, time); }, time);
} }

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

View file

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

View file

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

View file

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

View file

@ -296,6 +296,16 @@
<legend>DIR</legend> <legend>DIR</legend>
<pref-height>25</pref-height> <pref-height>25</pref-height>
<pref-width>40</pref-width> <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>
<button> <button>

View file

@ -296,6 +296,16 @@
<legend>DIR</legend> <legend>DIR</legend>
<pref-height>25</pref-height> <pref-height>25</pref-height>
<pref-width>40</pref-width> <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>
<button> <button>