2020-03-24 00:14:12 +00:00
|
|
|
# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (hayden2000)
|
2019-10-14 16:48:35 +00:00
|
|
|
|
|
|
|
# Copyright (c) 2019 Joshua Davidson (Octal450)
|
2020-03-24 12:33:40 +00:00
|
|
|
# Copyright (c) 2020 Matthew Maring (hayden2000)
|
2019-10-14 16:48:35 +00:00
|
|
|
|
|
|
|
var initInputA = func(key, i) {
|
2020-02-07 16:10:54 +00:00
|
|
|
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
|
2020-03-24 12:33:40 +00:00
|
|
|
if (key == "L2") {
|
2020-03-28 20:40:02 +00:00
|
|
|
if (scratchpad == "CLR") {
|
|
|
|
setprop("FMGC/internal/alt-airport", "");
|
2020-03-24 12:33:40 +00:00
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
|
|
|
fmgc.updateARPT();
|
2020-03-28 20:40:02 +00:00
|
|
|
} else if (scratchpad == "") {
|
|
|
|
setprop("FMGC/internal/alt-selected", 1);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
|
|
|
|
} else if (getprop("FMGC/internal/tofrom-set") == 1) {
|
|
|
|
var tfs = size(scratchpad);
|
2020-03-24 12:33:40 +00:00
|
|
|
if (tfs == 4) {
|
|
|
|
setprop("FMGC/internal/alt-airport", scratchpad);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
|
|
|
fmgc.updateARPT();
|
2020-03-25 14:54:39 +00:00
|
|
|
setprop("FMGC/internal/alt-selected", 1);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
|
2020-03-24 12:33:40 +00:00
|
|
|
} else {
|
2020-03-28 20:40:02 +00:00
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
2020-03-24 12:33:40 +00:00
|
|
|
} else if (key == "L3") {
|
2019-10-14 16:48:35 +00:00
|
|
|
if (scratchpad == "CLR") {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("MCDUC/flight-num", "");
|
|
|
|
setprop("MCDUC/flight-num-set", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
var flts = size(scratchpad);
|
|
|
|
if (flts >= 1 and flts <= 8) {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("MCDUC/flight-num", scratchpad);
|
|
|
|
setprop("MCDUC/flight-num-set", 1);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "L5") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/cost-index", 0);
|
|
|
|
setprop("FMGC/internal/cost-index-set", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
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-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/cost-index", ci);
|
|
|
|
setprop("FMGC/internal/cost-index-set", 1);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "L6") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/cruise-ft", 10000);
|
|
|
|
setprop("FMGC/internal/cruise-fl", 100);
|
|
|
|
setprop("FMGC/internal/cruise-lvl-set", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2020-03-30 01:27:18 +00:00
|
|
|
} else if (find("/", scratchpad) != -1) {
|
|
|
|
var crztemp = split("/", scratchpad);
|
|
|
|
var crz = int(crztemp[0]);
|
|
|
|
var crzs = size(crztemp[0]);
|
|
|
|
var temp = num(crztemp[1]);
|
|
|
|
var temps = size(crztemp[1]);
|
|
|
|
if (crzs >= 1 and crzs <= 3 and temps >= 1 and temps <= 5) {
|
|
|
|
if (crz == nil or temp == nil) {
|
2019-10-14 16:48:35 +00:00
|
|
|
notAllowed(i);
|
2020-03-30 01:27:18 +00:00
|
|
|
} else if (crz > 0 and crz <= 430 and temp >= -100 and temp < 100) {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/cruise-ft", crz * 100);
|
|
|
|
setprop("FMGC/internal/cruise-fl", crz);
|
2020-03-30 21:11:32 +00:00
|
|
|
setprop("FMGC/internal/cruise-fl-prog", crz);
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/cruise-lvl-set", 1);
|
2020-03-30 01:27:18 +00:00
|
|
|
setprop("FMGC/internal/cruise-temp", temp);
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
2020-03-30 01:27:18 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
} else if (key == "R1") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-04-12 22:44:02 +00:00
|
|
|
clearFPLNComputer();
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/dep-arpt", "");
|
|
|
|
setprop("FMGC/internal/arr-arpt", "");
|
|
|
|
setprop("FMGC/internal/tofrom-set", 0);
|
2020-01-05 20:21:28 +00:00
|
|
|
fmgc.flightPlanController.reset();
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2020-03-25 14:54:39 +00:00
|
|
|
} else if (scratchpad == "") {
|
2020-03-28 20:40:02 +00:00
|
|
|
setprop("FMGC/internal/alt-selected", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
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) {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/dep-arpt", fromto[0]);
|
|
|
|
setprop("FMGC/internal/arr-arpt", fromto[1]);
|
|
|
|
setprop("FMGC/internal/tofrom-set", 1);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2020-01-05 20:21:28 +00:00
|
|
|
fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2);
|
2020-03-25 14:54:39 +00:00
|
|
|
setprop("FMGC/internal/alt-selected", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "R3") {
|
2020-03-25 14:54:39 +00:00
|
|
|
setprop("MCDU[" ~ i ~ "]/page", "IRSINIT");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else if (key == "R6") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/tropo", 36090);
|
|
|
|
setprop("FMGC/internal/tropo-set", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
var tropo = size(scratchpad);
|
2020-03-25 14:54:39 +00:00
|
|
|
if (tropo == 5 and scratchpad <= 99990) {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/tropo-set", 1);
|
|
|
|
setprop("FMGC/internal/tropo", scratchpad);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|