2020-04-30 19:26:36 +00:00
|
|
|
# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring)
|
2019-10-14 16:48:35 +00:00
|
|
|
|
2022-01-11 02:17:41 +00:00
|
|
|
# Copyright (c) 2022 Josh Davidson (Octal450)
|
2020-04-30 19:26:36 +00:00
|
|
|
# Copyright (c) 2020 Matthew Maring (mattmaring)
|
2019-10-14 16:48:35 +00:00
|
|
|
|
|
|
|
var initInputA = func(key, i) {
|
2020-05-23 00:40:01 +00:00
|
|
|
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
|
2020-12-31 20:03:47 +00:00
|
|
|
if (key == "L1") { #clear coRoute if set
|
|
|
|
if (scratchpad == "CLR") {
|
|
|
|
if (fmgc.FMGCInternal.coRouteSet == 1) {
|
|
|
|
fmgc.FMGCInternal.coRouteSet = 0;
|
|
|
|
fmgc.FMGCInternal.coRoute = "";
|
|
|
|
fmgc.FMGCInternal.depApt = "";
|
|
|
|
fmgc.FMGCInternal.arrApt = "";
|
|
|
|
fmgc.FMGCInternal.toFromSet = 0;
|
|
|
|
fmgc.FMGCNodes.toFromSet.setValue(0);
|
|
|
|
fmgc.windController.resetDesWinds();
|
|
|
|
setprop("/FMGC/internal/align-ref-lat", 0);
|
|
|
|
setprop("/FMGC/internal/align-ref-long", 0);
|
|
|
|
setprop("/FMGC/internal/align-ref-lat-edit", 0);
|
|
|
|
setprop("/FMGC/internal/align-ref-long-edit", 0);
|
|
|
|
if (fmgc.FMGCInternal.blockConfirmed) {
|
|
|
|
fmgc.FMGCInternal.fuelCalculating = 0;
|
|
|
|
fmgc.fuelCalculating.setValue(0);
|
|
|
|
fmgc.FMGCInternal.fuelCalculating = 1;
|
|
|
|
fmgc.fuelCalculating.setValue(1);
|
|
|
|
}
|
|
|
|
fmgc.flightPlanController.reset(2);
|
|
|
|
fmgc.flightPlanController.init();
|
|
|
|
Simbrief.SimbriefParser.inhibit = 0;
|
|
|
|
}
|
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
|
|
|
} else {
|
|
|
|
var len = size(scratchpad);
|
|
|
|
if (fmgc.FMGCInternal.coRouteSet == 1 or len != 10) {
|
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
|
|
|
} else {
|
|
|
|
mcdu_message(i, "NOT IN DATA BASE"); # fake message - TODO flightplan loader
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "L2") {
|
2020-03-28 20:40:02 +00:00
|
|
|
if (scratchpad == "CLR") {
|
2020-07-10 00:25:25 +00:00
|
|
|
fmgc.FMGCInternal.altAirport = "";
|
|
|
|
fmgc.FMGCInternal.altAirportSet = 0;
|
2020-06-11 18:20:25 +00:00
|
|
|
fmgc.windController.updatePlans();
|
2020-10-03 09:59:43 +00:00
|
|
|
if (fmgc.FMGCInternal.blockConfirmed) {
|
|
|
|
fmgc.FMGCInternal.fuelCalculating = 0;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(0);
|
2020-10-03 09:59:43 +00:00
|
|
|
fmgc.FMGCInternal.fuelCalculating = 1;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(1);
|
2020-05-02 00:26:05 +00:00
|
|
|
}
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2020-03-24 12:33:40 +00:00
|
|
|
fmgc.updateARPT();
|
2020-04-14 20:31:32 +00:00
|
|
|
#} else if (scratchpad == "") {
|
2020-07-10 00:25:25 +00:00
|
|
|
#fmgc.FMGCInternal.altSelected = 1;
|
2020-04-13 18:24:22 +00:00
|
|
|
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
|
2020-07-10 19:28:17 +00:00
|
|
|
} else if (fmgc.FMGCInternal.toFromSet) {
|
2020-05-23 11:21:03 +00:00
|
|
|
if (!fmgc.flightPlanController.temporaryFlag[i]) {
|
|
|
|
var tfs = size(scratchpad);
|
|
|
|
if (tfs == 4) {
|
2020-07-10 00:25:25 +00:00
|
|
|
fmgc.FMGCInternal.altAirport = scratchpad;
|
2020-07-10 19:28:17 +00:00
|
|
|
fmgc.FMGCInternal.altAirportSet = 1;
|
2020-10-23 13:57:41 +00:00
|
|
|
atsu.ATISInstances[2].newStation(scratchpad);
|
2020-06-11 18:20:25 +00:00
|
|
|
fmgc.windController.updatePlans();
|
2020-10-03 09:59:43 +00:00
|
|
|
if (fmgc.FMGCInternal.blockConfirmed) {
|
|
|
|
fmgc.FMGCInternal.fuelCalculating = 0;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(0);
|
2020-10-03 09:59:43 +00:00
|
|
|
fmgc.FMGCInternal.fuelCalculating = 1;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(1);
|
2020-05-23 11:21:03 +00:00
|
|
|
}
|
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
|
|
|
fmgc.updateARPT();
|
2020-07-10 00:25:25 +00:00
|
|
|
#fmgc.FMGCInternal.altSelected = 1;
|
2020-05-23 11:21:03 +00:00
|
|
|
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
|
|
|
|
} else {
|
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2020-05-02 00:26:05 +00:00
|
|
|
}
|
2020-03-24 12:33:40 +00:00
|
|
|
} else {
|
2020-05-23 11:21:03 +00:00
|
|
|
mcdu_message(i, "TMPY F-PLN EXISTS");
|
2020-03-28 20:40:02 +00:00
|
|
|
}
|
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2020-03-28 20:40:02 +00:00
|
|
|
}
|
2020-03-24 12:33:40 +00:00
|
|
|
} else if (key == "L3") {
|
2019-10-14 16:48:35 +00:00
|
|
|
if (scratchpad == "CLR") {
|
2020-07-10 00:09:19 +00:00
|
|
|
fmgc.FMGCInternal.flightNum = "";
|
|
|
|
fmgc.FMGCInternal.flightNumSet = 0;
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
var flts = size(scratchpad);
|
|
|
|
if (flts >= 1 and flts <= 8) {
|
2020-07-10 00:09:19 +00:00
|
|
|
fmgc.FMGCInternal.flightNum = scratchpad;
|
|
|
|
fmgc.FMGCInternal.flightNumSet = 1;
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "L5") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-07-10 19:54:13 +00:00
|
|
|
fmgc.FMGCInternal.costIndex = 0;
|
|
|
|
fmgc.FMGCInternal.costIndexSet = 0;
|
|
|
|
fmgc.FMGCNodes.costIndex.setValue(0);
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
var ci = int(scratchpad);
|
|
|
|
var cis = size(scratchpad);
|
|
|
|
if (cis >= 1 and cis <= 3) {
|
2020-03-30 01:27:18 +00:00
|
|
|
if (ci != nil and ci >= 0 and ci <= 999) {
|
2020-07-10 19:54:13 +00:00
|
|
|
fmgc.FMGCInternal.costIndex = ci;
|
|
|
|
fmgc.FMGCInternal.costIndexSet = 1;
|
2020-07-10 20:28:53 +00:00
|
|
|
fmgc.FMGCNodes.costIndex.setValue(fmgc.FMGCInternal.costIndex);
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "L6") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-07-10 00:09:19 +00:00
|
|
|
fmgc.FMGCInternal.crzFt = 10000;
|
|
|
|
fmgc.FMGCInternal.crzFl = 100;
|
|
|
|
fmgc.altvert();
|
|
|
|
fmgc.updateRouteManagerAlt();
|
|
|
|
fmgc.FMGCInternal.crzSet = 0;
|
|
|
|
updateCrzLvlCallback();
|
|
|
|
fmgc.FMGCInternal.crzTemp = 15;
|
|
|
|
fmgc.FMGCInternal.crzTempSet = 0;
|
2020-10-03 09:59:43 +00:00
|
|
|
if (fmgc.FMGCInternal.blockConfirmed) {
|
|
|
|
fmgc.FMGCInternal.fuelCalculating = 0;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(0);
|
2020-10-03 09:59:43 +00:00
|
|
|
fmgc.FMGCInternal.fuelCalculating = 1;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(1);
|
2020-05-02 00:26:05 +00:00
|
|
|
}
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2020-03-30 01:27:18 +00:00
|
|
|
} else if (find("/", scratchpad) != -1) {
|
|
|
|
var crztemp = split("/", scratchpad);
|
2020-04-14 20:31:32 +00:00
|
|
|
if (find("FL", crztemp[0]) != -1) {
|
2021-07-26 13:17:28 +00:00
|
|
|
var crz = substr(crztemp[0], 2);
|
2020-04-14 20:31:32 +00:00
|
|
|
var crzs = size(substr(crztemp[0], 2));
|
|
|
|
} else {
|
2021-07-26 13:17:28 +00:00
|
|
|
var crz = crztemp[0];
|
2020-04-14 20:31:32 +00:00
|
|
|
var crzs = size(crztemp[0]);
|
|
|
|
}
|
|
|
|
var temp = int(crztemp[1]);
|
2020-03-30 01:27:18 +00:00
|
|
|
var temps = size(crztemp[1]);
|
2020-07-10 00:09:19 +00:00
|
|
|
if (crzs == 0 and temps >= 1 and temps <= 3 and temp != nil and fmgc.FMGCInternal.crzSet) {
|
2020-04-14 20:31:32 +00:00
|
|
|
if (temp >= -99 and temp <= 99) {
|
2020-07-10 00:09:19 +00:00
|
|
|
fmgc.FMGCInternal.crzTemp = temp;
|
|
|
|
fmgc.FMGCInternal.crzTempSet = 1;
|
2020-10-03 09:59:43 +00:00
|
|
|
if (fmgc.FMGCInternal.blockConfirmed) {
|
|
|
|
fmgc.FMGCInternal.fuelCalculating = 0;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(0);
|
2020-10-03 09:59:43 +00:00
|
|
|
fmgc.FMGCInternal.fuelCalculating = 1;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(1);
|
2020-05-05 14:24:24 +00:00
|
|
|
}
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2020-04-14 20:31:32 +00:00
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2020-04-14 20:31:32 +00:00
|
|
|
}
|
2021-07-26 13:17:28 +00:00
|
|
|
} else if (find(".", crz) == -1 and crzs >= 1 and crzs <= 3 and crz != nil and temps >= 1 and temps <= 3 and temp != nil) {
|
2020-04-14 20:31:32 +00:00
|
|
|
if (crz > 0 and crz <= 390 and temp >= -99 and temp <= 99) {
|
2021-07-26 13:17:28 +00:00
|
|
|
fmgc.FMGCInternal.crzFt = int(crz) * 100;
|
|
|
|
fmgc.FMGCInternal.crzFl = int(crz);
|
2020-07-10 00:09:19 +00:00
|
|
|
fmgc.altvert();
|
|
|
|
fmgc.updateRouteManagerAlt();
|
|
|
|
fmgc.FMGCInternal.crzSet = 1;
|
|
|
|
updateCrzLvlCallback();
|
|
|
|
fmgc.FMGCInternal.crzTemp = temp;
|
|
|
|
fmgc.FMGCInternal.crzTempSet = 1;
|
2021-07-26 13:17:28 +00:00
|
|
|
fmgc.FMGCInternal.crzProg = int(crz);
|
2020-10-03 09:59:43 +00:00
|
|
|
if (fmgc.FMGCInternal.blockConfirmed) {
|
|
|
|
fmgc.FMGCInternal.fuelCalculating = 0;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(0);
|
2020-10-03 09:59:43 +00:00
|
|
|
fmgc.FMGCInternal.fuelCalculating = 1;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(1);
|
2020-05-02 00:26:05 +00:00
|
|
|
}
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
2020-03-30 01:27:18 +00:00
|
|
|
} else {
|
2020-04-14 20:31:32 +00:00
|
|
|
if (find("FL", scratchpad) != -1) {
|
2021-07-26 13:17:28 +00:00
|
|
|
var crz = substr(scratchpad, 2);
|
2020-04-14 20:31:32 +00:00
|
|
|
var crzs = size(substr(scratchpad, 2));
|
|
|
|
} else {
|
2021-07-26 13:17:28 +00:00
|
|
|
var crz = scratchpad;
|
2020-04-14 20:31:32 +00:00
|
|
|
var crzs = size(scratchpad);
|
|
|
|
}
|
2021-07-26 13:17:28 +00:00
|
|
|
if (find(".", crz) == -1 and crzs >= 1 and crzs <= 3 and crz != nil) {
|
2020-04-14 20:31:32 +00:00
|
|
|
if (crz > 0 and crz <= 390) {
|
2021-07-26 13:17:28 +00:00
|
|
|
fmgc.FMGCInternal.crzFt = int(crz) * 100;
|
|
|
|
fmgc.FMGCInternal.crzFl = int(crz);
|
2020-07-10 00:09:19 +00:00
|
|
|
fmgc.altvert();
|
|
|
|
fmgc.updateRouteManagerAlt();
|
|
|
|
fmgc.FMGCInternal.crzSet = 1;
|
|
|
|
updateCrzLvlCallback();
|
2021-07-26 13:17:28 +00:00
|
|
|
fmgc.FMGCInternal.crzProg = int(crz);
|
2020-10-03 09:59:43 +00:00
|
|
|
if (fmgc.FMGCInternal.blockConfirmed) {
|
|
|
|
fmgc.FMGCInternal.fuelCalculating = 0;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(0);
|
2020-10-03 09:59:43 +00:00
|
|
|
fmgc.FMGCInternal.fuelCalculating = 1;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(1);
|
2020-05-02 00:26:05 +00:00
|
|
|
}
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2020-04-14 20:31:32 +00:00
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2020-04-14 20:31:32 +00:00
|
|
|
}
|
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2020-04-14 20:31:32 +00:00
|
|
|
}
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
} else if (key == "R1") {
|
2020-12-31 20:03:47 +00:00
|
|
|
if (fmgc.FMGCInternal.coRouteSet == 1) {
|
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
|
|
|
}
|
|
|
|
else if (scratchpad == "CLR") {
|
2020-07-10 19:28:17 +00:00
|
|
|
fmgc.FMGCInternal.depApt = "";
|
|
|
|
fmgc.FMGCInternal.arrApt = "";
|
|
|
|
fmgc.FMGCInternal.toFromSet = 0;
|
|
|
|
fmgc.FMGCNodes.toFromSet.setValue(0);
|
2020-07-30 02:21:30 +00:00
|
|
|
fmgc.windController.resetDesWinds();
|
2020-05-02 00:26:05 +00:00
|
|
|
setprop("/FMGC/internal/align-ref-lat", 0);
|
|
|
|
setprop("/FMGC/internal/align-ref-long", 0);
|
|
|
|
setprop("/FMGC/internal/align-ref-lat-edit", 0);
|
|
|
|
setprop("/FMGC/internal/align-ref-long-edit", 0);
|
2020-10-03 09:59:43 +00:00
|
|
|
if (fmgc.FMGCInternal.blockConfirmed) {
|
|
|
|
fmgc.FMGCInternal.fuelCalculating = 0;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(0);
|
2020-10-03 09:59:43 +00:00
|
|
|
fmgc.FMGCInternal.fuelCalculating = 1;
|
2020-10-03 11:34:29 +00:00
|
|
|
fmgc.fuelCalculating.setValue(1);
|
2020-05-02 00:26:05 +00:00
|
|
|
}
|
2020-05-21 21:36:14 +00:00
|
|
|
fmgc.flightPlanController.reset(2);
|
|
|
|
fmgc.flightPlanController.init();
|
2020-08-01 14:04:54 +00:00
|
|
|
Simbrief.SimbriefParser.inhibit = 0;
|
2021-02-19 20:17:38 +00:00
|
|
|
fmgc.updateARPT();
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2020-04-14 20:31:32 +00:00
|
|
|
#} else if (scratchpad == "") {
|
2020-07-10 00:25:25 +00:00
|
|
|
#fmgc.FMGCInternal.altSelected = 0;
|
2020-04-13 18:24:22 +00:00
|
|
|
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
|
2021-01-20 19:32:21 +00:00
|
|
|
} else {
|
2020-05-23 11:21:03 +00:00
|
|
|
if (!fmgc.flightPlanController.temporaryFlag[i]) {
|
|
|
|
var tfs = size(scratchpad);
|
|
|
|
if (tfs == 9 and find("/", scratchpad) != -1) {
|
|
|
|
var fromto = split("/", scratchpad);
|
|
|
|
var froms = size(fromto[0]);
|
|
|
|
var tos = size(fromto[1]);
|
|
|
|
if (froms == 4 and tos == 4) {
|
|
|
|
#route
|
2020-07-30 02:21:30 +00:00
|
|
|
if (fmgc.FMGCInternal.toFromSet == 1 and fmgc.FMGCInternal.arrApt != fromto[1]) {
|
|
|
|
fmgc.windController.resetDesWinds();
|
|
|
|
}
|
2020-07-10 19:28:17 +00:00
|
|
|
fmgc.FMGCInternal.depApt = fromto[0];
|
|
|
|
fmgc.FMGCInternal.arrApt = fromto[1];
|
2020-10-23 13:57:41 +00:00
|
|
|
atsu.ATISInstances[0].newStation(fromto[0]);
|
|
|
|
atsu.ATISInstances[1].newStation(fromto[1]);
|
2020-07-10 19:28:17 +00:00
|
|
|
fmgc.FMGCInternal.toFromSet = 1;
|
|
|
|
fmgc.FMGCNodes.toFromSet.setValue(1);
|
2020-05-23 11:21:03 +00:00
|
|
|
#scratchpad
|
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
|
|
|
fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2);
|
2020-07-10 00:25:25 +00:00
|
|
|
fmgc.FMGCInternal.altSelected = 0;
|
2021-02-19 20:17:38 +00:00
|
|
|
fmgc.updateARPT();
|
2020-08-01 15:30:16 +00:00
|
|
|
fmgc.updateArptLatLon();
|
2020-05-23 11:21:03 +00:00
|
|
|
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
|
|
|
|
} else {
|
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
|
|
|
}
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
} else {
|
2020-05-23 11:21:03 +00:00
|
|
|
mcdu_message(i, "TMPY F-PLN EXISTS");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-01 13:04:33 +00:00
|
|
|
} else if (key == "R2") {
|
2021-06-13 16:58:01 +00:00
|
|
|
if (pts.Engines.Engine.state[0].getValue() != 3 and pts.Engines.Engine.state[1].getValue() != 3 and fmgc.FMGCInternal.toFromSet == 0) {
|
2020-08-04 15:35:01 +00:00
|
|
|
if (!ecam.vhf3_voice.active) {
|
|
|
|
if (atsu.ATSU.working) {
|
|
|
|
if (getprop("/FMGC/simbrief-username") == "") {
|
|
|
|
mcdu.mcdu_message(i, "MISSING USERNAME")
|
|
|
|
} elsif (!Simbrief.SimbriefParser.inhibit) {
|
|
|
|
Simbrief.SimbriefParser.fetch(getprop("/FMGC/simbrief-username"), i);
|
|
|
|
} else {
|
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mcdu_message(i, "NO COMM MSG NOT GEN");
|
|
|
|
}
|
2020-08-01 15:30:16 +00:00
|
|
|
} else {
|
2020-08-04 15:35:01 +00:00
|
|
|
mcdu_message(i, "VHF3 VOICE MSG NOT GEN");
|
2020-08-01 15:30:16 +00:00
|
|
|
}
|
2020-08-01 13:04:33 +00:00
|
|
|
} else {
|
2020-08-01 15:30:16 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2020-08-01 13:04:33 +00:00
|
|
|
}
|
2019-10-14 16:48:35 +00:00
|
|
|
} else if (key == "R3") {
|
2020-03-25 14:54:39 +00:00
|
|
|
setprop("MCDU[" ~ i ~ "]/page", "IRSINIT");
|
2020-05-31 14:05:44 +00:00
|
|
|
} else if (key == "R4") {
|
2020-05-31 18:15:53 +00:00
|
|
|
if (canvas_mcdu.myCLBWIND[i] == nil) {
|
|
|
|
canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
|
2020-06-01 01:10:47 +00:00
|
|
|
} else {
|
|
|
|
canvas_mcdu.myCLBWIND[i].reload();
|
2020-05-31 14:05:44 +00:00
|
|
|
}
|
2020-06-13 01:28:14 +00:00
|
|
|
fmgc.windController.accessPage[i] = "INITA";
|
2020-05-31 14:05:44 +00:00
|
|
|
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
|
2020-05-01 02:44:47 +00:00
|
|
|
} else if (key == "R5") {
|
2019-10-14 16:48:35 +00:00
|
|
|
if (scratchpad == "CLR") {
|
2021-10-30 14:45:04 +00:00
|
|
|
if (fmgc.FMGCInternal.tropoSet) {
|
|
|
|
fmgc.FMGCInternal.tropo = 36090;
|
|
|
|
fmgc.FMGCInternal.tropoSet = 0;
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
2021-10-30 14:45:04 +00:00
|
|
|
} else {
|
|
|
|
if (num(scratchpad) == nil) {
|
|
|
|
if (find("FL", scratchpad) != -1) {
|
|
|
|
var tropos = size(split("FL", scratchpad)[1]);
|
|
|
|
var tropon = num(split("FL", scratchpad)[1]);
|
|
|
|
if (tropon != nil) {
|
|
|
|
if ((tropos == 2 or tropos == 3) and tropon >= 10 and tropon <= 999) {
|
|
|
|
fmgc.FMGCInternal.tropo = tropon * 100;
|
|
|
|
fmgc.FMGCInternal.tropoSet = 1;
|
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
|
|
|
} else {
|
|
|
|
mcdu_message(i, "ENTRY OUT OF RANGE");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
var tropos = size(scratchpad);
|
|
|
|
var tropon = num(scratchpad);
|
|
|
|
if ((tropos == 4 or tropos == 5) and tropon >= 1000 and tropon <= 99990) {
|
|
|
|
fmgc.FMGCInternal.tropo = math.round(tropon, 10);
|
|
|
|
fmgc.FMGCInternal.tropoSet = 1;
|
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
|
|
|
} else if ((tropos == 2 or tropos == 3) and tropon >= 10 and tropon <= 999) {
|
|
|
|
fmgc.FMGCInternal.tropo = num(scratchpad) * 100;
|
|
|
|
fmgc.FMGCInternal.tropoSet = 1;
|
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
|
|
|
} else {
|
|
|
|
mcdu_message(i, "ENTRY OUT OF RANGE");
|
|
|
|
}
|
|
|
|
}
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
2020-05-01 02:44:47 +00:00
|
|
|
} else if (key == "R6") {
|
|
|
|
if (scratchpad == "CLR") {
|
2021-10-30 14:45:04 +00:00
|
|
|
if (fmgc.FMGCInternal.gndTempSet) {
|
|
|
|
fmgc.FMGCInternal.gndTempSet = 0;
|
|
|
|
fmgc.FMGCInternal.gndTemp = 15;
|
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
|
|
|
} else {
|
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
|
|
|
}
|
|
|
|
} else if (isnum(scratchpad) and fmgc.FMGCInternal.phase == 0) {
|
|
|
|
if (size(scratchpad) >= 1 and size(scratchpad) <= 3 and scratchpad >= -99 and scratchpad <= 99) {
|
|
|
|
fmgc.FMGCInternal.gndTemp = scratchpad;
|
|
|
|
fmgc.FMGCInternal.gndTempSet = 1;
|
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
|
|
|
} else {
|
|
|
|
mcdu_message(i, "ENTRY OUT OF RANGE");
|
|
|
|
}
|
2020-05-01 02:44:47 +00:00
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2020-05-01 02:44:47 +00:00
|
|
|
}
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
}
|