1
0
Fork 0

Merge branch 'dev' into 3D

This commit is contained in:
legoboyvdlp R 2020-06-26 14:02:10 +01:00
commit 52a783292d
27 changed files with 2610 additions and 413 deletions

View file

@ -961,9 +961,7 @@
<services n="0">
<chocks n="0">
<nose type="bool">0</nose>
<left type="bool">0</left>
<right type="bool">0</right>
<enable type="bool">0</enable>
</chocks>
<fuel-truck>
<connect type="bool">0</connect>
@ -4054,6 +4052,7 @@
<file>Aircraft/A320-family/Nasal/FMGC/FMGC.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/FMGC-b.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/FMGC-c.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/winds.nas</file>
</fmgc>
<mcdu>
<file>Aircraft/A320-family/Nasal/MCDU/DUPLICATE.nas</file> <!-- dynamic page - init before others as used in various pages -->
@ -4067,6 +4066,10 @@
<file>Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/HOLD.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/F-PLN.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/WINDCLB.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/WINDCRZ.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/WINDDES.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/WINDHIST.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/MCDU.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/INITA.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/IRSINIT.nas</file>
@ -4085,6 +4088,7 @@
<file>Aircraft/A320-family/Nasal/MCDU/PERFTO.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/RADNAV.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/DATA.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/DATA2.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/STATUS.nas</file>
</mcdu>
<!-- Canvas -->

View file

@ -5,7 +5,7 @@
<pitch-deg type="float">0.0</pitch-deg>
<min-turn-radius-m type="float">15</min-turn-radius-m>
<stopping-distance-m type="float">5.0</stopping-distance-m>
<chocks alias="/services/chocks/nose"/>
<chocks alias="/services/chocks/enable"/>
<available type="int">1</available>
<enabled type="int"/>
<connected type="bool">false</connected>

View file

@ -32,100 +32,181 @@
<group>
<layout>vbox</layout>
<checkbox>
<label>Enable De-icing Truck</label>
<halign>left</halign>
<property>/services/deicing_truck/enable</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<group>
<layout>hbox</layout>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
<text>
<label>Landing Gear</label>
</text>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
</group>
<button>
<legend>De-ice Aircraft</legend>
<halign>center</halign>
<padding>5</padding>
<group>
<layout>vbox</layout>
<checkbox>
<label>Enable Gear Chocks</label>
<halign>left</halign>
<enable>
<property>/services/deicing_truck/enable</property>
<and>
<property>/gear/gear[0]/wow</property>
<property>/gear/gear[1]/wow</property>
<property>/gear/gear[2]/wow</property>
</and>
</enable>
<binding>
<command>property-assign</command>
<property>/services/deicing_truck/de-ice</property>
<value>1</value>
</binding>
</button>
<hrule />
<button>
<legend>Fuel Truck</legend>
<halign>center</halign>
<padding>5</padding>
<binding>
<command>nasal</command>
<script>
acconfig.fuel_dlg.open();
</script>
</binding>
</button>
<hrule />
<checkbox>
<label>Enable Catering Truck</label>
<halign>left</halign>
<property>/services/catering/enable</property>
<property>/services/chocks/enable</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
</group>
</group>
<button>
<legend>Toggle Catering</legend>
<halign>center</halign>
<padding>5</padding>
<enable>
<property>/services/catering/enable</property>
</enable>
<binding>
<condition>
<less-than>
<property>/services/catering/position-norm</property>
<value>0.1</value>
</less-than>
</condition><command>property-interpolate</command>
<property>/services/catering/position-norm</property>
<value>0.68</value>
<time>5</time>
</binding>
<binding>
<condition>
<greater-than-equals>
<property>/services/catering/position-norm</property>
<value>0.1</value>
</greater-than-equals>
</condition><command>property-interpolate</command>
<property>/services/catering/position-norm</property>
<value>0.0</value>
<time>5</time>
</binding>
</button>
<checkbox>
<label>Enable Baggage Ramp</label>
<halign>left</halign>
<property>/services/baggage/enable</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<group>
<layout>vbox</layout>
<group>
<layout>hbox</layout>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
<text>
<label>APU / EPU / AIR / HYD</label>
</text>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
</group>
<text>
<label>APU Oil Level</label>
</text>
<group>
<layout>hbox</layout>
<slider>
<enable>
<property>/systems/apu/oil/allow-oil-consumption</property>
</enable>
<x>10</x>
<y>50</y>
<width>200</width>
<property>/systems/apu/oil/level-l</property>
<min>3.9</min>
<max>5.4</max>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<text>
<x>10</x>
<y>200</y>
<label>8.8 litres</label><!-- placeholder for width -->
<format>%.1f litres</format>
<property>/systems/apu/oil/level-l</property>
<live>true</live>
</text>
</group>
<checkbox>
<label>Enable External Power Box</label>
<halign>left</halign>
<property>/controls/electrical/ground-cart</property>
<binding>
<command>property-assign</command>
<property>/controls/electrical/switches/ext-pwr</property>
<value>0</value>
</binding>
<enable>
<and>
<or>
<property>/controls/gear/brake-parking</property>
<property>/services/chocks/enable</property>
</or>
<less-than>
<property>/velocities/groundspeed-kt</property>
<value>2</value>
</less-than>
</and>
</enable>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Enable External Air</label>
<halign>left</halign>
<property>/controls/pneumatic/switches/groundair</property>
<binding>
<command>property-toggle</command>
<property>/controls/pneumatic/switches/groundair</property>
</binding>
<enable>
<and>
<or>
<property>/controls/gear/brake-parking</property>
<property>/services/chocks/enable</property>
</or>
<less-than>
<property>/velocities/groundspeed-kt</property>
<value>2</value>
</less-than>
</and>
</enable>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Yellow HYD Hand Pump</label>
<halign>left</halign>
<property>/controls/hydraulic/hand-pump-yellow</property>
<binding>
<command>property-toggle</command>
<property>/controls/hydraulic/hand-pump-yellow</property>
</binding>
<enable>
<and>
<or>
<property>/controls/gear/brake-parking</property>
<property>/services/chocks/enable</property>
</or>
<less-than>
<property>/velocities/groundspeed-kt</property>
<value>2</value>
</less-than>
<less-than>
<property>/systems/electrical/bus/ac-2</property>
<value>115</value>
</less-than>
<equals>
<property>/controls/electrical/switches/ext-pwr</property>
<value>0</value>
</equals>
</and>
</enable>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
</group>
<group>
<layout>vbox</layout>
<group>
<layout>hbox</layout>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
@ -169,45 +250,144 @@
<group>
<layout>hbox</layout>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
<text>
<label>APU Oil Level</label>
<label>Baggage</label>
</text>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
</group>
<group>
<layout>hbox</layout>
<slider>
<enable>
<property>/systems/apu/oil/allow-oil-consumption</property>
</enable>
<x>10</x>
<y>50</y>
<width>200</width>
<property>/systems/apu/oil/level-l</property>
<min>3.9</min>
<max>5.4</max>
<live>true</live>
<checkbox>
<label>Enable Baggage Ramp</label>
<halign>left</halign>
<property>/services/baggage/enable</property>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<text>
<x>10</x>
<y>200</y>
<label>8.8 litres</label> <!-- placeholder for width -->
<format>%.1f litres</format>
<property>/systems/apu/oil/level-l</property>
<live>true</live>
</checkbox>
<group>
<layout>hbox</layout>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
<text>
<label>Catering</label>
</text>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
</group>
<checkbox>
<label>Enable Catering Truck</label>
<halign>left</halign>
<property>/services/catering/enable</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<button>
<legend>Toggle Catering</legend>
<halign>center</halign>
<padding>5</padding>
<enable>
<property>/services/catering/enable</property>
</enable>
<binding>
<condition>
<less-than>
<property>/services/catering/position-norm</property>
<value>0.1</value>
</less-than>
</condition>
<command>property-interpolate</command>
<property>/services/catering/position-norm</property>
<value>0.68</value>
<time>5</time>
</binding>
<binding>
<condition>
<greater-than-equals>
<property>/services/catering/position-norm</property>
<value>0.1</value>
</greater-than-equals>
</condition>
<command>property-interpolate</command>
<property>/services/catering/position-norm</property>
<value>0.0</value>
<time>5</time>
</binding>
</button>
<group>
<layout>hbox</layout>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
<text>
<label>Fuel</label>
</text>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
</group>
<button>
<legend>Fuel Truck</legend>
<halign>center</halign>
<padding>5</padding>
<binding>
<command>nasal</command>
<script>
acconfig.fuel_dlg.open();
</script>
</binding>
</button>
<group>
<layout>hbox</layout>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
<text>
<label>De-icing</label>
</text>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
</group>
<checkbox>
<label>Enable De-icing Truck</label>
<halign>left</halign>
<property>/services/deicing_truck/enable</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<button>
<legend>De-ice Aircraft</legend>
<halign>center</halign>
<padding>5</padding>
<enable>
<property>/services/deicing_truck/enable</property>
</enable>
<binding>
<command>property-assign</command>
<property>/services/deicing_truck/de-ice</property>
<value>1</value>
</binding>
</button>
</group>
</PropertyList>

View file

@ -220,150 +220,6 @@
</binding>
</button>
<checkbox>
<label>Nose Gear Chock</label>
<halign>left</halign>
<enable>
<and>
<property>/gear/gear[0]/wow</property>
<property>/gear/gear[1]/wow</property>
<property>/gear/gear[2]/wow</property>
</and>
</enable>
<property>/services/chocks/nose</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Main Left Gear Chock</label>
<halign>left</halign>
<enable>
<and>
<property>/gear/gear[0]/wow</property>
<property>/gear/gear[1]/wow</property>
<property>/gear/gear[2]/wow</property>
</and>
</enable>
<property>/services/chocks/left</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Main Right Gear Chock</label>
<halign>left</halign>
<enable>
<and>
<property>/gear/gear[0]/wow</property>
<property>/gear/gear[1]/wow</property>
<property>/gear/gear[2]/wow</property>
</and>
</enable>
<property>/services/chocks/right</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Enable External Power Box</label>
<halign>left</halign>
<property>/controls/electrical/ground-cart</property>
<binding>
<command>property-assign</command>
<property>/controls/electrical/switches/ext-pwr</property>
<value>0</value>
</binding>
<enable>
<and>
<or>
<property>/controls/gear/brake-parking</property>
<property>/services/chocks/nose</property>
<property>/services/chocks/left</property>
<property>/services/chocks/right</property>
</or>
<less-than>
<property>/velocities/groundspeed-kt</property>
<value>2</value>
</less-than>
</and>
</enable>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Enable External Air</label>
<halign>left</halign>
<property>/controls/pneumatic/switches/groundair</property>
<binding>
<command>property-toggle</command>
<property>/controls/pneumatic/switches/groundair</property>
</binding>
<enable>
<and>
<or>
<property>/controls/gear/brake-parking</property>
<property>/services/chocks/nose</property>
<property>/services/chocks/left</property>
<property>/services/chocks/right</property>
</or>
<less-than>
<property>/velocities/groundspeed-kt</property>
<value>2</value>
</less-than>
</and>
</enable>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Yellow HYD Hand Pump</label>
<halign>left</halign>
<property>/controls/hydraulic/hand-pump-yellow</property>
<binding>
<command>property-toggle</command>
<property>/controls/hydraulic/hand-pump-yellow</property>
</binding>
<enable>
<and>
<or>
<property>/controls/gear/brake-parking</property>
<property>/services/chocks/nose</property>
<property>/services/chocks/left</property>
<property>/services/chocks/right</property>
</or>
<less-than>
<property>/velocities/groundspeed-kt</property>
<value>2</value>
</less-than>
<less-than>
<property>/systems/electrical/bus/ac-2</property>
<value>115</value>
</less-than>
<equals>
<property>/controls/electrical/switches/ext-pwr</property>
<value>0</value>
</equals>
</and>
</enable>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<hrule/>
<checkbox>

View file

@ -132,7 +132,7 @@
<path>Aircraft/A320-family/Models/Services/Chocks/chock_nose.ac</path>
<condition>
<equals>
<property>services/chocks/nose</property>
<property>services/chocks/enable</property>
<value>1</value>
</equals>
</condition>
@ -147,7 +147,7 @@
<path>Aircraft/A320-family/Models/Services/Chocks/chock_left.ac</path>
<condition>
<equals>
<property>services/chocks/left</property>
<property>services/chocks/enable</property>
<value>1</value>
</equals>
</condition>
@ -163,7 +163,7 @@
<path>Aircraft/A320-family/Models/Services/Chocks/chock_right.ac</path>
<condition>
<equals>
<property>services/chocks/right</property>
<property>services/chocks/enable</property>
<value>1</value>
</equals>
</condition>

View file

