Implement generic mcdu message, add ils mismatch (need to fix offset freq error, i.e. KSFO 28R)
This commit is contained in:
parent
8632050f40
commit
5222aeb633
4 changed files with 43 additions and 18 deletions
|
@ -295,6 +295,24 @@ var canvas_MCDU_base = {
|
|||
},
|
||||
updateCommon: func(i) {
|
||||
page = pageProp[i].getValue();
|
||||
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
|
||||
color_selected = getprop("MCDU[" ~ i ~ "]/scratchpad-color");
|
||||
if (color_selected == "grn") {
|
||||
me["Scratchpad"].setColor(GREEN);
|
||||
} else if (color_selected == "blu") {
|
||||
me["Scratchpad"].setColor(BLUE);
|
||||
} else if (color_selected == "amb") {
|
||||
me["Scratchpad"].setColor(AMBER);
|
||||
} else if (color_selected == "yel") {
|
||||
me["Scratchpad"].setColor(YELLOW);
|
||||
} else if (color_selected == "mag") {
|
||||
me["Scratchpad"].setColor(MAGENTA);
|
||||
} else {
|
||||
me["Scratchpad"].setColor(WHITE);
|
||||
}
|
||||
} else {
|
||||
me["Scratchpad"].setColor(WHITE);
|
||||
}
|
||||
if (page == "F-PLNA" or page == "F-PLNB") {
|
||||
if (!pageSwitch[i].getBoolValue()) {
|
||||
me["Simple"].show();
|
||||
|
@ -304,6 +322,7 @@ var canvas_MCDU_base = {
|
|||
me["INITA"].hide();
|
||||
me["IRSINIT"].hide();
|
||||
me["INITB"].hide();
|
||||
me["FUELPRED"].hide();
|
||||
me["PERFTO"].hide();
|
||||
me["PERFAPPR"].hide();
|
||||
me["PERFGA"].hide();
|
||||
|
|
|
@ -480,6 +480,7 @@ var masterFMGC = maketimer(0.2, func {
|
|||
#print(r.heading);
|
||||
#print(r.stopway);
|
||||
#print(r.threshold);
|
||||
setprop("FMGC/internal/ils1freq-calculated", r.ils_frequency_mhz);
|
||||
magnetic_hdg = geo.normdeg(r.heading - getprop("environment/magnetic-variation-deg"));
|
||||
if (r.ils_frequency_mhz != nil and !getprop("FMGC/internal/ils1freq-set") and !getprop("FMGC/internal/ils1crs-set")) {
|
||||
setprop("instrumentation/nav[0]/frequencies/selected-mhz", r.ils_frequency_mhz);
|
||||
|
@ -489,21 +490,13 @@ var masterFMGC = maketimer(0.2, func {
|
|||
} else if (!getprop("FMGC/internal/ils1crs-set")) {
|
||||
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
||||
}
|
||||
# if (getprop("FMGC/internal/ils1freq-set") and r.ils_frequency_mhz != getprop("instrumentation/nav[0]/frequencies/selected-mhz")) {
|
||||
# if (getprop("MCDU[0]/page") == "RADNAV") {
|
||||
# setprop("MCDU[0]/scratchpad-msg", 1);
|
||||
# setprop("MCDU[0]/scratchpad", "RWY/LS MISMATCH");
|
||||
# } else if (getprop("MCDU[1]/page") == "RADNAV") {
|
||||
# setprop("MCDU[1]/scratchpad-msg", 1);
|
||||
# setprop("MCDU[1]/scratchpad", "RWY/LS MISMATCH");
|
||||
# }
|
||||
# }
|
||||
}
|
||||
} else if (fmgc.flightPlanController.flightplans[2].departure_runway != nil and phase <= 1) {
|
||||
var runways = airportinfo(airportinfo(getprop("FMGC/internal/dep-arpt")).id).runways;
|
||||
var rwy = fmgc.flightPlanController.flightplans[2].departure_runway.id;
|
||||
if (runways[rwy] != nil) {
|
||||
var r = runways[rwy];
|
||||
setprop("FMGC/internal/ils1freq-calculated", r.ils_frequency_mhz);
|
||||
magnetic_hdg = geo.normdeg(r.heading - getprop("environment/magnetic-variation-deg"));
|
||||
if (r.ils_frequency_mhz != nil and !getprop("FMGC/internal/ils1freq-set") and !getprop("FMGC/internal/ils1crs-set")) {
|
||||
setprop("instrumentation/nav[0]/frequencies/selected-mhz", r.ils_frequency_mhz);
|
||||
|
@ -513,15 +506,6 @@ var masterFMGC = maketimer(0.2, func {
|
|||
} else if (!getprop("FMGC/internal/ils1crs-set")) {
|
||||
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
||||
}
|
||||
# if (getprop("FMGC/internal/ils1freq-set") and r.ils_frequency_mhz != getprop("instrumentation/nav[0]/frequencies/selected-mhz")) {
|
||||
# if (getprop("MCDU[0]/page") == "RADNAV") {
|
||||
# setprop("MCDU[0]/scratchpad-msg", 1);
|
||||
# setprop("MCDU[0]/scratchpad", "RWY/LS MISMATCH");
|
||||
# } else if (getprop("MCDU[1]/page") == "RADNAV") {
|
||||
# setprop("MCDU[1]/scratchpad-msg", 1);
|
||||
# setprop("MCDU[1]/scratchpad", "RWY/LS MISMATCH");
|
||||
# }
|
||||
# }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -15,6 +15,7 @@ var MCDU_reset = func(i) {
|
|||
setprop("MCDU[" ~ i ~ "]/last-fmgc-page", "STATUS");
|
||||
setprop("MCDU[" ~ i ~ "]/page", "MCDU");
|
||||
setprop("MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM");
|
||||
setprop("MCDU[" ~ i ~ "]/scratchpad-color", "wht");
|
||||
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
||||
|
||||
setprop("FMGC/keyboard-left", 0);
|
||||
|
@ -43,6 +44,7 @@ var MCDU_reset = func(i) {
|
|||
#RADNAV
|
||||
setprop("FMGC/internal/ils1freq-set", 0);
|
||||
setprop("FMGC/internal/ils1crs-set", 0);
|
||||
setprop("FMGC/internal/ils1freq-calculated", 0);
|
||||
setprop("FMGC/internal/vor1freq-set", 0);
|
||||
setprop("FMGC/internal/vor1crs-set", 0);
|
||||
setprop("FMGC/internal/vor2freq-set", 0);
|
||||
|
@ -667,6 +669,7 @@ var arrowbutton = func(btn, i) {
|
|||
}
|
||||
|
||||
var pagebutton = func(btn, i) {
|
||||
setprop("MCDU[" ~ i ~ "]/scratchpad-color", "wht");
|
||||
if (getprop("MCDU[" ~ i ~ "]/page") != "MCDU") {
|
||||
if (btn == "radnav") {
|
||||
setprop("MCDU[" ~ i ~ "]/page", "RADNAV");
|
||||
|
@ -877,6 +880,7 @@ var button = func(btn, i) {
|
|||
}
|
||||
} else {
|
||||
if (btn == "CLR") {
|
||||
setprop("MCDU[" ~ i ~ "]/scratchpad-color", "wht");
|
||||
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
|
||||
if (size(scratchpad) == 0) {
|
||||
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
|
||||
|
@ -890,7 +894,21 @@ var button = func(btn, i) {
|
|||
}
|
||||
}
|
||||
|
||||
var genericMessage = func(i, text, color) {
|
||||
if (getprop("MCDU[" ~ i ~ "]/scratchpad") != text) {
|
||||
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
|
||||
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
|
||||
} else {
|
||||
setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
|
||||
}
|
||||
}
|
||||
setprop("MCDU[" ~ i ~ "]/scratchpad-color", color);
|
||||
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
|
||||
setprop("MCDU[" ~ i ~ "]/scratchpad", text);
|
||||
}
|
||||
|
||||
var notAllowed = func(i) {
|
||||
setprop("MCDU[" ~ i ~ "]/scratchpad-color", "wht");
|
||||
if (getprop("MCDU[" ~ i ~ "]/scratchpad") != "NOT ALLOWED") {
|
||||
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
|
||||
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
|
||||
|
@ -903,6 +921,7 @@ var notAllowed = func(i) {
|
|||
}
|
||||
|
||||
var formatError = func(i) {
|
||||
setprop("MCDU[" ~ i ~ "]/scratchpad-color", "wht");
|
||||
if (getprop("MCDU[" ~ i ~ "]/scratchpad") != "FORMAT ERROR") {
|
||||
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
|
||||
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
|
||||
|
|
|
@ -69,6 +69,9 @@ var radnavInput = func(key, i) {
|
|||
setprop("instrumentation/nav[0]/frequencies/selected-mhz", scratchpad);
|
||||
setprop("FMGC/internal/ils1freq-set", 1);
|
||||
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
||||
if (num(getprop("FMGC/internal/ils1freq-calculated")) != 0 and num(getprop("FMGC/internal/ils1freq-calculated")) != num(getprop("instrumentation/nav[0]/frequencies/selected-mhz"))) {
|
||||
genericMessage(i, "RWY/LS MISMATCH", "amb");
|
||||
}
|
||||
} else {
|
||||
notAllowed(i);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue