Merge branch 'dev' into 3D
This commit is contained in:
commit
aeb6aaa819
12 changed files with 996 additions and 552 deletions
|
@ -653,6 +653,7 @@
|
|||
<active-fmgc-channel type="int">0</active-fmgc-channel>
|
||||
<internal>
|
||||
<cost-index type="int">0</cost-index>
|
||||
<to-state type="bool">0</to-state>
|
||||
</internal>
|
||||
</FMGC>
|
||||
|
||||
|
@ -4271,6 +4272,7 @@
|
|||
<file>Aircraft/A320-family/Nasal/MCDU/ARRIVAL.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/AIRWAYS.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/CLOSESTAIRPORT.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/RECEIVEDMESSAGES.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/HOLD.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/F-PLN.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2986,4 +2986,34 @@
|
|||
d="m 974.36752,294.79468 20.17349,-20.1735"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
<g
|
||||
transform="matrix(1.0807111,0,0,1.0807111,-76.462145,331.52578)"
|
||||
inkscape:label="#g4324"
|
||||
id="WEATHERREQSEND"
|
||||
style="stroke:#179ab7;stroke-opacity:1">
|
||||
<path
|
||||
style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 998.71909,284.70793 H 970.18944"
|
||||
id="path1181"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path1183"
|
||||
d="m 994.54102,294.79468 -20.17351,-20.1735"
|
||||
style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 984.45427,298.97275 -10e-6,-28.52964"
|
||||
id="path1185"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path1187"
|
||||
d="m 974.36752,294.79468 20.17349,-20.1735"
|
||||
style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 157 KiB |
|
@ -2426,6 +2426,7 @@ var messages_right_memo = func {
|
|||
} else {
|
||||
vhf3_voice.active = 0;
|
||||
}
|
||||
|
||||
if (getprop("controls/autobrake/mode") == 1 and (phaseVarMemo3 == 7 or phaseVarMemo3 == 8)) {
|
||||
auto_brk_lo.active = 1;
|
||||
} else {
|
||||
|
|
|
@ -887,6 +887,8 @@ var reset_FMGC = func {
|
|||
setprop("systems/ventilation/lavatory/extractvalve", "0");
|
||||
setprop("systems/pressurization/ambientpsi", "0");
|
||||
setprop("systems/pressurization/cabinpsi", "0");
|
||||
|
||||
mcdu.ReceivedMessagesDatabase.clearDatabase();
|
||||
}
|
||||
|
||||
#################
|
||||
|
|
|
@ -171,6 +171,7 @@ var MessageController = {
|
|||
TypeIMessage.new("NOT IN DATA BASE"),TypeIMessage.new("ONLY SPD ENTRY ALLOWED"),TypeIMessage.new("REVISION IN PROGRESS"),
|
||||
TypeIMessage.new("TMPY F-PLN EXISTS", 1),TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"),
|
||||
TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),TypeIMessage.new("RWY/LS MISMATCH"),
|
||||
TypeIMessage.new("VHF3 VOICE MSG NOT GEN"),TypeIMessage.new("NO COMM MSG NOT GEN"),TypeIMessage.new("WX UPLINK"),
|
||||
]),
|
||||
typeIIMessages: std.Vector.new([
|
||||
TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"),
|
||||
|
|
|
@ -197,6 +197,7 @@ var windController = {
|
|||
me.winds[n] = me.copyWinds(2);
|
||||
me.nav_indicies[n] = me.nav_indicies[2];
|
||||
me.windSizes[n] = me.windSizes[2];
|
||||
#me.waypointsChanged();
|
||||
#me.temporaryFlag[n] = 1;
|
||||
},
|
||||
|
||||
|
@ -213,7 +214,7 @@ var windController = {
|
|||
}
|
||||
if (n == 3) { return; }
|
||||
me.resetWind(n);
|
||||
#me.updatePlans();
|
||||
me.waypointsChanged();
|
||||
#me.temporaryFlag[n] = 0;
|
||||
},
|
||||
|
||||
|
@ -253,6 +254,7 @@ var windController = {
|
|||
#print("insert plan: ", plan, ", index: ", index);
|
||||
#debug.dump(me.winds);
|
||||
#debug.dump(me.windSizes);
|
||||
me.waypointsChanged();
|
||||
},
|
||||
|
||||
deleteWind: func(plan, index) {
|
||||
|
@ -274,6 +276,58 @@ var windController = {
|
|||
#print("delete plan: ", plan, ", index: ", index);
|
||||
#debug.dump(me.winds);
|
||||
#debug.dump(me.windSizes);
|
||||
me.waypointsChanged();
|
||||
},
|
||||
|
||||
waypointsChanged: func() {
|
||||
if (canvas_mcdu.myCRZWIND[1] != nil) {
|
||||
if (!fmgc.flightPlanController.temporaryFlag[1]) {
|
||||
if (fmgc.FMGCInternal.toFromSet 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 (fmgc.FMGCInternal.toFromSet 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 (fmgc.FMGCInternal.toFromSet 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 (fmgc.FMGCInternal.toFromSet 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();
|
||||
}
|
||||
},
|
||||
|
||||
updatePlans: func() {
|
||||
|
@ -327,51 +381,9 @@ var windController = {
|
|||
canvas_mcdu.myCLBWIND[0].reload();
|
||||
}
|
||||
if (canvas_mcdu.myCRZWIND[1] != nil) {
|
||||
if (!fmgc.flightPlanController.temporaryFlag[1]) {
|
||||
if (fmgc.FMGCInternal.toFromSet 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 (fmgc.FMGCInternal.toFromSet 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 (fmgc.FMGCInternal.toFromSet 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 (fmgc.FMGCInternal.toFromSet 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) {
|
||||
|
|
|
@ -240,6 +240,7 @@ var systemsLoop = maketimer(0.1, func {
|
|||
dmc.DMController.loop();
|
||||
systems.APUController.loop();
|
||||
systems.HFLoop();
|
||||
atsu.ATSU.loop();
|
||||
|
||||
groundspeed = pts.Velocities.groundspeed.getValue();
|
||||
if ((groundAir.getBoolValue() or groundCart.getBoolValue()) and ((groundspeed > 2) or (!pts.Controls.Gear.parkingBrake.getBoolValue() and !chocks.getBoolValue()))) {
|
||||
|
|
|
@ -273,6 +273,13 @@ var lskbutton = func(btn, i) {
|
|||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "WEATHERTYPE");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERTYPE") {
|
||||
atsu.AOC.selectedType = "HOURLY WX";
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].leftKey(1);
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -341,6 +348,8 @@ var lskbutton = func(btn, i) {
|
|||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "DATAMODE");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].leftKey(2);
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -392,6 +401,8 @@ var lskbutton = func(btn, i) {
|
|||
canvas_mcdu.myDuplicate[i].pushButtonLeft(3);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "VOICEDIRECTORY");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].leftKey(3);
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -438,6 +449,8 @@ var lskbutton = func(btn, i) {
|
|||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].leftKey(4);
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -493,6 +506,8 @@ var lskbutton = func(btn, i) {
|
|||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "NOTIFICATION");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].leftKey(5);
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -550,10 +565,15 @@ var lskbutton = func(btn, i) {
|
|||
canvas_mcdu.myDirTo[i].fieldL6();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "CLOSESTAIRPORT") {
|
||||
canvas_mcdu.myClosestAirport[i].freeze();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU" or getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") {
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "AOCMENU" or getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU" or getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATSUDLINK");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "NOTIFICATION" or getprop("/MCDU[" ~ i ~ "]/page") == "CONNECTSTATUS") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ" or getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "AOCMENU");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSG") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "RECEIVEDMSGS");
|
||||
canvas_mcdu.myReceivedMessages[i].update();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATSUDLINK");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMINIT" or getprop("/MCDU[" ~ i ~ "]/page") == "VOICEDIRECTORY" or getprop("/MCDU[" ~ i ~ "]/page") == "DATAMODE" or getprop("/MCDU[" ~ i ~ "]/page") == "COMMSTATUS" or getprop("/MCDU[" ~ i ~ "]/page") == "COMPANYCALL") {
|
||||
|
@ -620,6 +640,20 @@ var rskbutton = func(btn, i) {
|
|||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATSUDLINK") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "AOCMENU");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ") {
|
||||
var result = atsu.AOC.newStation(mcdu_scratchpad.scratchpads[i].scratchpad, i);
|
||||
if (result == 1) {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
} elsif (result == 2) {
|
||||
mcdu_message(i, "NOT IN DATA BASE");
|
||||
} else {
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERTYPE") {
|
||||
atsu.AOC.selectedType = "TERM FCST";
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ");
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -647,6 +681,8 @@ var rskbutton = func(btn, i) {
|
|||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "COMPANYCALL");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "AOCMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ");
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -677,6 +713,13 @@ var rskbutton = func(btn, i) {
|
|||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
|
||||
canvas_mcdu.myFpln[i].pushButtonRight(3);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "AOCMENU") {
|
||||
if (canvas_mcdu.myReceivedMessages[i] != nil) {
|
||||
canvas_mcdu.myReceivedMessages[i].del();
|
||||
}
|
||||
canvas_mcdu.myReceivedMessages[i] = nil;
|
||||
canvas_mcdu.myReceivedMessages[i] = receivedMessagesPage.new(i);
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "RECEIVEDMSGS");
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -814,6 +857,17 @@ var rskbutton = func(btn, i) {
|
|||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "CONNECTSTATUS");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ") {
|
||||
var result = atsu.AOC.sendReq(i);
|
||||
if (result == 1) {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
} elsif (result == 3) {
|
||||
mcdu.mcdu_message(i, "VHF3 VOICE MSG NOT GEN");
|
||||
} elsif (result == 4) {
|
||||
mcdu.mcdu_message(i, "NO COMM MSG NOT GEN");
|
||||
} else {
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "VOICEDIRECTORY") {
|
||||
for (var i = 0; i < 3; i = i + 1) {
|
||||
if (getprop("/systems/radio/rmp[" ~ i ~ "]/sel_chan") == "vhf3") {
|
||||
|
@ -902,6 +956,10 @@ var arrowbutton = func(btn, i) {
|
|||
canvas_mcdu.myArrival[i].scrollLeft();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PILOTWP") {
|
||||
canvas_mcdu.myPilotWP[i].scrollLeft();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].scrollLeft();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSG") {
|
||||
canvas_mcdu.myReceivedMessage[i].scrollLeft();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU2");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") {
|
||||
|
@ -930,6 +988,10 @@ var arrowbutton = func(btn, i) {
|
|||
canvas_mcdu.myArrival[i].scrollRight();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PILOTWP") {
|
||||
canvas_mcdu.myPilotWP[i].scrollRight();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].scrollRight();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSG") {
|
||||
canvas_mcdu.myReceivedMessage[i].scrollRight();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU2");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") {
|
||||
|
@ -1006,7 +1068,7 @@ var pagebutton = func(btn, i) {
|
|||
setprop("/MCDU[" ~ i ~ "]/page", "DATA");
|
||||
} else if (btn == "mcdu") {
|
||||
var page = getprop("/MCDU[" ~ i ~ "]/page");
|
||||
if (page != "ATSUDLINK" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT") {
|
||||
if (page != "ATSUDLINK" and page != "AOCMENU" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT") {
|
||||
setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", getprop("/MCDU[" ~ i ~ "]/page"));
|
||||
} else {
|
||||
setprop("/MCDU[" ~ i ~ "]/last-atsu-page", getprop("/MCDU[" ~ i ~ "]/page"));
|
||||
|
|
300
Nasal/MCDU/RECEIVEDMESSAGES.nas
Normal file
300
Nasal/MCDU/RECEIVEDMESSAGES.nas
Normal file
|
@ -0,0 +1,300 @@
|
|||
var receivedMessagesPage = {
|
||||
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"],
|
||||
R1: [nil, nil, "ack"],
|
||||
R2: [nil, nil, "ack"],
|
||||
R3: [nil, nil, "ack"],
|
||||
R4: [nil, nil, "ack"],
|
||||
R5: [nil, nil, "ack"],
|
||||
R6: [nil, nil, "ack"],
|
||||
computer: nil,
|
||||
size: 0,
|
||||
getPageNumStr: func() {
|
||||
return me.curPage ~ "/" ~ ReceivedMessagesDatabase.getCountPages();
|
||||
},
|
||||
new: func(computer) {
|
||||
var ap = {parents:[receivedMessagesPage]};
|
||||
ap.computer = computer;
|
||||
ap.curPage = 1;
|
||||
ap._setupPageWithData();
|
||||
ap.update();
|
||||
return ap;
|
||||
},
|
||||
del: func() {
|
||||
return nil;
|
||||
},
|
||||
scrollLeft: func() {
|
||||
me.curPage -= 1;
|
||||
if (me.curPage < 1) {
|
||||
me.curPage = ReceivedMessagesDatabase.getCountPages();
|
||||
}
|
||||
me.update();
|
||||
},
|
||||
scrollRight: func() {
|
||||
me.curPage += 1;
|
||||
if (me.curPage > ReceivedMessagesDatabase.getCountPages()) {
|
||||
me.curPage = 1;
|
||||
}
|
||||
me.update();
|
||||
},
|
||||
_clearPage: func() {
|
||||
me.L1 = [nil, nil, "ack"];
|
||||
me.L2 = [nil, nil, "ack"];
|
||||
me.L3 = [nil, nil, "ack"];
|
||||
me.L4 = [nil, nil, "ack"];
|
||||
me.L5 = [nil, nil, "ack"];
|
||||
me.R1 = [nil, nil, "ack"];
|
||||
me.R2 = [nil, nil, "ack"];
|
||||
me.R3 = [nil, nil, "ack"];
|
||||
me.R4 = [nil, nil, "ack"];
|
||||
me.R5 = [nil, nil, "ack"];
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
|
||||
},
|
||||
_setupPageWithData: func() {
|
||||
me.title = "RECEIVED MESSAGES ";
|
||||
me.L6 = [" RETURN", nil, "wht"];
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
|
||||
me.arrowsColour = [["blu", "blu", "blu", "blu", "blu", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
|
||||
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
update: func() {
|
||||
me._clearPage();
|
||||
me.size = ReceivedMessagesDatabase.getSize();
|
||||
var message = nil;
|
||||
|
||||
if (me.size >= (me.curPage * 5) + -4) {
|
||||
message = ReceivedMessagesDatabase.database.vector[-5 + (me.curPage * 5)];
|
||||
me.L1[0] = " " ~ left(message.body, 23);
|
||||
me.L1[2] = "blu";
|
||||
if (!message.viewed) {
|
||||
me.L1[1] = " " ~ message.time ~ " NEW";
|
||||
} else {
|
||||
me.L1[1] = " " ~ message.time ~ " VIEWED";
|
||||
}
|
||||
me.arrowsMatrix[0][0] = 1;
|
||||
}
|
||||
|
||||
if (me.size >= (me.curPage * 5) + -3) {
|
||||
message = ReceivedMessagesDatabase.database.vector[-4 + (me.curPage * 5)];
|
||||
me.L2[0] = " " ~ left(message.body, 23);
|
||||
me.L2[2] = "blu";
|
||||
if (!message.viewed) {
|
||||
me.L2[1] = " " ~ message.time ~ " NEW";
|
||||
} else {
|
||||
me.L2[1] = " " ~ message.time ~ " VIEWED";
|
||||
}
|
||||
me.arrowsMatrix[0][1] = 1;
|
||||
}
|
||||
|
||||
if (me.size >= (me.curPage * 5) + -2) {
|
||||
message = ReceivedMessagesDatabase.database.vector[-3 + (me.curPage * 5)];
|
||||
me.L3[0] = " " ~ left(message.body, 23);
|
||||
me.L3[2] = "blu";
|
||||
if (!message.viewed) {
|
||||
me.L3[1] = " " ~ message.time ~ " NEW";
|
||||
} else {
|
||||
me.L3[1] = " " ~ message.time ~ " VIEWED";
|
||||
}
|
||||
me.arrowsMatrix[0][2] = 1;
|
||||
}
|
||||
|
||||
if (me.size >= (me.curPage * 5) + -1) {
|
||||
message = ReceivedMessagesDatabase.database.vector[-2 + (me.curPage * 5)];
|
||||
me.L4[0] = " " ~ left(message.body, 23);
|
||||
me.L4[2] = "blu";
|
||||
if (!message.viewed) {
|
||||
me.L4[1] = " " ~ message.time ~ " NEW";
|
||||
} else {
|
||||
me.L4[1] = " " ~ message.time ~ " VIEWED";
|
||||
}
|
||||
me.arrowsMatrix[0][3] = 1;
|
||||
}
|
||||
|
||||
if (me.size >= (me.curPage * 5) + 0) {
|
||||
message = ReceivedMessagesDatabase.database.vector[-1 + (me.curPage * 5)];
|
||||
me.L5[0] = " " ~ left(message.body, 23);
|
||||
me.L5[2] = "blu";
|
||||
if (!message.viewed) {
|
||||
me.L5[1] = " " ~ message.time ~ " NEW";
|
||||
} else {
|
||||
me.L5[1] = " " ~ message.time ~ " VIEWED";
|
||||
}
|
||||
me.arrowsMatrix[0][4] = 1;
|
||||
}
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
leftKey: func(index) {
|
||||
if (ReceivedMessagesDatabase.getSize() >= (-5 + index + (me.curPage * 5))) {
|
||||
canvas_mcdu.myReceivedMessage[me.computer] = receivedMessagePage.new(me.computer, (-6 + index + (me.curPage * 5)));
|
||||
setprop("MCDU[" ~ me.computer ~ "]/page", "RECEIVEDMSG");
|
||||
} else {
|
||||
mcdu_message(me.computer, "NOT ALLOWED");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var receivedMessagePage = {
|
||||
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"],
|
||||
computer: nil,
|
||||
size: 0,
|
||||
new: func(computer, index) {
|
||||
var ap = {parents:[receivedMessagePage]};
|
||||
ap.computer = computer;
|
||||
ap.curPage = index + 1;
|
||||
ReceivedMessagesDatabase.database.vector[ap.curPage - 1].viewed = 1;
|
||||
ap._setupPageWithData();
|
||||
ap.update();
|
||||
return ap;
|
||||
},
|
||||
del: func() {
|
||||
return nil;
|
||||
},
|
||||
scrollLeft: func() {
|
||||
me.curPage -= 1;
|
||||
if (me.curPage < 1) {
|
||||
me.curPage = ReceivedMessagesDatabase.getSize();
|
||||
}
|
||||
ReceivedMessagesDatabase.database.vector[me.curPage - 1].viewed = 1;
|
||||
me.update();
|
||||
},
|
||||
scrollRight: func() {
|
||||
me.curPage += 1;
|
||||
if (me.curPage > ReceivedMessagesDatabase.getSize()) {
|
||||
me.curPage = 1;
|
||||
}
|
||||
ReceivedMessagesDatabase.database.vector[me.curPage - 1].viewed = 1;
|
||||
me.update();
|
||||
},
|
||||
_clearPage: func() {
|
||||
me.L1 = [nil, nil, "ack"];
|
||||
me.L2 = [nil, nil, "ack"];
|
||||
me.L3 = [nil, nil, "ack"];
|
||||
me.L4 = [nil, nil, "ack"];
|
||||
me.L5 = [nil, nil, "ack"];
|
||||
me.C1 = [nil, nil, "ack"];
|
||||
me.C2 = [nil, nil, "ack"];
|
||||
me.C3 = [nil, nil, "ack"];
|
||||
me.C4 = [nil, nil, "ack"];
|
||||
me.C5 = [nil, nil, "ack"];
|
||||
me.R1 = [nil, nil, "ack"];
|
||||
me.R2 = [nil, nil, "ack"];
|
||||
me.R3 = [nil, nil, "ack"];
|
||||
me.R4 = [nil, nil, "ack"];
|
||||
me.R5 = [nil, nil, "ack"];
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
|
||||
},
|
||||
_setupPageWithData: func() {
|
||||
me.title = "ACARS MESSAGE";
|
||||
me.L6 = [" RETURN", nil, "wht"];
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
|
||||
me.arrowsColour = [["blu", "blu", "blu", "blu", "blu", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
|
||||
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
update: func() {
|
||||
me._clearPage();
|
||||
me.size = ReceivedMessagesDatabase.getSize();
|
||||
var message = nil;
|
||||
if (me.size >= me.curPage) {
|
||||
message = ReceivedMessagesDatabase.database.vector[me.curPage - 1];
|
||||
me.L1[1] = message.time;
|
||||
me.C1[1] = "VIEWED";
|
||||
me.C1[2] = "grn";
|
||||
me.R1[1] = me.curPage ~ "/" ~ ReceivedMessagesDatabase.getSize();
|
||||
|
||||
me.L1[0] = left(message.body, size(message.body) > 30 ? 30 : size(message.body));
|
||||
me.L1[2] = "wht";
|
||||
me.L2[2] = "wht";
|
||||
me.L3[2] = "wht";
|
||||
me.L4[2] = "wht";
|
||||
me.L5[2] = "wht";
|
||||
if (size(message.body) > 30) {
|
||||
me.L2[1] = left(split(me.L1[0], message.body)[1], size(message.body) > 60 ? 30 : size(message.body) - 30);
|
||||
}
|
||||
if (size(message.body) > 60) {
|
||||
me.L2[0] = left(split(me.L2[1], message.body)[1], size(message.body) > 90 ? 30 : size(message.body) - 60);
|
||||
}
|
||||
if (size(message.body) > 90) {
|
||||
me.L3[1] = left(split(me.L2[0], message.body)[1], size(message.body) > 120 ? 30 : size(message.body) - 90);
|
||||
}
|
||||
if (size(message.body) > 120) {
|
||||
me.L3[0] = left(split(me.L3[1], message.body)[1], size(message.body) > 150 ? 30 : size(message.body) - 120);
|
||||
}
|
||||
if (size(message.body) > 150) {
|
||||
me.L4[1] = left(split(me.L3[0], message.body)[1], size(message.body) > 180 ? 30 : size(message.body) - 150);
|
||||
}
|
||||
if (size(message.body) > 180) {
|
||||
me.L4[0] = left(split(me.L4[1], message.body)[1], size(message.body) > 210 ? 30 : size(message.body) - 180);
|
||||
}
|
||||
if (size(message.body) > 210) {
|
||||
me.L5[1] = left(split(me.L4[0], message.body)[1], size(message.body) > 240 ? 30 : size(message.body) - 210);
|
||||
}
|
||||
if (size(message.body) > 240) {
|
||||
me.L5[0] = left(split(me.L5[1], message.body)[1], size(message.body) > 270 ? 30 : size(message.body) - 240);
|
||||
}
|
||||
}
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
};
|
||||
|
||||
var ACARSMessage = {
|
||||
new: func(time, body) {
|
||||
var message = {parents:[ACARSMessage]};
|
||||
message.time = time;
|
||||
message.body = body;
|
||||
message.viewed = 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
var ReceivedMessagesDatabase = {
|
||||
database: std.Vector.new(),
|
||||
addMessage: func(message) {
|
||||
me.database.insert(0, message);
|
||||
if (canvas_mcdu.myReceivedMessages[0] != nil) {
|
||||
canvas_mcdu.myReceivedMessages[0].update();
|
||||
}
|
||||
if (canvas_mcdu.myReceivedMessages[1] != nil) {
|
||||
canvas_mcdu.myReceivedMessages[1].update();
|
||||
}
|
||||
},
|
||||
getCountPages: func() {
|
||||
return math.ceil(me.database.size() / 5);
|
||||
},
|
||||
getSize: func() {
|
||||
return me.database.size();
|
||||
},
|
||||
clearDatabase: func() {
|
||||
me.database.clear();
|
||||
},
|
||||
};
|
|
@ -50,11 +50,12 @@ var windCRZPage = {
|
|||
return nil;
|
||||
},
|
||||
_setupPageWithData: func() {
|
||||
|
||||
if (me.singleCRZ == 1) {
|
||||
if (me.waypoint == nil) {
|
||||
me.title = ["","CRZ WIND",""];
|
||||
me.singleCRZ = 1;
|
||||
} else {
|
||||
me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name];
|
||||
me.singleCRZ = 0;
|
||||
}
|
||||
me.titleColour = "wht";
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0]];
|
||||
|
@ -488,8 +489,7 @@ var windCRZPage = {
|
|||
}
|
||||
mcdu_scratchpad.scratchpads[me.computer].empty();
|
||||
me.items -= 1;
|
||||
me._setupPageWithData();
|
||||
me.updateTmpy();
|
||||
me.reload();
|
||||
} else {
|
||||
mcdu_message(me.computer, "NOT ALLOWED");
|
||||
}
|
||||
|
|
|
@ -2,6 +2,17 @@
|
|||
# Jonathan Redpath
|
||||
|
||||
# Copyright (c) 2020 Josh Davidson (Octal450)
|
||||
var ATSU = {
|
||||
working: 0,
|
||||
loop: func() {
|
||||
if (systems.ELEC.Bus.ac1.getValue() >= 110 or systems.ELEC.Bus.dc1.getValue() >= 25) {
|
||||
me.working = 1;
|
||||
} else {
|
||||
me.working = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var notificationSystem = {
|
||||
notifyAirport: nil,
|
||||
hasNotified: 0,
|
||||
|
@ -78,4 +89,116 @@ var CompanyCall = {
|
|||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var AOC = {
|
||||
station: nil,
|
||||
selectedType: "HOURLY WX", # 0 = METAR 1 = TAF
|
||||
lastMETAR: nil,
|
||||
lastTAF: nil,
|
||||
sent: 0,
|
||||
sentTime: nil,
|
||||
received: 0,
|
||||
receivedTime: nil,
|
||||
newStation: func(airport) {
|
||||
if (size(airport) == 3 or size(airport) == 4) {
|
||||
if (size(findAirportsByICAO(airport)) == 0) {
|
||||
return 2;
|
||||
} else {
|
||||
me.station = airport;
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
},
|
||||
sendReq: func(i) {
|
||||
if (me.station == nil or (me.sent and !me.received)) {
|
||||
return 1;
|
||||
}
|
||||
me.sent = 1;
|
||||
me.received = 0;
|
||||
var sentTime = left(getprop("/sim/time/gmt-string"), 5);
|
||||
me.sentTime = split(":", sentTime)[0] ~ "." ~ split(":", sentTime)[1] ~ "Z";
|
||||
|
||||
if (me.selectedType == "HOURLY WX") {
|
||||
var result = me.fetchMETAR(atsu.AOC.station, i);
|
||||
if (result == 0) {
|
||||
return 0;
|
||||
} elsif (result == 1) {
|
||||
return 3;
|
||||
} elsif (result == 2) {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (me.selectedType == "TERM FCST") {
|
||||
var result = me.fetchTAF(atsu.AOC.station, i);
|
||||
if (result == 0) {
|
||||
return 0;
|
||||
} elsif (result == 1) {
|
||||
return 3;
|
||||
} elsif (result == 2) {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
},
|
||||
fetchMETAR: func(airport, i) {
|
||||
if (!ATSU.working) {
|
||||
me.sent = 0;
|
||||
return 2;
|
||||
}
|
||||
if (ecam.vhf3_voice.active) {
|
||||
me.sent = 0;
|
||||
return 1;
|
||||
}
|
||||
http.load("https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&mostRecent=true&hoursBeforeNow=12&stationString=" ~ airport)
|
||||
.fail(func print("Download failed!"))
|
||||
.done(func(r) me.processMETAR(r, i));
|
||||
return 0;
|
||||
},
|
||||
fetchTAF: func(airport, i) {
|
||||
if (!ATSU.working) {
|
||||
me.sent = 0;
|
||||
return 2;
|
||||
}
|
||||
if (ecam.vhf3_voice.active) {
|
||||
me.sent = 0;
|
||||
return 1;
|
||||
}
|
||||
http.load("https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=tafs&requestType=retrieve&format=xml&timeType=issue&mostRecent=true&hoursBeforeNow=12&stationString=" ~ airport)
|
||||
.fail(func print("Download failed!"))
|
||||
.done(func(r) me.processTAF(r, i));
|
||||
return 0;
|
||||
},
|
||||
processMETAR: func(r, i) {
|
||||
var raw = r.response;
|
||||
raw = split("<raw_text>", raw)[1];
|
||||
raw = split("</raw_text>", raw)[0];
|
||||
me.lastMETAR = raw;
|
||||
settimer(func() {
|
||||
me.received = 1;
|
||||
mcdu.mcdu_message(i, "WX UPLINK");
|
||||
|
||||
var receivedTime = left(getprop("/sim/time/gmt-string"), 5);
|
||||
me.receivedTime = split(":", receivedTime)[0] ~ "." ~ split(":", receivedTime)[1] ~ "Z";
|
||||
var message = mcdu.ACARSMessage.new(me.receivedTime, me.lastMETAR);
|
||||
mcdu.ReceivedMessagesDatabase.addMessage(message);
|
||||
}, math.max(rand()*6, 2.25));
|
||||
},
|
||||
processTAF: func(r, i) {
|
||||
var raw = r.response;
|
||||
raw = split("<raw_text>", raw)[1];
|
||||
raw = split("</raw_text>", raw)[0];
|
||||
me.lastTAF = raw;
|
||||
settimer(func() {
|
||||
me.received = 1;
|
||||
mcdu.mcdu_message(i, "WX UPLINK");
|
||||
|
||||
var receivedTime = left(getprop("/sim/time/gmt-string"), 5);
|
||||
me.receivedTime = split(":", receivedTime)[0] ~ "." ~ split(":", receivedTime)[1] ~ "Z";
|
||||
var message = mcdu.ACARSMessage.new(me.receivedTime, me.lastTAF);
|
||||
mcdu.ReceivedMessagesDatabase.addMessage(message);
|
||||
}, math.max(rand()*6, 2.25));
|
||||
},
|
||||
};
|
Loading…
Reference in a new issue