@ -18,8 +18,14 @@ var myAirways = [nil, nil];
var myDuplicate = [nil, nil];
var myClosestAirport = [nil, nil];
var myPilotWP = [nil, nil];
var myWind = [nil, nil];
var myCLBWIND = [nil, nil];
var myCRZWIND = [nil, nil];
var myDESWIND = [nil, nil];
var myHISTWIND = [nil, nil];
var default = "BoeingCDU-Large.ttf";
var symbol = "helvetica_medium.txf";
#var symbol = "helvetica_medium.txf";
var symbol = "LiberationMonoCustom.ttf";
var normal = 70;
var small = 56;
var page = "";
@ -204,6 +210,8 @@ var dest_qnh = props.globals.getNode("/FMGC/internal/dest-qnh", 1);
var dest_temp = props.globals.getNode("/FMGC/internal/dest-temp", 1);
var dest_mag = props.globals.getNode("/FMGC/internal/dest-mag", 1);
var dest_wind = props.globals.getNode("/FMGC/internal/dest-wind", 1);
# var grnd_mag = props.globals.getNode("/FMGC/internal/dest-mag-grnd", 1);
# var grnd_wind = props.globals.getNode("/FMGC/internal/dest-wind-grnd", 1);
var vapp_speed_set = props.globals.getNode("/FMGC/internal/vapp-speed-set", 1);
var final = props.globals.getNode("/FMGC/internal/final", 1);
var radio = props.globals.getNode("/FMGC/internal/radio", 1);
@ -978,7 +986,7 @@ var canvas_MCDU_base = {
} else {
me["Simple_L5"].setFont(symbol);
me["Simple_L5"].setFontSize(small);
me["Simple_L5"].setText("[ ]/[ . ]");
me["Simple_L5"].setText("[ ]/[ ]");
}
if (vor2FreqSet.getValue() == 1) {
@ -998,7 +1006,7 @@ var canvas_MCDU_base = {
} else {
me["Simple_R5"].setFont(symbol);
me["Simple_R5"].setFontSize(small);
me["Simple_R5"].setText("[ . ]/[ ]");
me["Simple_R5"].setText("[ ]/[ ]");
}
me["Simple_L1"].setText(" " ~ vor1.getValue());
@ -2968,6 +2976,8 @@ var canvas_MCDU_base = {
me["Simple_L3S"].setText("MAG WIND");
if (dest_mag.getValue() != -1 and dest_wind.getValue() != -1) {
me["Simple_L3"].setText(sprintf("%03.0fg", dest_mag.getValue()) ~ sprintf("/%.0f", dest_wind.getValue()));
# } else if (grnd_mag.getValue() != -1 and grnd_wind.getValue() != -1) {
# me["Simple_L3"].setText(sprintf("%03.0fg", grnd_mag.getValue()) ~ sprintf("/%.0f", grnd_wind.getValue()));
} else {
me["Simple_L3"].setText("---g/---");;
}
@ -3161,6 +3171,135 @@ var canvas_MCDU_base = {
me["Simple_C1S"].setText("FLP RETR");
me["Simple_C2S"].setText("SLT RETR");
me["Simple_C3S"].setText("CLEAN ");
} else if (page == "WINDCLB" or page == "WINDCRZ" or page == "WINDDES" or page == "WINDHIST") {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
me["Simple_Center"].show();
me["FPLN"].hide();
me["DIRTO_TMPY_group"].hide();
me["INITA"].hide();
me["IRSINIT"].hide();
me["INITB"].hide();
me["FUELPRED"].hide();
me["PROG"].hide();
me["PERFTO"].hide();
# if (page == "WINDCRZ") {
# up/down arrows show
# } else {
# up/down arrows hide
# }
me["Simple_PageNum"].setText("X/X");
me["Simple_PageNum"].hide();
me["Simple_Title"].show();
me["ArrowLeft"].hide();
me["ArrowRight"].hide();
me["Simple_L0S"].hide();
me["Simple_C3B"].hide();
me["Simple_C4B"].hide();
me.fontLeft(default, default, default, default, default, default);
me.fontLeftS(default, default, default, default, default, default);
me.fontRight(default, default, default, default, default, default);
me.fontRightS(default, default, default, default, default, default);
me.fontSizeLeft(normal, normal, normal, normal, normal, normal);
me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht");
if (page == "WINDCLB") {
myWind = myCLBWIND;
me.colorLeftS("wht", "wht", "wht", "wht", "wht", "amb");
me.colorRightS("wht", "wht", "amb", "wht", "wht", "amb");
me.fontSizeCenter(normal, normal, normal, normal, normal, normal);
} else if (page == "WINDCRZ") {
myWind = myCRZWIND;
me.colorLeftS("wht", "wht", "wht", "wht", "wht", "amb");
me.colorRightS("wht", "amb", "wht", "wht", "wht", "amb");
me.fontSizeCenter(normal, normal, normal, normal, normal, normal);
} else if (page == "WINDDES") {
myWind = myDESWIND;
me.colorLeftS("wht", "wht", "wht", "wht", "wht", "amb");
me.colorRightS("wht", "wht", "amb", "wht", "wht", "amb");
me.fontSizeCenter(normal, normal, normal, normal, normal, normal);
} else if (page == "WINDHIST") {
myWind = myHISTWIND;
me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
me.fontSizeCenter(small, small, small, small, small, normal);
}
if (myWind[i] != nil) {
if (page == "WINDCRZ") {
me["Simple_Title"].setText(sprintf("%s", myWind[i].title[0] ~ myWind[i].title[1] ~ myWind[i].title[2]));
} else {
me["Simple_Title"].setText(sprintf("%s", myWind[i].title));
}
me["Simple_Title"].setColor(getprop("/MCDUC/colors/" ~ myWind[i].titleColour ~ "/r"), getprop("/MCDUC/colors/" ~ myWind[i].titleColour ~ "/g"), getprop("/MCDUC/colors/" ~ myWind[i].titleColour ~ "/b"));
forindex (var matrixArrow; myWind[i].arrowsMatrix) {
if (matrixArrow == 0) {
var sign = "L";
} else {
var sign = "R";
}
forindex (var item; myWind[i].arrowsMatrix[matrixArrow]) {
if (myWind[i].arrowsMatrix[matrixArrow][item] == 1) {
me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].show();
} else {
me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].hide();
}
}
}
me.colorLeftArrow(myWind[i].arrowsColour[0][0],myWind[i].arrowsColour[0][1],myWind[i].arrowsColour[0][2],myWind[i].arrowsColour[0][3],myWind[i].arrowsColour[0][4],myWind[i].arrowsColour[0][5]);
forindex (var matrixFont; myWind[i].fontMatrix) {
if (matrixFont == 0) {
var sign = "L";
} else {
var sign = "R";
}
forindex (var item; myWind[i].fontMatrix[matrixFont]) {
if (myWind[i].fontMatrix[matrixFont][item] == 1) {
me["Simple_" ~ sign ~ (item + 1)].setFont(symbol);
me["Simple_" ~ sign ~ (item + 1)].setFontSize(small);
} else {
me["Simple_" ~ sign ~ (item + 1)].setFont(default);
me["Simple_" ~ sign ~ (item + 1)].setFontSize(normal);
}
}
}
me.dynamicPageFunc(myWind[i].L1, "Simple_L1");
me.dynamicPageFunc(myWind[i].L2, "Simple_L2");
me.dynamicPageFunc(myWind[i].L3, "Simple_L3");
me.dynamicPageFunc(myWind[i].L4, "Simple_L4");
me.dynamicPageFunc(myWind[i].L5, "Simple_L5");
me.dynamicPageFunc(myWind[i].L6, "Simple_L6");
me.colorLeft(myWind[i].L1[2],myWind[i].L2[2],myWind[i].L3[2],myWind[i].L4[2],myWind[i].L5[2],myWind[i].L6[2]);
me.dynamicPageFunc(myWind[i].C1, "Simple_C1");
me.dynamicPageFunc(myWind[i].C2, "Simple_C2");
me.dynamicPageFunc(myWind[i].C3, "Simple_C3");
me.dynamicPageFunc(myWind[i].C4, "Simple_C4");
me.dynamicPageFunc(myWind[i].C5, "Simple_C5");
me.dynamicPageFunc(myWind[i].C6, "Simple_C6");
me.colorCenter(myWind[i].C1[2],myWind[i].C2[2],myWind[i].C3[2],myWind[i].C4[2],myWind[i].C5[2],myWind[i].C6[2]);
me.dynamicPageFunc(myWind[i].R1, "Simple_R1");
me.dynamicPageFunc(myWind[i].R2, "Simple_R2");
me.dynamicPageFunc(myWind[i].R3, "Simple_R3");
me.dynamicPageFunc(myWind[i].R4, "Simple_R4");
me.dynamicPageFunc(myWind[i].R5, "Simple_R5");
me.dynamicPageFunc(myWind[i].R6, "Simple_R6");
me.colorRight(myWind[i].R1[2],myWind[i].R2[2],myWind[i].R3[2],myWind[i].R4[2],myWind[i].R5[2],myWind[i].R6[2]);
}
pageSwitch[i].setBoolValue(1);
}
} else if (page == "LATREV") {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();
@ -3200,6 +3339,8 @@ var canvas_MCDU_base = {
if (myLatRev[i] != nil) {
me["Simple_Title"].setText(sprintf("%s", myLatRev[i].title[0] ~ myLatRev[i].title[1] ~ myLatRev[i].title[2]));
me["Simple_Title"].setColor(getprop("/MCDUC/colors/" ~ myLatRev[i].titleColour ~ "/r"), getprop("/MCDUC/colors/" ~ myLatRev[i].titleColour ~ "/g"), getprop("/MCDUC/colors/" ~ myLatRev[i].titleColour ~ "/b"));
if (myLatRev[i].subtitle[0] != nil) {
me["Simple_Center"].show();

View file

@ -430,6 +430,12 @@ var ITAF = {
if (FPLN.wp0Dist.getValue() <= FPLN.turnDist and !Gear.wow1.getBoolValue()) {
flightPlanController.autoSequencing();
}
#if (FPLN.wp0Dist.getValue() <= FPLN.turnDist and !Gear.wow1.getBoolValue() and fmgc.flightPlanController.flightplans[2].getWP(FPLN.currentWPTemp).fly_type == "flyBy") {
# flightPlanController.autoSequencing();
#} elsif (FPLN.wp0Dist.getValue() <= 0.1) {
# flightPlanController.autoSequencing();
#}
}
}
},

View file

@ -269,9 +269,9 @@ var updateFuel = func {
temp = getprop("/FMGC/internal/cruise-temp");
dist = flightPlanController.arrivalDist;
wind = getprop("/FMGC/internal/trip-wind");
trpWind = getprop("/FMGC/internal/trip-wind");
wind_value = getprop("/FMGC/internal/trip-wind-value");
if (find("HD", wind) != -1 or find("-", wind) != -1 or find("H", wind) != -1) {
if (find("HD", trpWind) != -1 or find("-", trpWind) != -1 or find("H", trpWind) != -1) {
wind_value = wind_value * -1;
}
dist = dist - (dist * wind_value * 0.002);
@ -722,6 +722,8 @@ var reset_FMGC = func {
ITAF.init();
FMGCinit();
flightPlanController.reset();
windController.reset();
mcdu.MCDU_reset(0);
mcdu.MCDU_reset(1);
setprop("it-autoflight/input/fd1", fd1);

View file

@ -96,6 +96,7 @@ var flightPlanController = {
if (canvas_mcdu.myAirways[n] != nil) {
canvas_mcdu.myAirways[n].updateTmpy();
}
fmgc.windController.createTemporaryWinds(n);
me.flightPlanChanged(n);
},
@ -105,8 +106,6 @@ var flightPlanController = {
print(err[0]);
print("Load failed.");
}
# try to fix fgfp
me.flightplans[3].destination = airportinfo(getprop("/FMGC/internal/arr-arpt"));
me.destroyTemporaryFlightPlan(3, 1);
},
@ -116,6 +115,7 @@ var flightPlanController = {
me.resetFlightplan(2);
me.flightplans[2] = me.flightplans[n].clone();
if (n != 3) {
if (mcdu.isNoSid[n] == 1) {
mcdu.isNoSid[2] = 1;
} else {
@ -145,6 +145,7 @@ var flightPlanController = {
} else {
mcdu.isNoTransArr[2] = 0;
}
}
me.flightPlanChanged(2);
flightPlanTimer.start();
@ -155,6 +156,8 @@ var flightPlanController = {
if (canvas_mcdu.myDirTo[n] != nil) {
canvas_mcdu.myDirTo[n].updateTmpy();
}
fmgc.windController.destroyTemporaryWinds(n, a);
me.flightPlanChanged(n);
},
updateAirports: func(dep, arr, plan) {
@ -165,6 +168,7 @@ var flightPlanController = {
me.destroyTemporaryFlightPlan(0, 0);
me.destroyTemporaryFlightPlan(1, 0);
me.currentToWptIndex.setValue(0);
me.arrivalIndex = [0, 0, 0]; # reset arrival index calculations
}
me.addDiscontinuity(1, plan);
@ -286,10 +290,12 @@ var flightPlanController = {
insertTP: func(n, index = 1) {
me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "T-P"), index);
fmgc.windController.insertWind(n, index, 0, "T-P");
},
insertPPOS: func(n, index = 0) {
me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "PPOS"), index);
fmgc.windController.insertWind(n, index, 0, "PPOS");
},
# childWPBearingDistance - return waypoint at bearing and distance from specified waypoint ghost
@ -319,6 +325,7 @@ var flightPlanController = {
# fudge the altitude since we cannot create a hdgtoAlt from nasal. Assume 600 feet per mile - 2.5 miles
me.flightplans[n].insertWP(createWP(me.childWPBearingDistance(wptStore, me.flightplans[n].departure_runway.heading, 2.5), "1500", "sid"), 1);
fmgc.windController.insertWind(n, 1, 0, "1500");
}
me.flightPlanChanged(n);
},
@ -339,6 +346,7 @@ var flightPlanController = {
hdg = hdg - 360;
}
me.flightplans[n].insertWP(createWP(me.childWPBearingDistance(wptStore, hdg, 5), "CF", "star"), me.arrivalIndex[n]);
fmgc.windController.insertWind(n, me.arrivalIndex[n], 0, "CF");
}
me.flightPlanChanged(n);
},
@ -361,6 +369,7 @@ var flightPlanController = {
# use createWP here as createWPFrom doesn't accept waypoints
# createWPFrom worked before... but be sure!
me.flightplans[plan].insertWP(createWP(waypointGhost, waypointGhost.wp_name), 2);
fmgc.windController.insertWind(plan, 2, 0, waypointGhost.wp_name);
me.addDiscontinuity(3, plan);
} else {
# we want to delete the intermediate waypoints up to but not including the waypoint. Leave index 0, we delete it later.
@ -386,6 +395,7 @@ var flightPlanController = {
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);
fmgc.windController.deleteWind(n, 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);
@ -393,6 +403,7 @@ var flightPlanController = {
}
} else {
me.flightplans[n].deleteWP(index);
fmgc.windController.deleteWind(n, index);
}
me.flightPlanChanged(n);
canvas_nd.A3XXRouteDriver.triggerSignal("fp-removed");
@ -452,6 +463,7 @@ var flightPlanController = {
var indexPresent = me.flightplans[plan].indexOfWP(airport[indexToInsert]);
if (me.flightplans[plan].indexOfWP(airport[indexToInsert]) == -1) {
me.flightplans[plan].insertWP(createWPFrom(airport[indexToInsert]), index);
fmgc.windController.insertWind(plan, index, 0, text);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
@ -485,6 +497,7 @@ var flightPlanController = {
var indexPresent = me.flightplans[plan].indexOfWP(fix[indexToInsert]);
if (me.flightplans[plan].indexOfWP(fix[indexToInsert]) == -1) {
me.flightplans[plan].insertWP(createWPFrom(fix[indexToInsert]), index);
fmgc.windController.insertWind(plan, index, 1, text);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
@ -518,6 +531,7 @@ var flightPlanController = {
var indexPresent = me.flightplans[plan].indexOfWP(navaid[indexToInsert]);
if (me.flightplans[plan].indexOfWP(navaid[indexToInsert]) == -1) {
me.flightplans[plan].insertWP(createWPFrom(navaid[indexToInsert]), index);
fmgc.windController.insertWind(plan, index, 1, text);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
@ -538,6 +552,7 @@ var flightPlanController = {
if (me.flightplans[plan].indexOfWP(wpGhost) == -1) {
# use createWP here as createWPFrom doesn't accept waypoints
me.flightplans[plan].insertWP(createWP(wpGhost, wpGhost.wp_name), index);
fmgc.windController.insertWind(plan, index, 1, wpGhost.wp_name);
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
@ -567,6 +582,7 @@ var flightPlanController = {
}
me.flightplans[plan].insertWP(waypoint.wpGhost, index);
fmgc.windController.insertWind(plan, index, 1, "LL");
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
@ -638,6 +654,37 @@ var flightPlanController = {
return me.insertPlaceBearingDistance(wpGhost, textSplit[1] + localMagvar, textSplit[2], index, plan); # magnetic to true? I don't know. But this works!
},
getNavCount: func(plan) {
var count = 0;
for (var wpt = 0; wpt < me.flightplans[plan].getPlanSize(); wpt += 1) {
#print(me.flightplans[plan].getWP(wpt).wp_type);
if (me.flightplans[plan].getWP(wpt).wp_type == "navaid") {
count += 1;
}
}
return count;
},
getDepartureCount: func(plan) {
var count = 0;
for (var wpt = 0; wpt < me.flightplans[plan].getPlanSize(); wpt += 1) {
#print(me.flightplans[plan].getWP(wpt).wp_role);
if (me.flightplans[plan].getWP(wpt).wp_role == "sid") {
count += 1;
}
}
return count;
},
getArrivalCount: func(plan) {
var count = 0;
for (var wpt = 0; wpt < me.flightplans[plan].getPlanSize(); wpt += 1) {
if (me.flightplans[plan].getWP(wpt).wp_role == "star" or me.flightplans[plan].getWP(wpt).wp_role == "approach" or me.flightplans[plan].getWP(wpt).wp_role == "missed") {
count += 1;
}
}
return count;
},
# insertPlaceBearingDistance - insert PBD waypoint at specified index,
# at some specified bearing, distance from a specified location
@ -654,6 +701,7 @@ var flightPlanController = {
}
me.flightplans[plan].insertWP(waypoint.wpGhost, index);
fmgc.windController.insertWind(plan, index, 0, "PBD");
me.addDiscontinuity(index + 1, plan);
me.flightPlanChanged(plan);
return 2;
@ -709,7 +757,10 @@ var flightPlanController = {
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();
fmgc.windController.updatePlans();
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
@ -773,6 +824,12 @@ var flightPlanController = {
}
}
}
if (me.flightplans[2].getWP(me.arrivalIndex[2]) == nil or me.flightplans[2].getWP(1) == nil) {
me.arrivalDist = 9999;
print(me.arrivalIndex[2]);
}
me.arrivalDist = me.flightplans[2].getWP(me.arrivalIndex[2]).distance_along_route - me.flightplans[2].getWP(1).leg_distance + me._arrivalDist;
me.updateMCDUDriver(n);
},

378
Nasal/FMGC/winds.nas Normal file
View file

@ -0,0 +1,378 @@
# A3XX FMGC Wind Driver
# Copyright (c) 2020 Matthew Maring (mattmaring)
var wind = {
new: func() {
var w = {parents: [wind]};
w.heading = 0;
w.magnitude = 0;
w.altitude = "";
return w;
},
newcopy: func(heading, magnitude, altitude) {
var w = {parents: [wind]};
w.heading = heading;
w.magnitude = magnitude;
w.altitude = altitude;
return w;
}
};
var alt_wind = {
new: func() {
var aw = {parents: [alt_wind]};
aw.heading = 0;
aw.magnitude = 0;
return aw;
},
newcopy: func(heading, magnitude) {
var aw = {parents: [alt_wind]};
aw.heading = heading ;
aw.magnitude = magnitude;
return aw;
}
};
var sat_temp = {
new: func() {
var st = {parents: [sat_temp]};
st.temp = 0;
st.altitude = "";
return st;
},
newcopy: func(temp, altitude) {
var st = {parents: [sat_temp]};
st.temp = temp;
st.altitude = altitude;
return st;
}
};
var waypoint_winds = {
new: func(id, type, includeWind) {
var ww = {parents: [waypoint_winds]};
ww.id = id;
ww.type = type; #departure, waypoint, arrival
ww.includeWind = includeWind;
ww.wind1 = wind.new();
ww.wind2 = wind.new();
ww.wind3 = wind.new();
ww.wind4 = wind.new();
ww.wind5 = wind.new();
ww.sat1 = sat_temp.new();
ww.alt1 = alt_wind.new();
return ww;
},
newcopy: func(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1) {
var ww = {parents: [waypoint_winds]};
ww.id = id;
ww.type = type; #departure, waypoint, arrival
ww.includeWind = includeWind;
ww.wind1 = wind1;
ww.wind2 = wind2;
ww.wind3 = wind3;
ww.wind4 = wind4;
ww.wind5 = wind5;
ww.sat1 = sat1;
ww.alt1 = alt1;
return ww;
}
};
var windController = {
clb_winds: [0, 0, 0],
crz_winds: [0, 0, 0],
des_winds: [0, 0, 0],
winds: [[], [], []], #waypoint winds used if route includes navaids
nav_indicies: [[], [], []],
windSizes: [0, 0, 0],
accessPage: ["", ""],
#temporaryFlag: [0, 0],
init: func() {
me.resetWind(2);
me.clb_winds[2] = waypoint_winds.new("climb", "waypoint", 1);
me.crz_winds[2] = waypoint_winds.new("cruize", "waypoint", 1);
me.des_winds[2] = waypoint_winds.new("descent", "waypoint", 1);
},
reset: func() {
#me.temporaryFlag[0] = 0;
#me.temporaryFlag[1] = 0;
me.resetWind(0);
me.resetWind(1);
me.resetWind(2);
},
resetWind: func(n) {
me.clb_winds[n] = 0;
me.crz_winds[n] = 0;
me.des_winds[n] = 0;
me.winds[n] = [];
me.nav_indicies[n] = [];
me.windSizes[n] = 0;
},
copyClbWind: func(n) {
var id = me.clb_winds[n].id;
var type = me.clb_winds[n].type;
var includeWind = me.clb_winds[n].includeWind;
var wind1 = wind.newcopy(me.clb_winds[n].wind1.heading, me.clb_winds[n].wind1.magnitude, me.clb_winds[n].wind1.altitude);
var wind2 = wind.newcopy(me.clb_winds[n].wind2.heading, me.clb_winds[n].wind2.magnitude, me.clb_winds[n].wind2.altitude);
var wind3 = wind.newcopy(me.clb_winds[n].wind3.heading, me.clb_winds[n].wind3.magnitude, me.clb_winds[n].wind3.altitude);
var wind4 = wind.newcopy(me.clb_winds[n].wind4.heading, me.clb_winds[n].wind4.magnitude, me.clb_winds[n].wind4.altitude);
var wind5 = wind.newcopy(me.clb_winds[n].wind5.heading, me.clb_winds[n].wind5.magnitude, me.clb_winds[n].wind5.altitude);
var sat1 = sat_temp.newcopy(me.clb_winds[n].sat1.temp, me.clb_winds[n].sat1.altitude);
var alt1 = alt_wind.newcopy(me.clb_winds[n].alt1.heading, me.clb_winds[n].alt1.magnitude);
return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1);
},
copyCrzWind: func(n) {
var id = me.crz_winds[n].id;
var type = me.crz_winds[n].type;
var includeWind = me.crz_winds[n].includeWind;
var wind1 = wind.newcopy(me.crz_winds[n].wind1.heading, me.crz_winds[n].wind1.magnitude, me.crz_winds[n].wind1.altitude);
var wind2 = wind.newcopy(me.crz_winds[n].wind2.heading, me.crz_winds[n].wind2.magnitude, me.crz_winds[n].wind2.altitude);
var wind3 = wind.newcopy(me.crz_winds[n].wind3.heading, me.crz_winds[n].wind3.magnitude, me.crz_winds[n].wind3.altitude);
var wind4 = wind.newcopy(me.crz_winds[n].wind4.heading, me.crz_winds[n].wind4.magnitude, me.crz_winds[n].wind4.altitude);
var wind5 = wind.newcopy(me.crz_winds[n].wind5.heading, me.crz_winds[n].wind5.magnitude, me.crz_winds[n].wind5.altitude);
var sat1 = sat_temp.newcopy(me.crz_winds[n].sat1.temp, me.crz_winds[n].sat1.altitude);
var alt1 = alt_wind.newcopy(me.crz_winds[n].alt1.heading, me.crz_winds[n].alt1.magnitude);
return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1);
},
copyDesWind: func(n) {
var id = me.des_winds[n].id;
var type = me.des_winds[n].type;
var includeWind = me.des_winds[n].includeWind;
var wind1 = wind.newcopy(me.des_winds[n].wind1.heading, me.des_winds[n].wind1.magnitude, me.des_winds[n].wind1.altitude);
var wind2 = wind.newcopy(me.des_winds[n].wind2.heading, me.des_winds[n].wind2.magnitude, me.des_winds[n].wind2.altitude);
var wind3 = wind.newcopy(me.des_winds[n].wind3.heading, me.des_winds[n].wind3.magnitude, me.des_winds[n].wind3.altitude);
var wind4 = wind.newcopy(me.des_winds[n].wind4.heading, me.des_winds[n].wind4.magnitude, me.des_winds[n].wind4.altitude);
var wind5 = wind.newcopy(me.des_winds[n].wind5.heading, me.des_winds[n].wind5.magnitude, me.des_winds[n].wind5.altitude);
var sat1 = sat_temp.newcopy(me.des_winds[n].sat1.temp, me.des_winds[n].sat1.altitude);
var alt1 = alt_wind.newcopy(me.des_winds[n].alt1.heading, me.des_winds[n].alt1.magnitude);
return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1);
},
copyWinds: func(n) {
var tempWind = [];
for (i = 0; i < size(me.winds[n]); i += 1) {
var id = me.winds[n][i].id;
var type = me.winds[n][i].type;
var includeWind = me.winds[n][i].includeWind;
var wind1 = wind.newcopy(me.winds[n][i].wind1.heading, me.winds[n][i].wind1.magnitude, me.winds[n][i].wind1.altitude);
var wind2 = wind.newcopy(me.winds[n][i].wind2.heading, me.winds[n][i].wind2.magnitude, me.winds[n][i].wind2.altitude);
var wind3 = wind.newcopy(me.winds[n][i].wind3.heading, me.winds[n][i].wind3.magnitude, me.winds[n][i].wind3.altitude);
var wind4 = wind.newcopy(me.winds[n][i].wind4.heading, me.winds[n][i].wind4.magnitude, me.winds[n][i].wind4.altitude);
var wind5 = wind.newcopy(me.winds[n][i].wind5.heading, me.winds[n][i].wind5.magnitude, me.winds[n][i].wind5.altitude);
var sat1 = sat_temp.newcopy(me.winds[n][i].sat1.temp, me.winds[n][i].sat1.altitude);
var alt1 = alt_wind.newcopy(me.winds[n][i].alt1.heading, me.winds[n][i].alt1.magnitude);
append(tempWind, waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1));
}
return tempWind;
},
createTemporaryWinds: func(n) {
me.resetWind(n);
me.clb_winds[n] = me.copyClbWind(2);
me.crz_winds[n] = me.copyCrzWind(2);
me.des_winds[n] = me.copyDesWind(2);
me.winds[n] = me.copyWinds(2);
me.nav_indicies[n] = me.nav_indicies[2];
me.windSizes[n] = me.windSizes[2];
#me.temporaryFlag[n] = 1;
},
destroyTemporaryWinds: func(n, a) { # a = 1 activate, a = 0 erase
#print("destroying temporary ", n);
if (a == 1) {
me.resetWind(2);
me.clb_winds[2] = me.copyClbWind(n);
me.crz_winds[2] = me.copyCrzWind(n);
me.des_winds[2] = me.copyDesWind(n);
me.winds[2] = me.copyWinds(n);
me.nav_indicies[2] = me.nav_indicies[n];
me.windSizes[2] = me.windSizes[n];
}
if (n == 3) { return; }
me.resetWind(n);
#me.updatePlans();
#me.temporaryFlag[n] = 0;
},
insertWind: func(plan, index, value, id) {
if (me.windSizes[plan] == index) {
if (value == 3) {
append(me.winds[plan], waypoint_winds.new(id, "arrival", 0));
} else if (value == 2) {
append(me.winds[plan], waypoint_winds.new(id, "departure", 0));
} else if (value == 1) {
append(me.winds[plan], waypoint_winds.new(id, "waypoint", 1));
} else {
append(me.winds[plan], waypoint_winds.new(id, "waypoint", 0));
}
me.windSizes[plan] += 1;
} else if (me.windSizes[plan] > index and index >= 0) {
append(me.winds[plan], waypoint_winds.new(id, "waypoint", 0));
me.windSizes[plan] += 1;
for (i = me.windSizes[plan] - 1; i > index; i -= 1) {
me.winds[plan][i] = me.winds[plan][i - 1];
}
if (value == 3) {
me.winds[plan][index] = waypoint_winds.new(id, "arrival", 0);
} else if (value == 2) {
me.winds[plan][index] = waypoint_winds.new(id, "departure", 0);
} else if (value == 1) {
me.winds[plan][index] = waypoint_winds.new(id, "waypoint", 1);
} else {
me.winds[plan][index] = waypoint_winds.new(id, "waypoint", 0);
}
} else {
#print("insert invalid id: ", id, ", plan: ", plan, ", index: ", index, ", size: ", me.windSizes[plan]);
#debug.dump(me.winds);
#debug.dump(me.windSizes);
return;
}
#print("insert plan: ", plan, ", index: ", index);
#debug.dump(me.winds);
#debug.dump(me.windSizes);
},
deleteWind: func(plan, index) {
if (me.windSizes[plan] == index) {
pop(me.winds[plan]);
me.windSizes[plan] -= 1;
} else if (me.windSizes[plan] > index and index >= 0) {
for (i = index; i < me.windSizes[plan] - 1; i += 1) {
me.winds[plan][i] = me.winds[plan][i + 1];
}
pop(me.winds[plan]);
me.windSizes[plan] -= 1;
} else {
#print("delete invalid plan: ", plan, ", index: ", index, ", size: ", me.windSizes[plan]);
#debug.dump(me.winds);
#debug.dump(me.windSizes);
return;
}
#print("delete plan: ", plan, ", index: ", index);
#debug.dump(me.winds);
#debug.dump(me.windSizes);
},
updatePlans: func() {
var winds_copy = me.winds;
var windSizes_copy = me.windSizes;
me.winds = [[], [], []];
me.nav_indicies = [[], [], []];
me.windSizes = [0, 0, 0];
# loop through waypoints
for (plan = 0; plan <= 2; plan += 1) {
for (i = 0; i < fmgc.flightPlanController.flightplans[plan].getPlanSize(); i += 1) {
var waypoint = fmgc.flightPlanController.flightplans[plan].getWP(i);
#print(waypoint.wp_role, "| : |", waypoint.wp_type);
if (waypoint.wp_role == "sid") {
append(me.winds[plan], waypoint_winds.new(waypoint.id, "departure", 0));
me.windSizes[plan] += 1;
} else if (waypoint.wp_role == "star" or waypoint.wp_role == "approach" or waypoint.wp_role == "missed") {
append(me.winds[plan], waypoint_winds.new(waypoint.id, "arrival", 0));
me.windSizes[plan] += 1;
} else if (waypoint.wp_role == nil and waypoint.wp_type == "navaid") {
var found = 0;
for (index = 0; index < windSizes_copy[plan]; index += 1) {
#print(waypoint.id, " : ", winds_copy[plan][index].id);
if (waypoint.id == winds_copy[plan][index].id) {
append(me.winds[plan], winds_copy[plan][index]);
append(me.nav_indicies[plan], i);
me.windSizes[plan] += 1;
found = 1;
}
}
if (found != 1) {
append(me.winds[plan], waypoint_winds.new(waypoint.id, "waypoint", 0));
me.windSizes[plan] += 1;
}
} else {
append(me.winds[plan], waypoint_winds.new(waypoint.id, "waypoint", 0));
me.windSizes[plan] += 1;
}
#print("insert plan: ", plan, ", index: ", i);
#debug.dump(me.winds);
#debug.dump(me.nav_indicies);
#debug.dump(me.windSizes);
}
}
if (canvas_mcdu.myCLBWIND[1] != nil) {
canvas_mcdu.myCLBWIND[1].reload();
}
if (canvas_mcdu.myCLBWIND[0] != nil) {
canvas_mcdu.myCLBWIND[0].reload();
}
if (canvas_mcdu.myCRZWIND[1] != nil) {
if (!fmgc.flightPlanController.temporaryFlag[1]) {
if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) {
canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]);
canvas_mcdu.myCRZWIND[1].singleCRZ = 0;
canvas_mcdu.myCRZWIND[1].cur_location = 0;
} else {
canvas_mcdu.myCRZWIND[1].waypoint = nil;
canvas_mcdu.myCRZWIND[1].singleCRZ = 1;
canvas_mcdu.myCRZWIND[1].cur_location = 0;
}
} else {
if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[1]) > 0) {
canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[1].getWP(me.nav_indicies[1][0]);
canvas_mcdu.myCRZWIND[1].singleCRZ = 0;
canvas_mcdu.myCRZWIND[1].cur_location = 0;
} else {
canvas_mcdu.myCRZWIND[1].waypoint = nil;
canvas_mcdu.myCRZWIND[1].singleCRZ = 1;
canvas_mcdu.myCRZWIND[1].cur_location = 0;
}
}
canvas_mcdu.myCRZWIND[1].reload();
}
if (canvas_mcdu.myCRZWIND[0] != nil) {
if (!fmgc.flightPlanController.temporaryFlag[0]) {
if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) {
canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]);
canvas_mcdu.myCRZWIND[0].singleCRZ = 0;
canvas_mcdu.myCRZWIND[0].cur_location = 0;
} else {
canvas_mcdu.myCRZWIND[0].waypoint = nil;
canvas_mcdu.myCRZWIND[0].singleCRZ = 1;
canvas_mcdu.myCRZWIND[0].cur_location = 0;
}
} else {
if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[0]) > 0) {
canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[0].getWP(me.nav_indicies[0][0]);
canvas_mcdu.myCRZWIND[0].singleCRZ = 0;
canvas_mcdu.myCRZWIND[0].cur_location = 0;
} else {
canvas_mcdu.myCRZWIND[0].waypoint = nil;
canvas_mcdu.myCRZWIND[0].singleCRZ = 1;
canvas_mcdu.myCRZWIND[0].cur_location = 0;
}
}
canvas_mcdu.myCRZWIND[0].reload();
}
if (canvas_mcdu.myDESWIND[1] != nil) {
canvas_mcdu.myDESWIND[1].reload();
}
if (canvas_mcdu.myDESWIND[0] != nil) {
canvas_mcdu.myDESWIND[0].reload();
}
if (canvas_mcdu.myHISTWIND[1] != nil) {
canvas_mcdu.myHISTWIND[1].reload();
}
if (canvas_mcdu.myHISTWIND[0] != nil) {
canvas_mcdu.myHISTWIND[0].reload();
}
}
};

View file

@ -204,6 +204,7 @@ var systemsInit = func {
systems.fire_init();
systems.icingInit();
fmgc.flightPlanController.reset();
fmgc.windController.reset();
fadec.FADEC.init();
fmgc.ITAF.init();
fmgc.FMGCinit();
@ -222,6 +223,7 @@ var systemsInit = func {
fcu.FCUController.init();
dmc.DMController.init();
fmgc.flightPlanController.init();
fmgc.windController.init();
}
setlistener("/sim/signals/fdm-initialized", func {
@ -245,7 +247,7 @@ var systemsLoop = maketimer(0.1, func {
systems.APUController.loop();
systems.HFLoop();
if ((getprop("/controls/pneumatic/switches/groundair") or getprop("/controls/electrical/ground-cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or (getprop("/controls/gear/brake-parking") == 0 and getprop("/services/chocks/nose") == 0 and getprop("/services/chocks/left") == 0 and getprop("/services/chocks/right") == 0))) {
if ((getprop("/controls/pneumatic/switches/groundair") or getprop("/controls/electrical/ground-cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or (getprop("/controls/gear/brake-parking") == 0 and getprop("/services/chocks/enable") == 0))) {
setprop("/controls/electrical/ground-cart", 0);
setprop("/controls/pneumatic/switches/groundair", 0);
}

15
Nasal/MCDU/DATA2.nas Normal file
View file

@ -0,0 +1,15 @@
# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring)
# Copyright (c) 2020 Matthew Maring (mattmaring)
var data2Input = func(key, i) {
if (key == "L5") {
if (canvas_mcdu.myCLBWIND[i] == nil) {
canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
} else {
canvas_mcdu.myCLBWIND[i].reload();
}
fmgc.windController.accessPage[i] = "DATA2";
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
}
}

View file

@ -156,6 +156,7 @@ var fplnItem = {
setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV");
},
pushButtonRight: func() {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 0) {
if (canvas_mcdu.myVertRev[me.computer] != nil) {
canvas_mcdu.myVertRev[me.computer].del();
}
@ -163,26 +164,65 @@ var fplnItem = {
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);
canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
} if (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer);
canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer);
canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan);
} else {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer);
canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer, me.wp, me.plan);
}
} 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);
canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
} elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[2].departure.id) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer);
canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer);
canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan);
} else {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer);
canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer, me.wp, me.plan);
}
}
setprop("MCDU[" ~ me.computer ~ "]/page", "VERTREV");
} elsif (me.index != 0) { # todo - only apply to climb, descent, or missed waypoints
var scratchpadStore = mcdu_scratchpad.scratchpads[me.computer].scratchpad;
if (scratchpadStore == "CLR") {
me.wp.setSpeed("delete");
me.wp.setAltitude("delete");
mcdu_scratchpad.scratchpads[me.computer].empty();
} elsif (find("/", scratchpadStore) != -1) {
var scratchpadSplit = split("/", scratchpadStore);
if (size(scratchpadSplit[0]) == 0) {
if (num(scratchpadSplit[1]) != nil and (size(scratchpadSplit[1]) == 4 or size(scratchpadSplit[1]) == 5) and scratchpadSplit[1] >= 0 and scratchpadSplit[1] <= 39000) {
me.wp.setAltitude(math.round(scratchpadSplit[1], 10), "at");
mcdu_scratchpad.scratchpads[me.computer].empty();
} else {
mcdu_message(me.computer, "FORMAT ERROR");
}
} else {
if (num(scratchpadSplit[0]) != nil and size(scratchpadSplit[0]) == 3 and scratchpadSplit[0] >= 100 and scratchpadSplit[0] <= 350 and
num(scratchpadSplit[1]) != nil and (size(scratchpadSplit[1]) == 4 or size(scratchpadSplit[1]) == 5) and scratchpadSplit[1] >= 0 and scratchpadSplit[1] <= 39000) {
me.wp.setSpeed(scratchpadSplit[0], "at");
me.wp.setAltitude(math.round(scratchpadSplit[1], 10), "at");
mcdu_scratchpad.scratchpads[me.computer].empty();
} elsif (num(scratchpadSplit[0]) != nil and size(scratchpadSplit[0]) == 3 and scratchpadSplit[0] >= 100 and scratchpadSplit[0] <= 350 and size(scratchpadSplit[1]) == 0) {
me.wp.setSpeed(scratchpadSplit[0], "at");
mcdu_scratchpad.scratchpads[me.computer].empty();
} else {
mcdu_message(me.computer, "FORMAT ERROR");
}
}
} elsif (num(scratchpadStore) != nil and size(scratchpadStore) == 3 and scratchpadStore >= 100 and scratchpadStore <= 350) {
me.wp.setSpeed(scratchpadStore, "at");
mcdu_scratchpad.scratchpads[me.computer].empty();
} else {
mcdu_message(me.computer, "FORMAT ERROR");
}
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
},
};
@ -446,11 +486,7 @@ var fplnPage = { # this one is only created once, and then updated - remember th
}
} else {
if (size(me.outputList) >= index) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) > 0) {
mcdu_message(me.computer, "NOT ALLOWED");
} else {
me.outputList[index - 1].pushButtonRight();
}
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}

View file

@ -40,21 +40,42 @@ var holdPage = {
_setupPageWithData: func() {
me.title = ["HOLD", " AT ", me.waypoint.wp_name];
me.titleColour = "wht";
me.L1 = [" [ ]", "INB CRS", "blu"];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["wht", "wht", "ack", "ack", "ack", "ack"]];
me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
if (me.waypoint.fly_type == "Hold") {
me.makeTmpy();
me.L1 = [" " ~ sprintf("%03.0f", me.waypoint.hold_inbound_radial), "INB CRS", "blu"];
me.fontMatrix[0][0] = 0;
if (me.waypoint.hold_is_left_handed) {
me.L2 = [" L", " TURN", "blu"];
} else {
me.L2 = [" R", " TURN", "blu"];
}
if (me.waypoint.hold_is_distance) {
me.L2 = [" -.-/" ~ me.waypoint.hold_time_or_distance, "TIME/DIST", "blu"];
} else {
me.L2 = [" " ~ sprintf("%3.1f", (me.waypoint.hold_time_or_distance / 60)) ~ "/----", "TIME/DIST", "blu"];
}
me.R1 = ["COMPUTED ", nil, "wht"];
me.R2 = ["DATABASE ", nil, "yel"];
me.arrowsMatrix[1][1] = 0;
} else {
me.L1 = [" 100", "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.R1 = ["COMPUTED ", nil, "wht"];
me.R2 = ["DATABASE ", nil, "wht"];
}
me.L6 = [" RETURN", nil, "wht"];
me.C4 = ["LAST EXIT", nil, "wht"];
me.C5 = ["---- ---.-", "UTC FUEL", "wht"];
me.R1 = ["COMPUTED ", nil, "wht"];
me.R2 = ["DATABASE ", nil, "wht"];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["wht", "wht", "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() {
@ -67,7 +88,7 @@ var holdPage = {
me.L1[2] = "yel";
me.L2[2] = "yel";
me.L6 = [" F-PLN", " TMPY", "yel"];
me.R6 = ["INSERT* ", " TMPY", "yel"];
me.R6 = ["INSERT ", " TMPY", "yel"];
me.arrowsColour[0][5] = "yel";
me.titleColour = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);

View file

@ -9,6 +9,7 @@ var initInputA = func(key, i) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/alt-airport", "");
setprop("/FMGC/internal/alt-set", 0);
fmgc.windController.updatePlans();
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
@ -24,6 +25,7 @@ var initInputA = func(key, i) {
if (tfs == 4) {
setprop("/FMGC/internal/alt-airport", scratchpad);
setprop("/FMGC/internal/alt-set", 1);
fmgc.windController.updatePlans();
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
@ -169,7 +171,9 @@ var initInputA = func(key, i) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
fmgc.flightPlanController.reset(2);
fmgc.windController.reset(2);
fmgc.flightPlanController.init();
fmgc.windController.init();
mcdu_scratchpad.scratchpads[i].empty();
#} else if (scratchpad == "") {
#setprop("/FMGC/internal/alt-selected", 0);
@ -222,6 +226,14 @@ var initInputA = func(key, i) {
}
} else if (key == "R3") {
setprop("MCDU[" ~ i ~ "]/page", "IRSINIT");
} else if (key == "R4") {
if (canvas_mcdu.myCLBWIND[i] == nil) {
canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
} else {
canvas_mcdu.myCLBWIND[i].reload();
}
fmgc.windController.accessPage[i] = "INITA";
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
} else if (key == "R5") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/tropo", 36090);

View file

@ -1,5 +1,6 @@
var latRev = {
title: [nil, nil, nil],
titleColour: "wht",
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]],
@ -36,6 +37,7 @@ var latRev = {
_checkTmpy: func() {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.L6 = [" F-PLN", " TMPY", "yel"];
me.titleColour = "yel";
me.arrowsColour[0][5] = "yel";
me.R2[2] = "yel";
me.R3[2] = "yel";

View file

@ -167,6 +167,8 @@ var MCDU_reset = func(i) {
setprop("/FMGC/internal/dest-temp", -999);
setprop("/FMGC/internal/dest-mag", -1);
setprop("/FMGC/internal/dest-wind", -1);
# setprop("/FMGC/internal/dest-mag-grnd", -1);
# setprop("/FMGC/internal/dest-wind-grnd", -1);
setprop("/FMGC/internal/vapp-speed-set", 0);
setprop("/FMGC/internal/final", "");
setprop("/FMGC/internal/baro", 99999);
@ -207,6 +209,12 @@ var lskbutton = func(btn, i) {
initInputIRS("L1",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") {
initInputB("L1",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonLeft(1);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonLeft(1);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
canvas_mcdu.myDESWIND[i].pushButtonLeft(1);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGTO") {
progTOInput("L1",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGCLB") {
@ -250,6 +258,12 @@ var lskbutton = func(btn, i) {
} else if (btn == "2") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") {
initInputA("L2",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonLeft(2);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonLeft(2);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
canvas_mcdu.myDESWIND[i].pushButtonLeft(2);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("L2",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
@ -288,6 +302,12 @@ var lskbutton = func(btn, i) {
initInputB("L3",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") {
fuelPredInput("L3",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonLeft(3);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonLeft(3);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
canvas_mcdu.myDESWIND[i].pushButtonLeft(3);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("L3",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
@ -331,6 +351,12 @@ var lskbutton = func(btn, i) {
initInputB("L4",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") {
fuelPredInput("L4",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonLeft(4);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonLeft(4);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
canvas_mcdu.myDESWIND[i].pushButtonLeft(4);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("L4",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
@ -359,6 +385,12 @@ var lskbutton = func(btn, i) {
initInputB("L5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") {
fuelPredInput("L5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonLeft(5);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonLeft(5);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
canvas_mcdu.myDESWIND[i].pushButtonLeft(5);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("L5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") {
@ -379,12 +411,16 @@ var lskbutton = func(btn, i) {
printInput2("L5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA") {
dataInput("L5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA2") {
data2Input("L5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(5);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
canvas_mcdu.myDeparture[i].depPushbuttonLeft(5);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonLeft(5);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "VERTREV") {
canvas_mcdu.myVertRev[i].pushButtonLeft(5);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].leftFieldBtn(5);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
@ -404,6 +440,21 @@ var lskbutton = func(btn, i) {
fuelPredInput("L6",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "IRSINIT") {
initInputIRS("L6",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonLeft(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonLeft(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
canvas_mcdu.myDESWIND[i].pushButtonLeft(6);
#} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") {
# canvas_mcdu.myHISTWIND[i].pushButtonRight(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") {
if (canvas_mcdu.myCLBWIND[i] == nil) {
canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
} else {
canvas_mcdu.myCLBWIND[i].reload();
}
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ROUTESELECTION") {
initInputROUTESEL("L6",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") {
@ -448,6 +499,15 @@ var rskbutton = func(btn, i) {
initInputIRS("R1",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") {
initInputB("R1",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
if (canvas_mcdu.myHISTWIND[i] == nil) {
canvas_mcdu.myHISTWIND[i] = windHISTPage.new(i);
} else {
canvas_mcdu.myHISTWIND[i].reload();
}
setprop("MCDU[" ~ i ~ "]/page", "WINDHIST");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
canvas_mcdu.myDESWIND[i].pushButtonRight(1);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") {
radnavInput("R1",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") {
@ -533,8 +593,48 @@ var rskbutton = func(btn, i) {
mcdu_message(i, "NOT ALLOWED");
}
} else if (btn == "4") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") {
initInputA("R4",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") {
fuelPredInput("R4",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
if (canvas_mcdu.myCLBWIND[i] == nil) {
canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
} else {
canvas_mcdu.myCLBWIND[i].reload();
}
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
if (fmgc.flightPlanController.temporaryFlag[i]) {
if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[i]) > 0) {
if (canvas_mcdu.myCRZWIND[i] != nil) {
canvas_mcdu.myCRZWIND[i].del();
}
canvas_mcdu.myCRZWIND[i] = nil;
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.flightplans[i].getWP(fmgc.windController.nav_indicies[i][0]), 0);
} else {
if (canvas_mcdu.myCRZWIND[i] == nil) {
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil);
} else {
canvas_mcdu.myCRZWIND[i].reload();
}
}
} else {
if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) {
if (canvas_mcdu.myCRZWIND[i] != nil) {
canvas_mcdu.myCRZWIND[i].del();
}
canvas_mcdu.myCRZWIND[i] = nil;
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.flightplans[2].getWP(fmgc.windController.nav_indicies[2][0]), 0);
} else {
if (canvas_mcdu.myCRZWIND[i] == nil) {
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil);
} else {
canvas_mcdu.myCRZWIND[i].reload();
}
}
}
setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("R4",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
@ -557,6 +657,44 @@ var rskbutton = func(btn, i) {
initInputA("R5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") {
initInputB("R5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
if (fmgc.flightPlanController.temporaryFlag[i]) {
if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[i]) > 0) {
if (canvas_mcdu.myCRZWIND[i] != nil) {
canvas_mcdu.myCRZWIND[i].del();
}
canvas_mcdu.myCRZWIND[i] = nil;
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.flightplans[i].getWP(fmgc.windController.nav_indicies[i][0]), 0);
} else {
if (canvas_mcdu.myCRZWIND[i] == nil) {
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil);
} else {
canvas_mcdu.myCRZWIND[i].reload();
}
}
} else {
if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) {
if (canvas_mcdu.myCRZWIND[i] != nil) {
canvas_mcdu.myCRZWIND[i].del();
}
canvas_mcdu.myCRZWIND[i] = nil;
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.flightplans[2].getWP(fmgc.windController.nav_indicies[2][0]), 0);
} else {
if (canvas_mcdu.myCRZWIND[i] == nil) {
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil);
} else {
canvas_mcdu.myCRZWIND[i].reload();
}
}
}
setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
if (canvas_mcdu.myDESWIND[i] == nil) {
canvas_mcdu.myDESWIND[i] = windDESPage.new(i, "");
} else {
canvas_mcdu.myDESWIND[i].reload();
}
setprop("MCDU[" ~ i ~ "]/page", "WINDDES");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "STATUS") {
statusInput("R5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
@ -601,6 +739,14 @@ var rskbutton = func(btn, i) {
initInputA("R6",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") {
initInputIRS("R6",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonRight(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonRight(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
canvas_mcdu.myDESWIND[i].pushButtonRight(6);
#} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") {
# canvas_mcdu.myHISTWIND[i].pushButtonRight(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("R6",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") {
@ -697,6 +843,8 @@ var arrowbutton = func(btn, i) {
canvas_mcdu.myDirTo[i].scrollUp();
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") {
initInputIRS("up",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonUp();
}
} else if (btn == "down") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
@ -709,6 +857,8 @@ var arrowbutton = func(btn, i) {
canvas_mcdu.myDirTo[i].scrollDn();
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") {
initInputIRS("down",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonDown();
}
}
}

View file

@ -35,12 +35,10 @@ var perfAPPRInput = func(key, i) {
mcdu_scratchpad.scratchpads[i].empty();
} else if (tfs >= 3 and tfs <= 7 and find("/", scratchpad) != -1) {
var weather = split("/", scratchpad);
var mag = int(weather[0]);
var mags = size(weather[0]);
var wind = int(weather[1]);
var winds = size(weather[1]);
if (mags >= 1 and mags <= 3 and winds >= 1 and winds <= 3) {
if (mag != nil and wind != nil and mag >= 0 and mag <= 360 and wind >= 0 and wind <= 200) {
if (num(weather[0]) != nil and num(weather[1]) != nil and int(weather[0]) >= 0 and int(weather[0]) <= 360 and int(weather[1]) >= 0 and int(weather[1]) <= 200) {
setprop("/FMGC/internal/dest-mag", weather[0]);
setprop("/FMGC/internal/dest-wind", weather[1]);
mcdu_scratchpad.scratchpads[i].empty();

View file

@ -20,12 +20,14 @@ var vertRev = {
arrAirport: nil,
index: nil,
computer: nil,
new: func(type, id, index, computer) {
new: func(type, id, index, computer, wp, plan) {
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.wp = wp;
vr.plan = plan;
vr._setupPageWithData();
vr._checkTmpy();
return vr;
@ -53,7 +55,7 @@ var vertRev = {
me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "wht"], ["ack", "wht", "ack", "ack", "wht", "wht"]];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
} if (me.type == 2) {
} elsif (me.type == 2) {
me.title = ["VERT REV", " AT ", me.id];
me.L1 = ["", " EFOB ---.-", "wht"];
me.R1 = ["", "EXTRA ---.- ", "wht"];
@ -132,6 +134,52 @@ var vertRev = {
me.arrowsMatrix[1][4] = 0;
}
},
pushButtonLeft: func(index) {
if (index == 5) {
#print("role: ", me.wp.wp_role, ", type: ", me.wp.wp_type);
if (me.wp.wp_role == "sid") {
if (canvas_mcdu.myCLBWIND[me.computer] == nil) {
canvas_mcdu.myCLBWIND[me.computer] = windCLBPage.new(me.computer);
} else {
canvas_mcdu.myCLBWIND[me.computer].reload();
}
fmgc.windController.accessPage[me.computer] = "VERTREV";
setprop("MCDU[" ~ me.computer ~ "]/page", "WINDCLB");
} else if (me.wp.wp_role == "star" or me.wp.wp_role == "approach" or me.wp.wp_role == "missed") {
if (canvas_mcdu.myDESWIND[me.computer] == nil) {
canvas_mcdu.myDESWIND[me.computer] = windDESPage.new(me.computer);
} else {
canvas_mcdu.myDESWIND[me.computer].reload();
}
fmgc.windController.accessPage[me.computer] = "VERTREV";
setprop("MCDU[" ~ me.computer ~ "]/page", "WINDDES");
} else if (me.wp.wp_role == nil and me.wp.wp_type == "navaid") {
if (canvas_mcdu.myCRZWIND[me.computer] == nil) {
cur_location = 0;
for (i = 0; i < size(fmgc.windController.nav_indicies[me.plan]); i += 1) {
if (fmgc.windController.nav_indicies[me.plan][i] == me.index) {
cur_location = i;
}
}
canvas_mcdu.myCRZWIND[me.computer] = windCRZPage.new(me.computer, me.wp, cur_location);
} else {
canvas_mcdu.myCRZWIND[me.computer].reload();
}
fmgc.windController.accessPage[me.computer] = "VERTREV";
setprop("MCDU[" ~ me.computer ~ "]/page", "WINDCRZ");
} else {
if (canvas_mcdu.myCRZWIND[me.computer] == nil) {
canvas_mcdu.myCRZWIND[me.computer] = windCRZPage.new(me.computer, nil, 0);
} else {
canvas_mcdu.myCRZWIND[me.computer].reload();
}
fmgc.windController.accessPage[me.computer] = "VERTREV";
setprop("MCDU[" ~ me.computer ~ "]/page", "WINDCRZ");
}
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
},
};
setlistener("FMGC/internal/cruise-lvl-set", func() {

313
Nasal/MCDU/WINDCLB.nas Normal file
View file

@ -0,0 +1,313 @@
# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring)
# Copyright (c) 2020 Matthew Maring (mattmaring)
var windCLBPage = {
title: nil,
titleColour: "wht",
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,
items: 0,
new: func(computer) {
var wcp = {parents:[windCLBPage]};
wcp.computer = computer;
wcp._setupPageWithData();
wcp.updateTmpy();
return wcp;
},
del: func() {
return nil;
},
_setupPageWithData: func() {
me.title = "CLIMB WIND";
me.titleColour = "wht";
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["wht", "ack", "ack", "ack", "wht", "ack"]];
me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]];
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#debug.dump(fmgc.windController.clb_winds[0]);
#debug.dump(fmgc.windController.clb_winds[1]);
#debug.dump(fmgc.windController.clb_winds[2]);
if (fmgc.windController.clb_winds[computer_temp] == 0 or fmgc.windController.clb_winds[computer_temp].wind1.altitude == "") {
me.items = 1;
} else if (fmgc.windController.clb_winds[computer_temp].wind2.altitude == "") {
me.items = 2;
} else if (fmgc.windController.clb_winds[computer_temp].wind3.altitude == "") {
me.items = 3;
} else if (fmgc.windController.clb_winds[computer_temp].wind4.altitude == "") {
me.items = 4;
} else {
me.items = 5;
}
if (me.items >= 5) {
var windStore = fmgc.windController.clb_winds[computer_temp].wind5;
if (windStore.altitude != "") {
me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][4] = 1;
} else {
me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][4] = 1;
}
} else {
me.L5 = [nil, nil, "ack"];
}
if (me.items >= 4) {
var windStore = fmgc.windController.clb_winds[computer_temp].wind4;
if (windStore.altitude != "") {
me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][3] = 1;
} else {
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][3] = 1;
}
} else {
me.L4 = [nil, nil, "ack"];
}
if (me.items >= 3) {
var windStore = fmgc.windController.clb_winds[computer_temp].wind3;
if (windStore.altitude != "") {
me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][2] = 1;
} else {
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][2] = 1;
}
} else {
me.L3 = [nil, nil, "ack"];
}
if (me.items >= 2) {
var windStore = fmgc.windController.clb_winds[computer_temp].wind2;
if (windStore.altitude != "") {
me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][1] = 1;
} else {
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][1] = 1;
}
} else {
me.L2 = [nil, nil, "ack"];
}
if (me.items >= 1) {
var windStore = fmgc.windController.clb_winds[computer_temp].wind1;
if (windStore.altitude != "") {
me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
} else {
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
}
}
me.L6 = [" RETURN", nil, "wht"];
me.R1 = [" HISTORY ", "WIND ", "wht"];
me.R3 = [" REQUEST ", "WIND ", "amb"];
me.R5 = [" PHASE ", "NEXT ", "wht"];
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.L1[2] = "yel";
me.L2[2] = "yel";
me.L3[2] = "yel";
me.L4[2] = "yel";
me.L5[2] = "yel";
me.L6 = [" CANCEL", " WIND", "amb"];
me.R6 = ["UPDATE ", "WIND ", "amb"];
me.arrowsMatrix[0][5] = 0;
me.title = "DRAFT CLIMB WIND";
me.titleColour = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else {
me.L1[2] = "blu";
me.L2[2] = "blu";
me.L3[2] = "blu";
me.L4[2] = "blu";
me.L5[2] = "blu";
me.L6 = [" RETURN", nil, "wht"];
me.R6 = [nil, nil, "ack"];
me.arrowsMatrix[0][5] = 1;
me.title = "CLIMB WIND";
me.titleColour = "wht";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}
},
reload: func() {
me._setupPageWithData();
me.updateTmpy();
},
pushButtonLeft: func(index) {
if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
canvas_mcdu.myFpln[me.computer].pushButtonLeft(index);
} else {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
me.reload();
} else if (index == 6) {
setprop("/MCDU[" ~ me.computer ~ "]/page", fmgc.windController.accessPage[me.computer]);
} else if (me.items >= index) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 5 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 13) {
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
size(winds[1]) >= 1 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and
size(winds[2]) >= 4 and size(winds[2]) <= 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or
(num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) {
me.makeTmpy();
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#print(computer_temp);
if (index == 5) {
fmgc.windController.clb_winds[computer_temp].wind5.heading = winds[0];
fmgc.windController.clb_winds[computer_temp].wind5.magnitude = winds[1];
fmgc.windController.clb_winds[computer_temp].wind5.altitude = winds[2];
} else if (index == 4) {
fmgc.windController.clb_winds[computer_temp].wind4.heading = winds[0];
fmgc.windController.clb_winds[computer_temp].wind4.magnitude = winds[1];
fmgc.windController.clb_winds[computer_temp].wind4.altitude = winds[2];
} else if (index == 3) {
fmgc.windController.clb_winds[computer_temp].wind3.heading = winds[0];
fmgc.windController.clb_winds[computer_temp].wind3.magnitude = winds[1];
fmgc.windController.clb_winds[computer_temp].wind3.altitude = winds[2];
} else if (index == 2) {
fmgc.windController.clb_winds[computer_temp].wind2.heading = winds[0];
fmgc.windController.clb_winds[computer_temp].wind2.magnitude = winds[1];
fmgc.windController.clb_winds[computer_temp].wind2.altitude = winds[2];
} else if (index == 1) {
fmgc.windController.clb_winds[computer_temp].wind1.heading = winds[0];
fmgc.windController.clb_winds[computer_temp].wind1.magnitude = winds[1];
fmgc.windController.clb_winds[computer_temp].wind1.altitude = winds[2];
}
mcdu_scratchpad.scratchpads[me.computer].empty();
if (me.items == index and index != 5) {
me.items += 1;
}
me._setupPageWithData();
me.updateTmpy();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} else if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") {
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
if (me.items == index) {
if (index == 5) {
fmgc.windController.clb_winds[computer_temp].wind5.heading = 0;
fmgc.windController.clb_winds[computer_temp].wind5.magnitude = 0;
fmgc.windController.clb_winds[computer_temp].wind5.altitude = "";
} else if (index == 4) {
fmgc.windController.clb_winds[computer_temp].wind4.heading = 0;
fmgc.windController.clb_winds[computer_temp].wind4.magnitude = 0;
fmgc.windController.clb_winds[computer_temp].wind4.altitude = "";
} else if (index == 3) {
fmgc.windController.clb_winds[computer_temp].wind3.heading = 0;
fmgc.windController.clb_winds[computer_temp].wind3.magnitude = 0;
fmgc.windController.clb_winds[computer_temp].wind3.altitude = "";
} else if (index == 2) {
fmgc.windController.clb_winds[computer_temp].wind2.heading = 0;
fmgc.windController.clb_winds[computer_temp].wind2.magnitude = 0;
fmgc.windController.clb_winds[computer_temp].wind2.altitude = "";
} else if (index == 1) {
fmgc.windController.clb_winds[computer_temp].wind1.heading = 0;
fmgc.windController.clb_winds[computer_temp].wind1.magnitude = 0;
fmgc.windController.clb_winds[computer_temp].wind1.altitude = "";
}
} else {
if (index <= 1) {
fmgc.windController.clb_winds[computer_temp].wind1.heading = fmgc.windController.clb_winds[computer_temp].wind2.heading;
fmgc.windController.clb_winds[computer_temp].wind1.magnitude = fmgc.windController.clb_winds[computer_temp].wind2.magnitude;
fmgc.windController.clb_winds[computer_temp].wind1.altitude = fmgc.windController.clb_winds[computer_temp].wind2.altitude;
}
if (index <= 2) {
fmgc.windController.clb_winds[computer_temp].wind2.heading = fmgc.windController.clb_winds[computer_temp].wind3.heading;
fmgc.windController.clb_winds[computer_temp].wind2.magnitude = fmgc.windController.clb_winds[computer_temp].wind3.magnitude;
fmgc.windController.clb_winds[computer_temp].wind2.altitude = fmgc.windController.clb_winds[computer_temp].wind3.altitude;
}
if (index <= 3) {
fmgc.windController.clb_winds[computer_temp].wind3.heading = fmgc.windController.clb_winds[computer_temp].wind4.heading;
fmgc.windController.clb_winds[computer_temp].wind3.magnitude = fmgc.windController.clb_winds[computer_temp].wind4.magnitude;
fmgc.windController.clb_winds[computer_temp].wind3.altitude = fmgc.windController.clb_winds[computer_temp].wind4.altitude;
}
if (index <= 4) {
fmgc.windController.clb_winds[computer_temp].wind4.heading = fmgc.windController.clb_winds[computer_temp].wind5.heading;
fmgc.windController.clb_winds[computer_temp].wind4.magnitude = fmgc.windController.clb_winds[computer_temp].wind5.magnitude;
fmgc.windController.clb_winds[computer_temp].wind4.altitude = fmgc.windController.clb_winds[computer_temp].wind5.altitude;
}
}
mcdu_scratchpad.scratchpads[me.computer].empty();
me.items -= 1;
me._setupPageWithData();
me.updateTmpy();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
},
pushButtonRight: func(index) {
if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
canvas_mcdu.myFpln[me.computer].pushButtonRight(index);
} else {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
me.reload();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
}
};

521
Nasal/MCDU/WINDCRZ.nas Normal file
View file

@ -0,0 +1,521 @@
# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring)
# Copyright (c) 2020 Matthew Maring (mattmaring)
var windCRZPage = {
title: [nil, nil, nil],
titleColour: "wht",
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,
cur_location: 0,
match_location: 0,
items: 0,
singleCRZ: 0,
new: func(computer, waypoint, cur_location) {
var wcp = {parents:[windCRZPage]};
wcp.computer = computer;
wcp.waypoint = waypoint;
wcp.cur_location = cur_location;
if (waypoint == nil) {
wcp.singleCRZ = 1;
}
wcp._setupPageWithData();
wcp.updateTmpy();
return wcp;
},
del: func() {
return nil;
},
_setupPageWithData: func() {
if (me.singleCRZ == 1) {
me.title = ["","CRZ WIND",""];
} else {
me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name];
}
me.titleColour = "wht";
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "wht", "ack"]];
me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]];
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#debug.dump(fmgc.windController.crz_winds[0]);
#debug.dump(fmgc.windController.crz_winds[1]);
#debug.dump(fmgc.windController.crz_winds[2]);
if (me.singleCRZ == 1) {
if (fmgc.windController.crz_winds[computer_temp] == 0 or fmgc.windController.crz_winds[computer_temp].wind1.altitude == "") {
me.items = 1;
} else if (fmgc.windController.crz_winds[computer_temp].wind2.altitude == "") {
me.items = 2;
} else if (fmgc.windController.crz_winds[computer_temp].wind3.altitude == "") {
me.items = 3;
} else {
me.items = 4;
}
} else {
me.match_location = fmgc.windController.nav_indicies[computer_temp][me.cur_location];
if (size(fmgc.windController.winds[computer_temp]) == 0 or fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude == "") {
me.items = 1;
} else if (fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude == "") {
me.items = 2;
} else if (fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude == "") {
me.items = 3;
} else {
me.items = 4;
}
}
# load data
if (me.singleCRZ == 1) {
if (me.items >= 4) {
var windStore = fmgc.windController.crz_winds[computer_temp].wind4;
if (windStore.altitude != "") {
me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][3] = 1;
} else {
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][3] = 1;
}
} else {
me.L4 = [nil, nil, "ack"];
}
if (me.items >= 3) {
var windStore = fmgc.windController.crz_winds[computer_temp].wind3;
if (windStore.altitude != "") {
me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][2] = 1;
} else {
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][2] = 1;
}
} else {
me.L3 = [nil, nil, "ack"];
}
if (me.items >= 2) {
var windStore = fmgc.windController.crz_winds[computer_temp].wind2;
if (windStore.altitude != "") {
me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][1] = 1;
} else {
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][1] = 1;
}
} else {
me.L2 = [nil, nil, "ack"];
}
if (me.items >= 1) {
var windStore = fmgc.windController.crz_winds[computer_temp].wind1;
if (windStore.altitude != "") {
me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
} else {
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
}
}
var windStore = fmgc.windController.crz_winds[computer_temp].sat1;
if (windStore.altitude != "") {
me.L5 = [windStore.temp ~ "/" ~ windStore.altitude, "SAT / ALT", "blu"];
me.fontMatrix[0][4] = 1;
} else {
me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"];
me.fontMatrix[0][4] = 1;
}
} else {
if (me.items >= 4) {
var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind4;
if (windStore.altitude != "") {
me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][3] = 1;
} else {
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][3] = 1;
}
} else {
me.L4 = [nil, nil, "ack"];
}
if (me.items >= 3) {
var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind3;
if (windStore.altitude != "") {
me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][2] = 1;
} else {
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][2] = 1;
}
} else {
me.L3 = [nil, nil, "ack"];
}
if (me.items >= 2) {
var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind2;
if (windStore.altitude != "") {
me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][1] = 1;
} else {
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][1] = 1;
}
} else {
me.L2 = [nil, nil, "ack"];
}
if (me.items >= 1) {
var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind1;
if (windStore.altitude != "") {
me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
} else {
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
}
}
var windStore = fmgc.windController.winds[computer_temp][me.match_location].sat1;
if (windStore.altitude != "") {
me.L5 = [windStore.temp ~ "/" ~ windStore.altitude, "SAT / ALT", "blu"];
me.fontMatrix[0][4] = 1;
} else {
me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"];
me.fontMatrix[0][4] = 1;
}
}
me.L6 = [" RETURN", nil, "wht"];
me.R2 = [" REQUEST ", "WIND ", "amb"];
me.R4 = [" PHASE ", "PREV ", "wht"];
me.R5 = [" PHASE ", "NEXT ", "wht"];
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.L1[2] = "yel";
me.L2[2] = "yel";
me.L3[2] = "yel";
me.L4[2] = "yel";
me.L5[2] = "yel";
me.L6 = [" CANCEL", "UPDATE", "amb"];
me.R6 = ["INSERT ", "UPDATE ", "amb"];
me.arrowsMatrix[0][5] = 0;
if (me.singleCRZ == 1) {
me.title = ["","DRAFT CRZ WIND",""];
} else {
me.title = ["DRAFT CRZ WIND", " AT ", me.waypoint.wp_name];
}
me.titleColour = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else {
me.L1[2] = "blu";
me.L2[2] = "blu";
me.L3[2] = "blu";
me.L4[2] = "blu";
me.L5[2] = "blu";
me.L6 = [" RETURN", nil, "wht"];
me.R6 = [nil, nil, "ack"];
me.arrowsMatrix[0][5] = 1;
if (me.singleCRZ == 1) {
me.title = ["","CRZ WIND",""];
} else {
me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name];
}
me.titleColour = "wht";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}
},
reload: func() {
me._setupPageWithData();
me.updateTmpy();
},
pushButtonLeft: func(index) {
if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
canvas_mcdu.myFpln[me.computer].pushButtonLeft(index);
} else {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
me.reload();
} else if (index == 6) {
setprop("/MCDU[" ~ me.computer ~ "]/page", fmgc.windController.accessPage[me.computer]);
} else if (index == 5) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 6 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 9) {
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= -99 and winds[0] <= 99 and
size(winds[1]) >= 4 and size(winds[1]) <= 5 and ((num(winds[1]) != nil and winds[1] >= 1000 and winds[1] <= 39000) or
(num(split("FL", winds[1])[1]) != nil and split("FL", winds[1])[1] >= 10 and split("FL", winds[1])[1] <= 390))) {
me.makeTmpy();
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#print(computer_temp);
if (me.singleCRZ == 1) {
fmgc.windController.crz_winds[computer_temp].sat1.temp = winds[0];
fmgc.windController.crz_winds[computer_temp].sat1.altitude = winds[1];
} else {
fmgc.windController.winds[computer_temp][me.match_location].sat1.temp = winds[0];
fmgc.windController.winds[computer_temp][me.match_location].sat1.altitude = winds[1];
}
mcdu_scratchpad.scratchpads[me.computer].empty();
me._setupPageWithData();
me.updateTmpy();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} else if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") {
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#print(computer_temp);
if (me.singleCRZ == 1) {
fmgc.windController.crz_winds[computer_temp].sat1.temp = 0;
fmgc.windController.crz_winds[computer_temp].sat1.altitude = "";
} else {
fmgc.windController.winds[computer_temp][me.match_location].sat1.temp = 0;
fmgc.windController.winds[computer_temp][me.match_location].sat1.altitude = "";
}
mcdu_scratchpad.scratchpads[me.computer].empty();
me._setupPageWithData();
me.updateTmpy();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} else if (me.items >= index) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 5 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 13) {
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
size(winds[1]) >= 1 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and
size(winds[2]) >= 4 and size(winds[2]) <= 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or
(num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) {
me.makeTmpy();
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#print(computer_temp);
if (me.singleCRZ == 1) {
if (index == 4) {
fmgc.windController.crz_winds[computer_temp].wind4.heading = winds[0];
fmgc.windController.crz_winds[computer_temp].wind4.magnitude = winds[1];
fmgc.windController.crz_winds[computer_temp].wind4.altitude = winds[2];
} else if (index == 3) {
fmgc.windController.crz_winds[computer_temp].wind3.heading = winds[0];
fmgc.windController.crz_winds[computer_temp].wind3.magnitude = winds[1];
fmgc.windController.crz_winds[computer_temp].wind3.altitude = winds[2];
} else if (index == 2) {
fmgc.windController.crz_winds[computer_temp].wind2.heading = winds[0];
fmgc.windController.crz_winds[computer_temp].wind2.magnitude = winds[1];
fmgc.windController.crz_winds[computer_temp].wind2.altitude = winds[2];
} else if (index == 1) {
fmgc.windController.crz_winds[computer_temp].wind1.heading = winds[0];
fmgc.windController.crz_winds[computer_temp].wind1.magnitude = winds[1];
fmgc.windController.crz_winds[computer_temp].wind1.altitude = winds[2];
}
} else {
if (index == 4) {
fmgc.windController.winds[computer_temp][me.match_location].wind4.heading = winds[0];
fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude = winds[1];
fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude = winds[2];
} else if (index == 3) {
fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = winds[0];
fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = winds[1];
fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude = winds[2];
} else if (index == 2) {
fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = winds[0];
fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = winds[1];
fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude = winds[2];
} else if (index == 1) {
fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = winds[0];
fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = winds[1];
fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude = winds[2];
}
}
mcdu_scratchpad.scratchpads[me.computer].empty();
if (me.items == index and index != 4) {
me.items += 1;
}
me._setupPageWithData();
me.updateTmpy();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} else if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") {
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#print(computer_temp);
if (me.singleCRZ == 1) {
if (me.items == index) {
if (index == 4) {
fmgc.windController.crz_winds[computer_temp].wind4.heading = 0;
fmgc.windController.crz_winds[computer_temp].wind4.magnitude = 0;
fmgc.windController.crz_winds[computer_temp].wind4.altitude = "";
} else if (index == 3) {
fmgc.windController.crz_winds[computer_temp].wind3.heading = 0;
fmgc.windController.crz_winds[computer_temp].wind3.magnitude = 0;
fmgc.windController.crz_winds[computer_temp].wind3.altitude = "";
} else if (index == 2) {
fmgc.windController.crz_winds[computer_temp].wind2.heading = 0;
fmgc.windController.crz_winds[computer_temp].wind2.magnitude = 0;
fmgc.windController.crz_winds[computer_temp].wind2.altitude = "";
} else if (index == 1) {
fmgc.windController.crz_winds[computer_temp].wind1.heading = 0;
fmgc.windController.crz_winds[computer_temp].wind1.magnitude = 0;
fmgc.windController.crz_winds[computer_temp].wind1.altitude = "";
}
} else {
if (index <= 1) {
fmgc.windController.crz_winds[computer_temp].wind1.heading = fmgc.windController.crz_winds[computer_temp].wind2.heading;
fmgc.windController.crz_winds[computer_temp].wind1.magnitude = fmgc.windController.crz_winds[computer_temp].wind2.magnitude;
fmgc.windController.crz_winds[computer_temp].wind1.altitude = fmgc.windController.crz_winds[computer_temp].wind2.altitude;
}
if (index <= 2) {
fmgc.windController.crz_winds[computer_temp].wind2.heading = fmgc.windController.crz_winds[computer_temp].wind3.heading;
fmgc.windController.crz_winds[computer_temp].wind2.magnitude = fmgc.windController.crz_winds[computer_temp].wind3.magnitude;
fmgc.windController.crz_winds[computer_temp].wind2.altitude = fmgc.windController.crz_winds[computer_temp].wind3.altitude;
}
if (index <= 3) {
fmgc.windController.crz_winds[computer_temp].wind3.heading = fmgc.windController.crz_winds[computer_temp].wind4.heading;
fmgc.windController.crz_winds[computer_temp].wind3.magnitude = fmgc.windController.crz_winds[computer_temp].wind4.magnitude;
fmgc.windController.crz_winds[computer_temp].wind3.altitude = fmgc.windController.crz_winds[computer_temp].wind4.altitude;
}
}
} else {
if (me.items == index) {
if (index == 4) {
fmgc.windController.winds[computer_temp][me.match_location].wind4.heading = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude = "";
} else if (index == 3) {
fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude = "";
} else if (index == 2) {
fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude = "";
} else if (index == 1) {
fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude = "";
}
} else {
if (index <= 1) {
fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = fmgc.windController.winds[computer_temp][me.match_location].wind2.heading;
fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude;
fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude = fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude;
}
if (index <= 2) {
fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = fmgc.windController.winds[computer_temp][me.match_location].wind3.heading;
fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude;
fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude = fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude;
}
if (index <= 3) {
fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = fmgc.windController.winds[computer_temp][me.match_location].wind4.heading;
fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude;
fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude = fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude;
}
}
}
mcdu_scratchpad.scratchpads[me.computer].empty();
me.items -= 1;
me._setupPageWithData();
me.updateTmpy();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
},
pushButtonRight: func(index) {
if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
canvas_mcdu.myFpln[me.computer].pushButtonRight(index);
} else {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
me.reload();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
},
pushButtonUp: func() {
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
if (me.cur_location < size(fmgc.windController.nav_indicies[computer_temp]) - 1) {
me.cur_location = me.cur_location + 1;
} else {
me.cur_location = 0;
}
me.match_location = fmgc.windController.nav_indicies[computer_temp][me.cur_location];
me.waypoint = fmgc.flightPlanController.flightplans[computer_temp].getWP(me.match_location);
me.reload();
},
pushButtonDown: func() {
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
if (me.cur_location > 0) {
me.cur_location = me.cur_location - 1;
} else {
me.cur_location = size(fmgc.windController.nav_indicies[computer_temp]) - 1;
}
me.match_location = fmgc.windController.nav_indicies[computer_temp][me.cur_location];
me.waypoint = fmgc.flightPlanController.flightplans[computer_temp].getWP(me.match_location);
me.reload();
}
};

365
Nasal/MCDU/WINDDES.nas Normal file
View file

@ -0,0 +1,365 @@
# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring)
# Copyright (c) 2020 Matthew Maring (mattmaring)
var windDESPage = {
title: nil,
titleColour: "wht",
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,
items: 0,
new: func(computer) {
var wdp = {parents:[windDESPage]};
wdp.computer = computer;
wdp._setupPageWithData();
wdp.updateTmpy();
return wdp;
},
del: func() {
return nil;
},
_setupPageWithData: func() {
me.title = "DES WIND";
#me.title = ["DES WIND", " AT ", me.waypoint.wp_name];
me.titleColour = "wht";
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "ack", "ack"]];
me.fontMatrix = [[1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0]];
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
# debug.dump(fmgc.windController.des_winds[0]);
# debug.dump(fmgc.windController.des_winds[1]);
# debug.dump(fmgc.windController.des_winds[2]);
if (fmgc.windController.des_winds[computer_temp] == 0 or fmgc.windController.des_winds[computer_temp].wind1.altitude == "") {
me.items = 1;
} else if (fmgc.windController.des_winds[computer_temp].wind2.altitude == "") {
me.items = 2;
} else if (fmgc.windController.des_winds[computer_temp].wind3.altitude == "") {
me.items = 3;
} else if (fmgc.windController.des_winds[computer_temp].wind4.altitude == "") {
me.items = 4;
} else {
me.items = 5;
}
if (me.items >= 5) {
var windStore = fmgc.windController.des_winds[computer_temp].wind5;
if (windStore.altitude != "") {
me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][4] = 1;
} else {
me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][4] = 1;
}
} else {
me.L5 = [nil, nil, "ack"];
}
if (me.items >= 4) {
var windStore = fmgc.windController.des_winds[computer_temp].wind4;
if (windStore.altitude != "") {
me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][3] = 1;
} else {
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][3] = 1;
}
} else {
me.L4 = [nil, nil, "ack"];
}
if (me.items >= 3) {
var windStore = fmgc.windController.des_winds[computer_temp].wind3;
if (windStore.altitude != "") {
me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][2] = 1;
} else {
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][2] = 1;
}
} else {
me.L3 = [nil, nil, "ack"];
}
if (me.items >= 2) {
var windStore = fmgc.windController.des_winds[computer_temp].wind2;
if (windStore.altitude != "") {
me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][1] = 1;
} else {
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][1] = 1;
}
} else {
me.L2 = [nil, nil, "ack"];
}
if (me.items >= 1) {
var windStore = fmgc.windController.des_winds[computer_temp].wind1;
if (windStore.altitude != "") {
me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
} else {
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
}
}
me.L6 = [" RETURN", nil, "wht"];
if (getprop("/FMGC/internal/alt-set")) {
var windStore = fmgc.windController.des_winds[computer_temp].alt1;
if (windStore.heading != 0 and windStore.magnitude != 0) {
me.R1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude), "ALTN WIND ", "blu"];
me.fontMatrix[1][0] = 1;
} else {
me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"];
me.fontMatrix[1][0] = 1;
}
} else {
me.R1 = ["", "", "blu"];
}
me.R3 = [" REQUEST ", "WIND ", "amb"];
me.R4 = [" PHASE ", "PREV ", "wht"];
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.L1[2] = "yel";
me.L2[2] = "yel";
me.L3[2] = "yel";
me.L4[2] = "yel";
me.L5[2] = "yel";
me.R1[2] = "yel";
me.L6 = [" CANCEL", " WIND", "amb"];
me.R6 = ["UPDATE ", "WIND ", "amb"];
me.arrowsMatrix[0][5] = 0;
me.title = "DRAFT DES WIND";
me.titleColour = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else {
me.L1[2] = "blu";
me.L2[2] = "blu";
me.L3[2] = "blu";
me.L4[2] = "blu";
me.L5[2] = "blu";
me.R1[2] = "blu";
me.L6 = [" RETURN", nil, "wht"];
me.R6 = [nil, nil, "ack"];
me.arrowsMatrix[0][5] = 1;
me.title = "DES WIND";
me.titleColour = "wht";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}
},
reload: func() {
me._setupPageWithData();
me.updateTmpy();
},
pushButtonLeft: func(index) {
if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
canvas_mcdu.myFpln[me.computer].pushButtonLeft(index);
} else {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
me.reload();
} else if (index == 6) {
setprop("/MCDU[" ~ me.computer ~ "]/page", fmgc.windController.accessPage[me.computer]);
} else if (me.items >= index) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 5 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 13) {
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
if (size(winds[0]) >= 0 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
size(winds[1]) >= 0 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and
size(winds[2]) >= 4 and size(winds[2]) <= 5 and (winds[2] == "GRND" or (num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or
(num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) {
me.makeTmpy();
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
# if (winds[2] == "GRND") {
# setprop("/FMGC/internal/dest-mag-grnd", winds[0]);
# setprop("/FMGC/internal/dest-wind-grnd", winds[1]);
# }
#print(computer_temp);
if (index == 5) {
fmgc.windController.des_winds[computer_temp].wind5.heading = winds[0];
fmgc.windController.des_winds[computer_temp].wind5.magnitude = winds[1];
fmgc.windController.des_winds[computer_temp].wind5.altitude = winds[2];
} else if (index == 4) {
fmgc.windController.des_winds[computer_temp].wind4.heading = winds[0];
fmgc.windController.des_winds[computer_temp].wind4.magnitude = winds[1];
fmgc.windController.des_winds[computer_temp].wind4.altitude = winds[2];
} else if (index == 3) {
fmgc.windController.des_winds[computer_temp].wind3.heading = winds[0];
fmgc.windController.des_winds[computer_temp].wind3.magnitude = winds[1];
fmgc.windController.des_winds[computer_temp].wind3.altitude = winds[2];
} else if (index == 2) {
fmgc.windController.des_winds[computer_temp].wind2.heading = winds[0];
fmgc.windController.des_winds[computer_temp].wind2.magnitude = winds[1];
fmgc.windController.des_winds[computer_temp].wind2.altitude = winds[2];
} else if (index == 1) {
fmgc.windController.des_winds[computer_temp].wind1.heading = winds[0];
fmgc.windController.des_winds[computer_temp].wind1.magnitude = winds[1];
fmgc.windController.des_winds[computer_temp].wind1.altitude = winds[2];
}
mcdu_scratchpad.scratchpads[me.computer].empty();
if (me.items == index and index != 5) {
me.items += 1;
}
me._setupPageWithData();
me.updateTmpy();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} else if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") {
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
if (me.items == index) {
if (index == 5) {
fmgc.windController.des_winds[computer_temp].wind5.heading = 0;
fmgc.windController.des_winds[computer_temp].wind5.magnitude = 0;
fmgc.windController.des_winds[computer_temp].wind5.altitude = "";
} else if (index == 4) {
fmgc.windController.des_winds[computer_temp].wind4.heading = 0;
fmgc.windController.des_winds[computer_temp].wind4.magnitude = 0;
fmgc.windController.des_winds[computer_temp].wind4.altitude = "";
} else if (index == 3) {
fmgc.windController.des_winds[computer_temp].wind3.heading = 0;
fmgc.windController.des_winds[computer_temp].wind3.magnitude = 0;
fmgc.windController.des_winds[computer_temp].wind3.altitude = "";
} else if (index == 2) {
fmgc.windController.des_winds[computer_temp].wind2.heading = 0;
fmgc.windController.des_winds[computer_temp].wind2.magnitude = 0;
fmgc.windController.des_winds[computer_temp].wind2.altitude = "";
} else if (index == 1) {
fmgc.windController.des_winds[computer_temp].wind1.heading = 0;
fmgc.windController.des_winds[computer_temp].wind1.magnitude = 0;
fmgc.windController.des_winds[computer_temp].wind1.altitude = "";
}
} else {
if (index <= 1) {
fmgc.windController.des_winds[computer_temp].wind1.heading = fmgc.windController.des_winds[computer_temp].wind2.heading;
fmgc.windController.des_winds[computer_temp].wind1.magnitude = fmgc.windController.des_winds[computer_temp].wind2.magnitude;
fmgc.windController.des_winds[computer_temp].wind1.altitude = fmgc.windController.des_winds[computer_temp].wind2.altitude;
}
if (index <= 2) {
fmgc.windController.des_winds[computer_temp].wind2.heading = fmgc.windController.des_winds[computer_temp].wind3.heading;
fmgc.windController.des_winds[computer_temp].wind2.magnitude = fmgc.windController.des_winds[computer_temp].wind3.magnitude;
fmgc.windController.des_winds[computer_temp].wind2.altitude = fmgc.windController.des_winds[computer_temp].wind3.altitude;
}
if (index <= 3) {
fmgc.windController.des_winds[computer_temp].wind3.heading = fmgc.windController.des_winds[computer_temp].wind4.heading;
fmgc.windController.des_winds[computer_temp].wind3.magnitude = fmgc.windController.des_winds[computer_temp].wind4.magnitude;
fmgc.windController.des_winds[computer_temp].wind3.altitude = fmgc.windController.des_winds[computer_temp].wind4.altitude;
}
if (index <= 4) {
fmgc.windController.des_winds[computer_temp].wind4.heading = fmgc.windController.des_winds[computer_temp].wind5.heading;
fmgc.windController.des_winds[computer_temp].wind4.magnitude = fmgc.windController.des_winds[computer_temp].wind5.magnitude;
fmgc.windController.des_winds[computer_temp].wind4.altitude = fmgc.windController.des_winds[computer_temp].wind5.altitude;
}
}
mcdu_scratchpad.scratchpads[me.computer].empty();
me.items -= 1;
me._setupPageWithData();
me.updateTmpy();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
},
pushButtonRight: func(index) {
if (index == 1 and getprop("/FMGC/internal/alt-set")) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 3 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 7) {
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
size(winds[1]) >= 1 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200) {
me.makeTmpy();
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#print(computer_temp);
fmgc.windController.des_winds[computer_temp].alt1.heading = winds[0];
fmgc.windController.des_winds[computer_temp].alt1.magnitude = winds[1];
mcdu_scratchpad.scratchpads[me.computer].empty();
me._setupPageWithData();
me.updateTmpy();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} else if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") {
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
fmgc.windController.des_winds[computer_temp].alt1.heading = 0;
fmgc.windController.des_winds[computer_temp].alt1.magnitude = 0;
mcdu_scratchpad.scratchpads[me.computer].empty();
me._setupPageWithData();
me.updateTmpy();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} else if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
canvas_mcdu.myFpln[me.computer].pushButtonRight(index);
} else {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
me.reload();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
}
};

99
Nasal/MCDU/WINDHIST.nas Normal file
View file

@ -0,0 +1,99 @@
# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring)
# Copyright (c) 2020 Matthew Maring (mattmaring)
var windHISTPage = {
title: nil,
fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
L1: [nil, nil, "ack"], # content, title, colour
L2: [nil, nil, "ack"],
L3: [nil, nil, "ack"],
L4: [nil, nil, "ack"],
L5: [nil, nil, "ack"],
L6: [nil, nil, "ack"],
C1: [nil, nil, "ack"],
C2: [nil, nil, "ack"],
C3: [nil, nil, "ack"],
C4: [nil, nil, "ack"],
C5: [nil, nil, "ack"],
C6: [nil, nil, "ack"],
R1: [nil, nil, "ack"],
R2: [nil, nil, "ack"],
R3: [nil, nil, "ack"],
R4: [nil, nil, "ack"],
R5: [nil, nil, "ack"],
R6: [nil, nil, "ack"],
scroll: 0,
vector: [],
index: nil,
computer: nil,
new: func(computer) {
var whp = {parents:[windHISTPage]};
whp.computer = computer;
whp._setupPageWithData();
whp.updateTmpy();
return whp;
},
del: func() {
return nil;
},
_setupPageWithData: func() {
me.title = "HISTORY WIND";
me.titleColour = "wht";
me.L1 = ["----/---", "", "blu"];
me.L2 = ["----/---", "", "blu"];
me.L3 = ["----/---", "", "blu"];
me.L4 = ["----/---", "", "blu"];
me.L5 = ["----/---", "", "blu"];
me.L6 = [" CLIMB WIND", "", "wht"];
me.C1 = ["FL050", "", "blu"];
me.C2 = ["FL150", "", "blu"];
me.C3 = ["FL250", "", "blu"];
me.C4 = [" FL--- CRZ FL", "", "blu"];
me.C5 = ["FL370", "", "blu"];
me.R6 = ["SELECT ", "", "amb"];
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 = [[1, 1, 1, 1, 1, 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.L1[2] = "yel";
me.L2[2] = "yel";
me.L3[2] = "yel";
me.L4[2] = "yel";
me.L5[2] = "yel";
me.C1[2] = "yel";
me.C2[2] = "yel";
me.C3[2] = "yel";
me.C4[2] = "yel";
me.C5[2] = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else {
me.L1[2] = "blu";
me.L2[2] = "blu";
me.L3[2] = "blu";
me.L4[2] = "blu";
me.L5[2] = "blu";
me.C1[2] = "blu";
me.C2[2] = "blu";
me.C3[2] = "blu";
me.C4[2] = "blu";
me.C5[2] = "blu";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}
},
reload: func() {
me._setupPageWithData();
me.updateTmpy();
}
};

View file

@ -169,7 +169,7 @@ var BrakeSystem =
var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel;
LThermalEnergy += (Mass * getprop("gear/gear[1]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2);
if (getprop("services/chocks/left")) {
if (getprop("services/chocks/enable")) {
if (!getprop("controls/gear/brake-parking")) {
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
@ -202,7 +202,7 @@ var BrakeSystem =
};
RThermalEnergy += (Mass * getprop("gear/gear[2]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2);
if (getprop("services/chocks/right")) {
if (getprop("services/chocks/enable")) {
if (!getprop("controls/gear/brake-parking")) {
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);

View file

@ -20,9 +20,7 @@ var ground_services = {
# Set them all to 0 if the aircraft is not stationary
if (getprop("velocities/groundspeed-kt") >= 2) {
setprop("services/chocks/nose", 0);
setprop("services/chocks/left", 0);
setprop("services/chocks/right", 0);
setprop("services/chocks/enable", 0);
setprop("services/fuel-truck/enable", 0);
setprop("services/deicing_truck/enable", 0);
setprop("services/catering/enable", 0);

View file

@ -930,16 +930,10 @@
<c1>20</c1>
</lag_filter>
<pure_gain name="/services/chocks/nose-half">
<input>/services/chocks/nose</input>
<gain>0.5</gain>
</pure_gain>
<summer name="fcs/left-brake-summer">
<input>/controls/gear/brake-left</input>
<input>/controls/gear/brake-parking</input>
<input>/services/chocks/nose-half</input>
<input>/services/chocks/left</input>
<input>/services/chocks/enable</input>
<clipto>
<min>0</min>
<max>1</max>
@ -957,8 +951,7 @@
<summer name="fcs/right-brake-summer">
<input>/controls/gear/brake-right</input>
<input>/controls/gear/brake-parking</input>
<input>/services/chocks/nose-half</input>
<input>/services/chocks/right</input>
<input>/services/chocks/enable</input>
<clipto>
<min>0</min>
<max>1</max>