1
0
Fork 0

Port to new method

This commit is contained in:
legoboyvdlp R 2020-05-23 12:16:20 +01:00
parent 97e00861cb
commit ccbfee96e5
26 changed files with 396 additions and 573 deletions

View file

@ -308,24 +308,6 @@ var canvas_MCDU_base = {
}, },
updateCommon: func(i) { updateCommon: func(i) {
page = pageProp[i].getValue(); 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 (page == "F-PLNA" or page == "F-PLNB") {
if (!pageSwitch[i].getBoolValue()) { if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show(); me["Simple"].show();
@ -4928,6 +4910,20 @@ var canvas_MCDU_base = {
}, },
updateScratchpad: func(i) { updateScratchpad: func(i) {
me["Scratchpad"].setText(sprintf("%s", mcdu_scratchpad.scratchpads[i].scratchpad)); me["Scratchpad"].setText(sprintf("%s", mcdu_scratchpad.scratchpads[i].scratchpad));
var color_selected = mcdu_scratchpad.scratchpads[i].scratchpadColour;
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);
}
}, },
}; };
@ -4984,6 +4980,9 @@ setlistener("sim/signals/fdm-initialized", func {
MCDU_1.updateScratchpadCall(); MCDU_1.updateScratchpadCall();
MCDU_2.updateScratchpadCall(); MCDU_2.updateScratchpadCall();
mcdu.mcdu_message(0, "SELECT DESIRED SYSTEM");
mcdu.mcdu_message(1, "SELECT DESIRED SYSTEM");
MCDU_update.start(); MCDU_update.start();
}); });

View file

@ -59,8 +59,7 @@ var WaypointDatabase = {
} }
me.write(); me.write();
if (me.getCount() != 0) { if (me.getCount() != 0) {
setprop("/MCDU[" ~ callerIdx ~ "]/scratchpad-msg", 1); mcdu.mcdu_message(callerIdx, "PILOT ELEMENT RETAINED");
setprop("/MCDU[" ~ callerIdx ~ "]/scratchpad", "PILOT ELEMENT RETAINED");
} }
}, },
# deleteAtIndex - delete at specific index. Set to nil, so it still exists in vector # deleteAtIndex - delete at specific index. Set to nil, so it still exists in vector

View file

@ -5,13 +5,13 @@ var TypeIMessage = {
new: func(msgText) { new: func(msgText) {
var msg = { parents: [TypeIMessage] }; var msg = { parents: [TypeIMessage] };
msg.msgText = msgText; msg.msgText = msgText;
msg.colour = "w"; msg.colour = "wht";
return msg; return msg;
}, },
}; };
var TypeIIMessage = { var TypeIIMessage = {
new: func(msgText, colour = "w", isInhibit = 0) { new: func(msgText, colour = "wht", isInhibit = 0) {
var msg = { parents: [TypeIIMessage] }; var msg = { parents: [TypeIIMessage] };
msg.msgText = msgText; msg.msgText = msgText;
msg.colour = colour; msg.colour = colour;
@ -49,9 +49,9 @@ var scratchpadController = {
var sp = { parents: [scratchpadController] }; var sp = { parents: [scratchpadController] };
sp.scratchpad = ""; sp.scratchpad = "";
sp.scratchpadSave = ""; sp.scratchpadSave = "";
sp.scratchpadColour = "w"; sp.scratchpadColour = "wht";
sp.scratchpadShowTypeIMsg = 0; sp.showTypeIMsg = 0;
sp.scratchpadShowTypeIIMsg = 0; sp.showTypeIIMsg = 0;
sp.mcdu = mcdu; sp.mcdu = mcdu;
return sp; return sp;
}, },
@ -62,13 +62,13 @@ var scratchpadController = {
} }
# any shown type ii is hidden # any shown type ii is hidden
if (me.scratchpadShowTypeIIMsg) { if (me.showTypeIIMsg) {
me.clearTypeIIMsg(); me.clearTypeII();
} }
# any shown type i is hidden # any shown type i is hidden
if (me.scratchpadShowTypeIMsg) { if (me.showTypeIMsg) {
me.clearTypeIMsg(); me.clearTypeI();
} }
me.scratchpad = me.scratchpad ~ character; me.scratchpad = me.scratchpad ~ character;
@ -76,32 +76,36 @@ var scratchpadController = {
}, },
showTypeI: func(msg) { showTypeI: func(msg) {
# any shown type ii is hidden # any shown type ii is hidden
if (me.scratchpadShowTypeIIMsg) { if (me.showTypeIIMsg) {
me.clearTypeIIMsg(); me.clearTypeII();
} }
me.scratchpadShowTypeIMsg = 1; me.showTypeIMsg = 1;
# save any data entered # save any data entered
me.scratchpadSave = me.scratchpad; me.scratchpadSave = me.scratchpad;
me.scratchpad = msg;
me.scratchpad = msg.msgText;
me.scratchpadColour = msg.colour;
me.update(); me.update();
}, },
showTypeII: func(msg) { showTypeII: func(msg) {
# only show if scratchpad empty # only show if scratchpad empty
if (me.scratchpad = "") { if (me.scratchpad = "") {
me.scratchpadShowTypeIIMsg = 1; me.showTypeIIMsg = 1;
me.scratchpad = msg; me.scratchpad = msg.msgText;
me.scratchpadColour = msg.colour;
} }
me.update(); me.update();
}, },
clearTypeI: func() { clearTypeI: func() {
me.scratchpad = me.scratchpadSave; me.scratchpad = me.scratchpadSave;
me.scratchpadSave = nil; me.scratchpadSave = nil;
me.scratchpadShowTypeIMsg = 0; me.showTypeIMsg = 0;
me.update(); me.update();
}, },
clearTypeII: func() { clearTypeII: func() {
me.scratchpadShowTypeIIMsg = 0; me.showTypeIIMsg = 0;
me.empty(); me.empty();
me.update(); me.update();
}, },
@ -110,12 +114,14 @@ var scratchpadController = {
me.update(); me.update();
}, },
clear: func() { clear: func() {
if (me.showTypeIMsg) { if (me.scratchpad == "CLR") {
me.clearTypeIMsg(); me.empty();
} elsif (me.showTypeIMsg) {
me.clearTypeI();
} elsif (!me.showTypeIIMsg) { } elsif (!me.showTypeIIMsg) {
me.scratchpad = left(me.scratchpad, size(me.scratchpad) - 1); me.scratchpad = left(me.scratchpad, size(me.scratchpad) - 1);
} else { } else {
me.clearTypeIIMsg(); me.clearTypeII();
} }
me.update(); me.update();
}, },
@ -130,12 +136,13 @@ var scratchpadController = {
var MessageController = { var MessageController = {
typeIMessages: std.Vector.new([ typeIMessages: std.Vector.new([
TypeIMessage.new("AWY/WPT MISMATCH"),TypeIMessage.new("DEST/ALTN MISMATCH"),TypeIMessage.new("DIR TO IN PROGRESS"), TypeIMessage.new("AOC DISABLED"),TypeIMessage.new("AWY/WPT MISMATCH"),TypeIMessage.new("DEST/ALTN MISMATCH"),
TypeIMessage.new("ENTRY OUT OF RANGE"),TypeIMessage.new("FORMAT ERROR"),TypeIMessage.new("INSERT/ERASE TMPY FIRST"), TypeIMessage.new("DIR TO IN PROGRESS"),TypeIMessage.new("ENTRY OUT OF RANGE"),TypeIMessage.new("FORMAT ERROR"),
TypeIMessage.new("LIST OF 20 IN USE"),TypeIMessage.new("PILOT ELEMENT RETAINED"),TypeIMessage.new("NOT ALLOWED"), TypeIMessage.new("INSERT/ERASE TMPY FIRST"),TypeIMessage.new("LIST OF 20 IN USE"),TypeIMessage.new("PILOT ELEMENT RETAINED"),
TypeIMessage.new("NOT IN DATA BASE"),TypeIMessage.new("ONLY SPD ENTRY ALLOWED"),TypeIMessage.new("PLEASE WAIT"), TypeIMessage.new("NOT ALLOWED"),TypeIMessage.new("NOT IN DATA BASE"),TypeIMessage.new("ONLY SPD ENTRY ALLOWED"),
TypeIMessage.new("REVISION IN PROGRESS"),TypeIMessage.new("TMPY F-PLN EXISTS"),TypeIMessage.new("SELECT DESIRED SYSTEM"), TypeIMessage.new("PLEASE WAIT"),TypeIMessage.new("REVISION IN PROGRESS"),TypeIMessage.new("TMPY F-PLN EXISTS"),
TypeIMessage.new("SELECT HDG/TRK FIRST"),TypeIMessage.new("USING COST INDEX N"), TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"),TypeIMessage.new("USING COST INDEX N"),
TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),
]), ]),
typeIIMessages: std.Vector.new([ typeIIMessages: std.Vector.new([

View file

@ -506,8 +506,7 @@ var arrivalPage = {
me.arrowsColour[0][5] = "yel"; me.arrowsColour[0][5] = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else { } else {
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ i ~ "]/scratchpad", "DIR TO IN PROGRESS");
} }
} }
}, },
@ -593,11 +592,10 @@ var arrivalPage = {
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
me.scrollRight(); me.scrollRight();
} else { } else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
} }
} else { } else {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
} else { } else {
if (size(me.stars) >= (index - 2)) { if (size(me.stars) >= (index - 2)) {
@ -625,11 +623,10 @@ var arrivalPage = {
me.updateActiveTransitions(); me.updateActiveTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
} else { } else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
} }
} else { } else {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
} }
}, },
@ -640,8 +637,7 @@ var arrivalPage = {
me.updateActiveTransitions(); me.updateActiveTransitions();
me.updateTransitions(); me.updateTransitions();
} else { } else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
} }
} elsif (size(me.transitions) >= (index - 1)) { } elsif (size(me.transitions) >= (index - 1)) {
if (!dirToFlag) { if (!dirToFlag) {
@ -652,11 +648,10 @@ var arrivalPage = {
me.updateTransitions(); me.updateTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
} else { } else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
} }
} else { } else {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
}, },
}; };

View file

@ -52,6 +52,11 @@ var closestAirportPage = {
}, },
freeze: func() { freeze: func() {
me.frozen = !me.frozen; me.frozen = !me.frozen;
if (me.frozen) {
me.L6 = [" UNFREEZE", nil, "blu"];
} else {
me.L6 = [" FREEZE", nil, "blu"];
}
}, },
update: func() { update: func() {
if (me.frozen) { return; } if (me.frozen) { return; }
@ -106,7 +111,7 @@ var closestAirportPage = {
return; return;
} }
if (size(id) > 4) { if (size(id) > 4) {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
if (airportinfo(id) == nil) { if (airportinfo(id) == nil) {
notInDataBase(me.computer); notInDataBase(me.computer);

View file

@ -430,8 +430,7 @@ var departurePage = {
me.arrowsColour[0][5] = "yel"; me.arrowsColour[0][5] = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else { } else {
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ i ~ "]/scratchpad", "DIR TO IN PROGRESS");
} }
} }
}, },
@ -508,11 +507,10 @@ var departurePage = {
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
me.scrollRight(); me.scrollRight();
} else { } else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
} }
} else { } else {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
} else { } else {
if (size(me.sids) >= (index - 1)) { if (size(me.sids) >= (index - 1)) {
@ -538,11 +536,10 @@ var departurePage = {
me.updateActiveTransitions(); me.updateActiveTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
} else { } else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
} }
} else { } else {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
} }
}, },
@ -553,8 +550,7 @@ var departurePage = {
me.updateActiveTransitions(); me.updateActiveTransitions();
me.updateTransitions(); me.updateTransitions();
} else { } else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
} }
} elsif (size(me.transitions) >= (index - 1)) { } elsif (size(me.transitions) >= (index - 1)) {
if (!dirToFlag) { if (!dirToFlag) {
@ -565,11 +561,10 @@ var departurePage = {
me.updateTransitions(); me.updateTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
} else { } else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
} }
} else { } else {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
}, },
}; };

View file

@ -156,7 +156,7 @@ var dirTo = {
var lonDecimal = mcdu.stringToDegrees(lon, "lon"); var lonDecimal = mcdu.stringToDegrees(lon, "lon");
if (latDecimal > 90 or latDecimal < -90 or lonDecimal > 180 or lonDecimal < -180) { if (latDecimal > 90 or latDecimal < -90 or lonDecimal > 180 or lonDecimal < -180) {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
var myWpLatLon = createWP(latDecimal, lonDecimal, "LL" ~ 01); var myWpLatLon = createWP(latDecimal, lonDecimal, "LL" ~ 01);
@ -229,10 +229,9 @@ var dirTo = {
} }
} else { } else {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", ""); mcdu_scratchpad.scratchpads[me.computer].empty();
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "");
}, },
leftFieldBtn: func(index) { leftFieldBtn: func(index) {
me.makeTmpy(); me.makeTmpy();
@ -252,22 +251,22 @@ var dirTo = {
if (fmgc.flightPlanController.temporaryFlag[me.computer] and dirToFlag) { if (fmgc.flightPlanController.temporaryFlag[me.computer] and dirToFlag) {
dirToFlag = 0; dirToFlag = 0;
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0); fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
me.L1 = [" [ ]", " WAYPOINT", "blu"];
me.R1 = ["---- --- ", "UTC DIST ", "wht"];
} else { } else {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
me.L1 = [" [ ]", " WAYPOINT", "blu"];
me.R1 = ["---- --- ", "UTC DIST ", "wht"];
}, },
fieldR6: func() { fieldR6: func() {
if (fmgc.flightPlanController.temporaryFlag[me.computer] and dirToFlag) { if (fmgc.flightPlanController.temporaryFlag[me.computer] and dirToFlag) {
dirToFlag = 0; dirToFlag = 0;
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1); fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
me.L1 = [" [ ]", " WAYPOINT", "blu"];
me.R1 = ["---- --- ", "UTC DIST ", "wht"];
setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); # todo - remember horizontal srcoll of f-plna?
} else { } else {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
me.L1 = [" [ ]", " WAYPOINT", "blu"];
me.R1 = ["---- --- ", "UTC DIST ", "wht"];
setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); # todo - remember horizontal srcoll of f-plna?
}, },
updateDist: func(dist) { updateDist: func(dist) {
me.R1 = ["---- " ~ sprintf("%.0f", dist) ~ " ", "UTC DIST ", "wht"]; me.R1 = ["---- " ~ sprintf("%.0f", dist) ~ " ", "UTC DIST ", "wht"];

View file

@ -188,10 +188,10 @@ var staticText = {
return [nil, nil, "ack"]; return [nil, nil, "ack"];
}, },
pushButtonLeft: func() { pushButtonLeft: func() {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
}, },
pushButtonRight: func() { pushButtonRight: func() {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
}, },
}; };
@ -406,26 +406,24 @@ var fplnPage = { # this one is only created once, and then updated - remember th
} }
} else { } else {
if (size(me.outputList) >= index) { if (size(me.outputList) >= index) {
if (size(getprop("MCDU[" ~ me.computer ~ "]/scratchpad")) > 0) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) > 0) {
var returny = fmgc.flightPlanController.scratchpad(getprop("MCDU[" ~ me.computer ~ "]/scratchpad"), (index - 1 + me.scroll), me.computer); var returny = fmgc.flightPlanController.scratchpad(mcdu_scratchpad.scratchpads[me.computer].scratchpad, (index - 1 + me.scroll), me.computer);
if (returny == 3) { if (returny == 3) {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
} elsif (returny == 0) { } elsif (returny == 0) {
notInDataBase(me.computer); mcdu_message(me.computer, "NOT IN DATA BASE");
} elsif (returny == 1) { } elsif (returny == 1) {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} elsif (returny == 4) { } elsif (returny == 4) {
databaseFull(me.computer); mcdu_message(me.computer, "LIST OF 20 IN USE");
} else { } else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", ""); mcdu_scratchpad.scratchpads[me.computer].empty();
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "");
} }
} else { } else {
me.outputList[index - 1].pushButtonLeft(); me.outputList[index - 1].pushButtonLeft();
} }
} else { } else {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
} }
}, },
@ -440,42 +438,22 @@ var fplnPage = { # this one is only created once, and then updated - remember th
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
} }
} else { } else {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
} else { } else {
if (size(me.outputList) >= index) { if (size(me.outputList) >= index) {
if (size(getprop("MCDU[" ~ me.computer ~ "]/scratchpad")) > 0) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) > 0) {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} else { } else {
me.outputList[index - 1].pushButtonRight(); me.outputList[index - 1].pushButtonRight();
} }
} else { } else {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} }
} }
}, },
}; };
var notInDataBase = func(i) {
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "NOT IN DATABASE");
} else {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "NOT IN DATABASE");
}
var databaseFull = func(i) {
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "LIST OF 20 IN USE");
} else {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "LIST OF 20 IN USE");
}
var decimalToShortString = func(dms, type) { var decimalToShortString = func(dms, type) {
var degrees = split(".", sprintf(dms))[0]; var degrees = split(".", sprintf(dms))[0];
if (type == "lat") { if (type == "lat") {

View file

@ -35,8 +35,7 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel"))); setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-percent", 5.0); setprop("/FMGC/internal/rte-percent", 5.0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (getprop("/FMGC/internal/trip-fuel") != 0) { } else if (getprop("/FMGC/internal/trip-fuel") != 0) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
@ -46,7 +45,7 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel"))); setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-percent", perc); setprop("/FMGC/internal/rte-percent", perc);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} }
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) { } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) {
setprop("/FMGC/internal/rte-rsv", scratchpad); setprop("/FMGC/internal/rte-rsv", scratchpad);
@ -56,12 +55,12 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value
} }
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and getprop("/FMGC/internal/alt-set")) { } else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and getprop("/FMGC/internal/alt-set")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
@ -69,8 +68,7 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/alt-time", "0000"); setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 0); setprop("/FMGC/internal/alt-fuel-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (find(".", scratchpad) != -1) { } else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
@ -79,12 +77,12 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/alt-time", "0000"); setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 1); setprop("/FMGC/internal/alt-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { } else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
@ -93,8 +91,7 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/final-fuel-set", 0); setprop("/FMGC/internal/final-fuel-set", 0);
setprop("/FMGC/internal/final-time-set", 0); setprop("/FMGC/internal/final-time-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (find(".", scratchpad) != -1) { } else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
@ -102,9 +99,9 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/final-fuel", tf); setprop("/FMGC/internal/final-fuel", tf);
setprop("/FMGC/internal/final-fuel-set", 1); setprop("/FMGC/internal/final-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
var tf = num(scratchpad); var tf = num(scratchpad);
@ -113,9 +110,9 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/final-time", scratchpad); setprop("/FMGC/internal/final-time", scratchpad);
setprop("/FMGC/internal/final-time-set", 1); setprop("/FMGC/internal/final-time-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { } else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
@ -123,8 +120,7 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/min-dest-fob", 0); setprop("/FMGC/internal/min-dest-fob", 0);
setprop("/FMGC/internal/min-dest-fob-set", 0); setprop("/FMGC/internal/min-dest-fob-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (find(".", scratchpad) != -1) { } else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
@ -132,19 +128,19 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/min-dest-fob", tf); setprop("/FMGC/internal/min-dest-fob", tf);
setprop("/FMGC/internal/min-dest-fob-set", 1); setprop("/FMGC/internal/min-dest-fob-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
if (num(getprop("/FMGC/internal/min-dest-fob")) < num(getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/alt-fuel"))) { if (num(getprop("/FMGC/internal/min-dest-fob")) < num(getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/alt-fuel"))) {
genericMessage(i, "CHECK MIN DEST FOB", "wht"); genericMessage(i, "CHECK MIN DEST FOB", "wht");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "R3" and !getprop("/FMGC/internal/fuel-calculating")) { } else if (key == "R3" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 0) { if (tfs == 0) {
@ -185,9 +181,9 @@ var fuelPredInput = func(key, i) {
} }
} }
if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) { if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) {
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (tfs >= 1 and tfs <= 5) { } else if (tfs >= 1 and tfs <= 5) {
var zfwcg = size(scratchpad); var zfwcg = size(scratchpad);
@ -202,31 +198,30 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1); setprop("/FMGC/internal/block-confirmed", 1);
} }
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R4") { } else if (key == "R4") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/fffq-sensor", "FF+FQ"); setprop("/FMGC/internal/fffq-sensor", "FF+FQ");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (find("/", scratchpad) == 0) { } else if (find("/", scratchpad) == 0) {
var sensor = substr(scratchpad, 1); var sensor = substr(scratchpad, 1);
if (sensor == "FF+FQ" or sensor == "FQ+FF" or sensor == "FF" or sensor == "FQ") { if (sensor == "FF+FQ" or sensor == "FQ+FF" or sensor == "FF" or sensor == "FQ") {
setprop("FMGC/internal/fffq-sensor", sensor); setprop("FMGC/internal/fffq-sensor", sensor);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }

View file

@ -13,8 +13,7 @@ var initInputA = func(key, i) {
setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
} }
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
fmgc.updateARPT(); fmgc.updateARPT();
#} else if (scratchpad == "") { #} else if (scratchpad == "") {
#setprop("/FMGC/internal/alt-selected", 1); #setprop("/FMGC/internal/alt-selected", 1);
@ -28,38 +27,36 @@ var initInputA = func(key, i) {
setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
} }
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
fmgc.updateARPT(); fmgc.updateARPT();
#setprop("/FMGC/internal/alt-selected", 1); #setprop("/FMGC/internal/alt-selected", 1);
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L3") { } else if (key == "L3") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("MCDUC/flight-num", ""); setprop("MCDUC/flight-num", "");
setprop("MCDUC/flight-num-set", 0); setprop("MCDUC/flight-num-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var flts = size(scratchpad); var flts = size(scratchpad);
if (flts >= 1 and flts <= 8) { if (flts >= 1 and flts <= 8) {
setprop("MCDUC/flight-num", scratchpad); setprop("MCDUC/flight-num", scratchpad);
setprop("MCDUC/flight-num-set", 1); setprop("MCDUC/flight-num-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L5") { } else if (key == "L5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0); setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var ci = int(scratchpad); var ci = int(scratchpad);
var cis = size(scratchpad); var cis = size(scratchpad);
@ -67,12 +64,12 @@ var initInputA = func(key, i) {
if (ci != nil and ci >= 0 and ci <= 999) { if (ci != nil and ci >= 0 and ci <= 999) {
setprop("/FMGC/internal/cost-index", ci); setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1); setprop("/FMGC/internal/cost-index-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L6") { } else if (key == "L6") {
@ -86,8 +83,7 @@ var initInputA = func(key, i) {
setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
} }
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (find("/", scratchpad) != -1) { } else if (find("/", scratchpad) != -1) {
var crztemp = split("/", scratchpad); var crztemp = split("/", scratchpad);
if (find("FL", crztemp[0]) != -1) { if (find("FL", crztemp[0]) != -1) {
@ -106,9 +102,9 @@ var initInputA = func(key, i) {
setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
} }
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (crzs >= 1 and crzs <= 3 and crz != nil and temps >= 1 and temps <= 3 and temp != nil) { } else if (crzs >= 1 and crzs <= 3 and crz != nil and temps >= 1 and temps <= 3 and temp != nil) {
if (crz > 0 and crz <= 390 and temp >= -99 and temp <= 99) { if (crz > 0 and crz <= 390 and temp >= -99 and temp <= 99) {
@ -122,12 +118,12 @@ var initInputA = func(key, i) {
setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
} }
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
if (find("FL", scratchpad) != -1) { if (find("FL", scratchpad) != -1) {
@ -147,12 +143,12 @@ var initInputA = func(key, i) {
setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
} }
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R1") { } else if (key == "R1") {
@ -170,8 +166,7 @@ var initInputA = func(key, i) {
} }
fmgc.flightPlanController.reset(2); fmgc.flightPlanController.reset(2);
fmgc.flightPlanController.init(); fmgc.flightPlanController.init();
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
#} else if (scratchpad == "") { #} else if (scratchpad == "") {
#setprop("/FMGC/internal/alt-selected", 0); #setprop("/FMGC/internal/alt-selected", 0);
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
@ -187,7 +182,7 @@ var initInputA = func(key, i) {
setprop("/FMGC/internal/arr-arpt", fromto[1]); setprop("/FMGC/internal/arr-arpt", fromto[1]);
setprop("/FMGC/internal/tofrom-set", 1); setprop("/FMGC/internal/tofrom-set", 1);
#scratchpad #scratchpad
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2); fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2);
setprop("/FMGC/internal/alt-selected", 0); setprop("/FMGC/internal/alt-selected", 0);
#ref lat #ref lat
@ -211,10 +206,10 @@ var initInputA = func(key, i) {
setprop("/FMGC/internal/align-ref-long-edit", 0); setprop("/FMGC/internal/align-ref-long-edit", 0);
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R3") { } else if (key == "R3") {
@ -223,29 +218,27 @@ var initInputA = func(key, i) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/tropo", 36090); setprop("/FMGC/internal/tropo", 36090);
setprop("/FMGC/internal/tropo-set", 0); setprop("/FMGC/internal/tropo-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tropo = size(scratchpad); var tropo = size(scratchpad);
if (tropo == 5 and scratchpad <= 99990) { if (tropo == 5 and scratchpad <= 99990) {
setprop("FMGC/internal/tropo-set", 1); setprop("FMGC/internal/tropo-set", 1);
setprop("FMGC/internal/tropo", scratchpad); setprop("FMGC/internal/tropo", scratchpad);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R6") { } else if (key == "R6") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/gndtemp-set", 0); setprop("/FMGC/internal/gndtemp-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil and getprop("/FMGC/status/phase") == 0 and size(scratchpad) >= 1 and size(scratchpad) <= 3 and scratchpad >= -99 and scratchpad <= 99) { } else if (int(scratchpad) != nil and getprop("/FMGC/status/phase") == 0 and size(scratchpad) >= 1 and size(scratchpad) <= 3 and scratchpad >= -99 and scratchpad <= 99) {
setprop("/FMGC/internal/gndtemp", scratchpad); setprop("/FMGC/internal/gndtemp", scratchpad);
setprop("/FMGC/internal/gndtemp-set", 1); setprop("/FMGC/internal/gndtemp-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} }

View file

@ -13,8 +13,7 @@ var initInputB = func(key, i) {
} else if (getprop("/FMGC/internal/fuel-request-set")) { } else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1); setprop("/FMGC/internal/block-calculating", 1);
} }
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 4) { if (tfs >= 1 and tfs <= 4) {
@ -22,13 +21,13 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/taxi-fuel", scratchpad); setprop("/FMGC/internal/taxi-fuel", scratchpad);
setprop("/FMGC/internal/taxi-fuel-set", 1); setprop("/FMGC/internal/taxi-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
fmgc.updateFuel(); fmgc.updateFuel();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { } else if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
@ -38,8 +37,7 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/rte-percent", 5.0); setprop("/FMGC/internal/rte-percent", 5.0);
setprop("/FMGC/internal/rte-percent-set", 0); setprop("/FMGC/internal/rte-percent-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (getprop("/FMGC/internal/trip-fuel") != 0) { } else if (getprop("/FMGC/internal/trip-fuel") != 0) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
@ -51,7 +49,7 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/rte-percent", perc); setprop("/FMGC/internal/rte-percent", perc);
setprop("/FMGC/internal/rte-percent-set", 1); setprop("/FMGC/internal/rte-percent-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} }
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) { } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) {
setprop("/FMGC/internal/rte-rsv", scratchpad); setprop("/FMGC/internal/rte-rsv", scratchpad);
@ -63,12 +61,12 @@ var initInputB = func(key, i) {
} }
setprop("/FMGC/internal/rte-percent-set", 0); setprop("/FMGC/internal/rte-percent-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and getprop("/FMGC/internal/alt-set")) { } else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and getprop("/FMGC/internal/alt-set")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
@ -76,8 +74,7 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/alt-time", "0000"); setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 0); setprop("/FMGC/internal/alt-fuel-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (find(".", scratchpad) != -1) { } else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
@ -86,12 +83,12 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/alt-time", "0000"); setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 1); setprop("/FMGC/internal/alt-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { } else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
@ -100,8 +97,7 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/final-fuel-set", 0); setprop("/FMGC/internal/final-fuel-set", 0);
setprop("/FMGC/internal/final-time-set", 0); setprop("/FMGC/internal/final-time-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (find(".", scratchpad) != -1) { } else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
@ -109,9 +105,9 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/final-fuel", tf); setprop("/FMGC/internal/final-fuel", tf);
setprop("/FMGC/internal/final-fuel-set", 1); setprop("/FMGC/internal/final-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
var tf = num(scratchpad); var tf = num(scratchpad);
@ -120,9 +116,9 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/final-time", scratchpad); setprop("/FMGC/internal/final-time", scratchpad);
setprop("/FMGC/internal/final-time-set", 1); setprop("/FMGC/internal/final-time-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { } else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
@ -130,8 +126,7 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/min-dest-fob", 0); setprop("/FMGC/internal/min-dest-fob", 0);
setprop("/FMGC/internal/min-dest-fob-set", 0); setprop("/FMGC/internal/min-dest-fob-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (find(".", scratchpad) != -1) { } else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
@ -139,19 +134,19 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/min-dest-fob", tf); setprop("/FMGC/internal/min-dest-fob", tf);
setprop("/FMGC/internal/min-dest-fob-set", 1); setprop("/FMGC/internal/min-dest-fob-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
if (num(getprop("/FMGC/internal/min-dest-fob")) < num(getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/alt-fuel"))) { if (num(getprop("/FMGC/internal/min-dest-fob")) < num(getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/alt-fuel"))) {
genericMessage(i, "CHECK MIN DEST FOB", "wht"); genericMessage(i, "CHECK MIN DEST FOB", "wht");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "R1" and !getprop("/FMGC/internal/fuel-calculating")) { } else if (key == "R1" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 0) { if (tfs == 0) {
@ -197,21 +192,21 @@ var initInputB = func(key, i) {
} }
} }
if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) { if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) {
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (tfs >= 1 and tfs <= 5) { } else if (tfs >= 1 and tfs <= 5) {
var zfwcg = size(scratchpad); var zfwcg = size(scratchpad);
if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) { if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) {
setprop("/FMGC/internal/zfwcg", scratchpad); setprop("/FMGC/internal/zfwcg", scratchpad);
setprop("/FMGC/internal/zfwcg-set", 1); setprop("/FMGC/internal/zfwcg-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R2" and !getprop("/FMGC/internal/fuel-calculating")) { } else if (key == "R2" and !getprop("/FMGC/internal/fuel-calculating")) {
@ -246,8 +241,7 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 0); setprop("/FMGC/internal/block-confirmed", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
var maxblock = getprop("/options/maxblock"); var maxblock = getprop("/options/maxblock");
@ -274,12 +268,12 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1); setprop("/FMGC/internal/block-confirmed", 1);
} }
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R3") { } else if (key == "R3") {
@ -290,7 +284,7 @@ var initInputB = func(key, i) {
setprop("/FMGC/internal/block-confirmed", 1); setprop("/FMGC/internal/block-confirmed", 1);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "R5" and !getprop("/FMGC/internal/fuel-calculating")) { } else if (key == "R5" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
@ -299,8 +293,7 @@ var initInputB = func(key, i) {
if (getprop("/FMGC/internal/block-confirmed")) { if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
} }
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
if (find("TL", scratchpad) != -1 or find("HD", scratchpad) != -1) { if (find("TL", scratchpad) != -1 or find("HD", scratchpad) != -1) {
var effwind = substr(scratchpad, 2); var effwind = substr(scratchpad, 2);
@ -310,9 +303,9 @@ var initInputB = func(key, i) {
if (getprop("/FMGC/internal/block-confirmed")) { if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
} }
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (find("-", scratchpad) != -1 or find("+", scratchpad) != -1 or find("T", scratchpad) != -1 or find("H", scratchpad) != -1) { } else if (find("-", scratchpad) != -1 or find("+", scratchpad) != -1 or find("T", scratchpad) != -1 or find("H", scratchpad) != -1) {
var effwind = substr(scratchpad, 1); var effwind = substr(scratchpad, 1);
@ -322,9 +315,9 @@ var initInputB = func(key, i) {
if (getprop("/FMGC/internal/block-confirmed")) { if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
} }
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
if (num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 500) { if (num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 500) {
@ -333,13 +326,13 @@ var initInputB = func(key, i) {
if (getprop("/FMGC/internal/block-confirmed")) { if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
} }
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }

View file

@ -29,7 +29,7 @@ var initInputIRS = func(key, i) {
setprop("FMGC/internal/align-ref-long-minutes", getprop("FMGC/internal/align-ref-long-minutes") + 0.1); setprop("FMGC/internal/align-ref-long-minutes", getprop("FMGC/internal/align-ref-long-minutes") + 0.1);
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "down") { } else if (key == "down") {
if (getprop("FMGC/internal/align-ref-lat-edit")) { if (getprop("FMGC/internal/align-ref-lat-edit")) {
@ -59,14 +59,14 @@ var initInputIRS = func(key, i) {
setprop("FMGC/internal/align-ref-long-minutes", getprop("FMGC/internal/align-ref-long-minutes") - 0.1); setprop("FMGC/internal/align-ref-long-minutes", getprop("FMGC/internal/align-ref-long-minutes") - 0.1);
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L1") { } else if (key == "L1") {
if (getprop("FMGC/internal/tofrom-set")) { if (getprop("FMGC/internal/tofrom-set")) {
setprop("FMGC/internal/align-ref-lat-edit", 1); setprop("FMGC/internal/align-ref-lat-edit", 1);
setprop("FMGC/internal/align-ref-long-edit", 0); setprop("FMGC/internal/align-ref-long-edit", 0);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L6") { } else if (key == "L6") {
setprop("FMGC/internal/align-ref-lat-edit", 0); setprop("FMGC/internal/align-ref-lat-edit", 0);
@ -77,7 +77,7 @@ var initInputIRS = func(key, i) {
setprop("FMGC/internal/align-ref-lat-edit", 0); setprop("FMGC/internal/align-ref-lat-edit", 0);
setprop("FMGC/internal/align-ref-long-edit", 1); setprop("FMGC/internal/align-ref-long-edit", 1);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "R6") { } else if (key == "R6") {
setprop("FMGC/internal/align-ref-lat-edit", 0); setprop("FMGC/internal/align-ref-lat-edit", 0);
@ -91,27 +91,11 @@ var initInputIRS = func(key, i) {
setprop("MCDU[" ~ i ~ "]/page", "INITA"); setprop("MCDU[" ~ i ~ "]/page", "INITA");
} }
} else if (getprop("FMGC/internal/tofrom-set") == 0) { } else if (getprop("FMGC/internal/tofrom-set") == 0) {
if (mcdu_scratchpad.scratchpads[i].scratchpad != "SELECT REFERENCE") { # setprop("MCDU[" ~ i ~ "]/scratchpad", "SELECT REFERENCE");
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
} else {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "SELECT REFERENCE");
} else if (getprop("systems/navigation/adr/any-adr-on") == 0) { } else if (getprop("systems/navigation/adr/any-adr-on") == 0) {
if (mcdu_scratchpad.scratchpads[i].scratchpad != "IRS NOT ALIGNED") { # setprop("MCDU[" ~ i ~ "]/scratchpad", "IRS NOT ALIGNED");
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
} else {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "IRS NOT ALIGNED");
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} }

View file

@ -120,8 +120,7 @@ var latRev = {
if (!dirToFlag) { if (!dirToFlag) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
} else { } else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
} }
me._checkTmpy(); me._checkTmpy();
} }
@ -129,14 +128,13 @@ var latRev = {
nextWpt: func() { nextWpt: func() {
me.makeTmpy(); me.makeTmpy();
var returny = fmgc.flightPlanController.scratchpad(getprop("/MCDU[" ~ me.computer ~ "]/scratchpad"), me.index + 1, me.computer); var returny = fmgc.flightPlanController.scratchpad(mcdu_scratchpad.scratchpads[me.computer].scratchpad, me.index + 1, me.computer);
if (returny == 0) { if (returny == 0) {
notInDataBase(me.computer); notInDataBase(me.computer);
} elsif (returny == 1) { } elsif (returny == 1) {
notAllowed(me.computer); mcdu_message(me.computer, "NOT ALLOWED");
} else { } else {
setprop("/MCDU[" ~ me.computer ~ "]/scratchpad-msg", ""); mcdu_scratchpad.scratchpads[me.computer].empty();
setprop("/MCDU[" ~ me.computer ~ "]/scratchpad", "");
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
if (getprop("/MCDU[" ~ me.computer ~ "]/page") != "DUPLICATENAMES") { if (getprop("/MCDU[" ~ me.computer ~ "]/page") != "DUPLICATENAMES") {
setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA");

View file

@ -5,21 +5,15 @@
var scratchpadNode = [nil, nil]; var scratchpadNode = [nil, nil];
var MCDU_init = func(i) { var MCDU_init = func(i) {
scratchpadNode = [props.globals.initNode("/MCDU[0]/scratchpad", "", "STRING"), props.globals.initNode("/MCDU[1]/scratchpad", "", "STRING")]; MCDU_reset(i);
MCDU_reset(i); # Reset MCDU, clears data
setprop("/MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM");
} }
var MCDU_reset = func(i) { var MCDU_reset = func(i) {
setprop("/MCDU[" ~ i ~ "]/active", 0); setprop("/MCDU[" ~ i ~ "]/active", 0);
setprop("it-autoflight/settings/togaspd", 157); #aka v2 clone setprop("it-autoflight/settings/togaspd", 157); #aka v2 clone
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", "");
setprop("/MCDU[" ~ i ~ "]/last-page", "NONE"); setprop("/MCDU[" ~ i ~ "]/last-page", "NONE");
setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", "STATUS"); setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", "STATUS");
setprop("/MCDU[" ~ i ~ "]/page", "MCDU"); setprop("/MCDU[" ~ i ~ "]/page", "MCDU");
mcdu.clearScratchpad(i);
setprop("/MCDU[" ~ i ~ "]/scratchpad-color", "wht");
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/FMGC/keyboard-left", 0); setprop("/FMGC/keyboard-left", 0);
setprop("/FMGC/keyboard-right", 0); setprop("/FMGC/keyboard-right", 0);
@ -197,19 +191,16 @@ var lskbutton = func(btn, i) {
if (btn == "1") { if (btn == "1") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "MCDU") { if (getprop("/MCDU[" ~ i ~ "]/page") == "MCDU") {
if (getprop("/MCDU[" ~ i ~ "]/active") != 2) { if (getprop("/MCDU[" ~ i ~ "]/active") != 2) {
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1); mcdu_message(i, "WAIT FOR SYSTEM RESPONSE");
setprop("/MCDU[" ~ i ~ "]/scratchpad", "WAIT FOR SYSTEM RESPONSE");
setprop("/MCDU[" ~ i ~ "]/active", 1); setprop("/MCDU[" ~ i ~ "]/active", 1);
settimer(func(){ settimer(func(){
setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-fmgc-page"));
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/active", 2); setprop("/MCDU[" ~ i ~ "]/active", 2);
}, 2); }, 2);
} else { } else {
setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-fmgc-page"));
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
} }
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") {
initInputIRS("L1",i); initInputIRS("L1",i);
@ -244,7 +235,7 @@ var lskbutton = func(btn, i) {
canvas_mcdu.myDeparture[i] = departurePage.new(canvas_mcdu.myLatRev[i].title[2], i); canvas_mcdu.myDeparture[i] = departurePage.new(canvas_mcdu.myLatRev[i].title[2], i);
setprop("/MCDU[" ~ i ~ "]/page", "DEPARTURE"); setprop("/MCDU[" ~ i ~ "]/page", "DEPARTURE");
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(1); canvas_mcdu.myFpln[i].pushButtonLeft(1);
@ -253,7 +244,7 @@ var lskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
canvas_mcdu.myDuplicate[i].pushButtonLeft(1); canvas_mcdu.myDuplicate[i].pushButtonLeft(1);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (btn == "2") { } else if (btn == "2") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") {
@ -287,7 +278,7 @@ var lskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
canvas_mcdu.myDuplicate[i].pushButtonLeft(2); canvas_mcdu.myDuplicate[i].pushButtonLeft(2);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (btn == "3") { } else if (btn == "3") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") {
@ -325,12 +316,12 @@ var lskbutton = func(btn, i) {
canvas_mcdu.myHold[i] = holdPage.new(i, canvas_mcdu.myLatRev[i].wpt); canvas_mcdu.myHold[i] = holdPage.new(i, canvas_mcdu.myLatRev[i].wpt);
setprop("/MCDU[" ~ i ~ "]/page", "HOLD"); setprop("/MCDU[" ~ i ~ "]/page", "HOLD");
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
canvas_mcdu.myDuplicate[i].pushButtonLeft(3); canvas_mcdu.myDuplicate[i].pushButtonLeft(3);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (btn == "4") { } else if (btn == "4") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA") { if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA") {
@ -358,7 +349,7 @@ var lskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
canvas_mcdu.myDuplicate[i].pushButtonLeft(4); canvas_mcdu.myDuplicate[i].pushButtonLeft(4);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (btn == "5") { } else if (btn == "5") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") {
@ -399,9 +390,9 @@ var lskbutton = func(btn, i) {
canvas_mcdu.myDuplicate[i].pushButtonLeft(5); canvas_mcdu.myDuplicate[i].pushButtonLeft(5);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "CLOSESTAIRPORT") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "CLOSESTAIRPORT") {
canvas_mcdu.myClosestAirport[i].manAirportCall(mcdu_scratchpad.scratchpads[i].scratchpad); canvas_mcdu.myClosestAirport[i].manAirportCall(mcdu_scratchpad.scratchpads[i].scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (btn == "6") { } else if (btn == "6") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") {
@ -441,7 +432,7 @@ var lskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "CLOSESTAIRPORT") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "CLOSESTAIRPORT") {
canvas_mcdu.myClosestAirport[i].freeze(); canvas_mcdu.myClosestAirport[i].freeze();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} }
@ -470,7 +461,7 @@ var rskbutton = func(btn, i) {
canvas_mcdu.myArrival[i]._setupPageWithData(); canvas_mcdu.myArrival[i]._setupPageWithData();
setprop("/MCDU[" ~ i ~ "]/page", "ARRIVAL"); setprop("/MCDU[" ~ i ~ "]/page", "ARRIVAL");
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(1); canvas_mcdu.myFpln[i].pushButtonRight(1);
@ -483,10 +474,10 @@ var rskbutton = func(btn, i) {
canvas_mcdu.myPilotWP[i] = pilotWaypointPage.new(i); canvas_mcdu.myPilotWP[i] = pilotWaypointPage.new(i);
setprop("/MCDU[" ~ i ~ "]/page", "PILOTWP"); setprop("/MCDU[" ~ i ~ "]/page", "PILOTWP");
} else { } else {
notAllowed(i); # todo spawn new waypoints page mcdu_message(i, "NOT ALLOWED"); # todo spawn new waypoints page
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (btn == "2") { } else if (btn == "2") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") {
@ -506,7 +497,7 @@ var rskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(2); canvas_mcdu.myFpln[i].pushButtonRight(2);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (btn == "3") { } else if (btn == "3") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") {
@ -531,12 +522,12 @@ var rskbutton = func(btn, i) {
if (canvas_mcdu.myLatRev[i].type != 2) { if (canvas_mcdu.myLatRev[i].type != 2) {
canvas_mcdu.myLatRev[i].nextWpt(); canvas_mcdu.myLatRev[i].nextWpt();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(3); canvas_mcdu.myFpln[i].pushButtonRight(3);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (btn == "4") { } else if (btn == "4") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") {
@ -556,7 +547,7 @@ var rskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(4); canvas_mcdu.myFpln[i].pushButtonRight(4);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (btn == "5") { } else if (btn == "5") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") {
@ -590,19 +581,18 @@ var rskbutton = func(btn, i) {
canvas_mcdu.myAirways[i] = airwaysPage.new(i, canvas_mcdu.myLatRev[i].wpt); canvas_mcdu.myAirways[i] = airwaysPage.new(i, canvas_mcdu.myLatRev[i].wpt);
setprop("/MCDU[" ~ i ~ "]/page", "AIRWAYS"); setprop("/MCDU[" ~ i ~ "]/page", "AIRWAYS");
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (btn == "6") { } else if (btn == "6") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "MCDU") { if (getprop("/MCDU[" ~ i ~ "]/page") == "MCDU") {
if (getprop("/MCDU[" ~ i ~ "]/last-page") != "NONE") { if (getprop("/MCDU[" ~ i ~ "]/last-page") != "NONE") {
setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-page")); setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-page"));
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") {
initInputA("R6",i); initInputA("R6",i);
@ -619,15 +609,7 @@ var rskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
perfAPPRInput("R6",i); perfAPPRInput("R6",i);
} else if ((getprop("/MCDU[" ~ i ~ "]/page") == "DATA") or (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") or (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2")) { } else if ((getprop("/MCDU[" ~ i ~ "]/page") == "DATA") or (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") or (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2")) {
if (mcdu_scratchpad.scratchpads[i].scratchpad != "AOC DISABLED") { mcdu_message(i, "AOC DISABLED");
if (getprop("/MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", "");
} else {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
}
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "AOC DISABLED");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") {
initInputA("R6",i); initInputA("R6",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
@ -647,7 +629,7 @@ var rskbutton = func(btn, i) {
} }
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} }
@ -769,7 +751,7 @@ var pagebutton = func(btn, i) {
} else if (btn == "mcdu") { } else if (btn == "mcdu") {
setprop("/MCDU[" ~ i ~ "]/last-page", getprop("/MCDU[" ~ i ~ "]/page")); setprop("/MCDU[" ~ i ~ "]/last-page", getprop("/MCDU[" ~ i ~ "]/page"));
setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", getprop("/MCDU[" ~ i ~ "]/page")); setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", getprop("/MCDU[" ~ i ~ "]/page"));
setprop("/MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM"); mcdu_message(i, "SELECT DESIRED SYSTEM");
setprop("/MCDU[" ~ i ~ "]/page", "MCDU"); setprop("/MCDU[" ~ i ~ "]/page", "MCDU");
} else if (btn == "f-pln" or btn == "airport") { } else if (btn == "f-pln" or btn == "airport") {
if (canvas_mcdu.myFpln[i] == nil) { if (canvas_mcdu.myFpln[i] == nil) {
@ -794,8 +776,7 @@ var pagebutton = func(btn, i) {
setprop("/MCDU[" ~ i ~ "]/page", "FUELPRED"); setprop("/MCDU[" ~ i ~ "]/page", "FUELPRED");
} else if (btn == "dirto") { } else if (btn == "dirto") {
if (fmgc.flightPlanController.temporaryFlag[i] and !dirToFlag) { if (fmgc.flightPlanController.temporaryFlag[i] and !dirToFlag) {
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1); mcdu_message(i, "INSERT/ERASE TMPY FIRST");
setprop("/MCDU[" ~ i ~ "]/scratchpad", "INSRT / ERASE TMPY FIRST");
return; return;
} elsif (canvas_mcdu.myDirTo[i] == nil) { } elsif (canvas_mcdu.myDirTo[i] == nil) {
canvas_mcdu.myDirTo[i] = dirTo.new(i); canvas_mcdu.myDirTo[i] = dirTo.new(i);
@ -806,94 +787,31 @@ var pagebutton = func(btn, i) {
} }
var button = func(btn, i) { var button = func(btn, i) {
if (getprop("/MCDU[" ~ i ~ "]/scratchpad-msg") == 0 and getprop("/MCDU[" ~ i ~ "]/page") != "MCDU") { if (getprop("/MCDU[" ~ i ~ "]/page") != "MCDU") {
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (btn == "SLASH") { if (btn == "SLASH") {
setprop("/MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "/"); mcdu_scratchpad.scratchpads[i].addChar("/");
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
} else if (btn == "SP") { } else if (btn == "SP") {
setprop("/MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ " "); mcdu_scratchpad.scratchpads[i].addChar(" ");
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
} else if (btn == "CLR") { } else if (btn == "CLR") {
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (size(scratchpad) == 0) { if (size(scratchpad) == 0) {
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1); mcdu_scratchpad.scratchpads[i].addChar("CLR");
setprop("/MCDU[" ~ i ~ "]/scratchpad", "CLR"); } else {
} else if (getprop("/MCDU[" ~ i ~ "]/scratchpad-msg") == 1) { mcdu_scratchpad.scratchpads[i].clear();
mcdu.clearScratchpad(i);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
} else if (size(scratchpad) > 0) {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", "");
setprop("/MCDU[" ~ i ~ "]/scratchpad", left(scratchpad, size(scratchpad) - 1));
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
} }
} else if (btn == "DOT") { } else if (btn == "DOT") {
setprop("/MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "."); mcdu_scratchpad.scratchpads[i].addChar(".");
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
} else if (btn == "PLUSMINUS") { } else if (btn == "PLUSMINUS") {
setprop("/MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "-"); mcdu_scratchpad.scratchpads[i].addChar("-");
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
} else { } else {
setprop("/MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ btn); mcdu_scratchpad.scratchpads[i].addChar(btn);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
}
} else {
if (btn == "CLR") {
setprop("/MCDU[" ~ i ~ "]/scratchpad-color", "wht");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (size(scratchpad) == 0) {
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "CLR");
} else if (getprop("/MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("/MCDU[" ~ i ~ "]/scratchpad", getprop("/MCDU[" ~ i ~ "]/last-scratchpad"));
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", "");
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
}
} }
} }
} }
var genericMessage = func(i, text, color) { var mcdu_message = func(i, string) {
if (mcdu_scratchpad.scratchpads[i].scratchpad != text) { mcdu_scratchpad.scratchpads[i].showTypeI(mcdu_scratchpad.MessageController.getTypeIMsgByText(string));
if (getprop("/MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", "");
} else {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[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 (mcdu_scratchpad.scratchpads[i].scratchpad != "NOT ALLOWED") {
if (getprop("/MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", "");
} else {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
}
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "NOT ALLOWED");
}
var formatError = func(i) {
setprop("/MCDU[" ~ i ~ "]/scratchpad-color", "wht");
if (mcdu_scratchpad.scratchpads[i].scratchpad != "FORMAT ERROR") {
if (getprop("/MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", "");
} else {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
}
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "FORMAT ERROR");
}
var clearScratchpad = func(i) {
scratchpadNode[i].setValue("");
} }
var screenFlash = func(time, i) { var screenFlash = func(time, i) {

View file

@ -9,33 +9,30 @@ var perfAPPRInput = func(key, i) {
if (key == "L1") { if (key == "L1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/dest-qnh", -1); setprop("/FMGC/internal/dest-qnh", -1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (num(scratchpad) != nil and (scratchpad >= 28.06 and scratchpad <= 31.01) or (scratchpad >= 745 and scratchpad <= 1050)) { } else if (num(scratchpad) != nil and (scratchpad >= 28.06 and scratchpad <= 31.01) or (scratchpad >= 745 and scratchpad <= 1050)) {
# doesn't support accidental temp input yet # doesn't support accidental temp input yet
setprop("/FMGC/internal/dest-qnh", scratchpad); setprop("/FMGC/internal/dest-qnh", scratchpad);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L2") { } else if (key == "L2") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/dest-temp", -999); setprop("/FMGC/internal/dest-temp", -999);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (num(scratchpad) != nil and scratchpad >= -99 and scratchpad < 99) { } else if (num(scratchpad) != nil and scratchpad >= -99 and scratchpad < 99) {
setprop("/FMGC/internal/dest-temp", scratchpad); setprop("/FMGC/internal/dest-temp", scratchpad);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L3") { } else if (key == "L3") {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/dest-mag", -1); setprop("/FMGC/internal/dest-mag", -1);
setprop("/FMGC/internal/dest-wind", -1); setprop("/FMGC/internal/dest-wind", -1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (tfs >= 3 and tfs <= 7 and find("/", scratchpad) != -1) { } else if (tfs >= 3 and tfs <= 7 and find("/", scratchpad) != -1) {
var weather = split("/", scratchpad); var weather = split("/", scratchpad);
var mag = int(weather[0]); var mag = int(weather[0]);
@ -46,96 +43,92 @@ var perfAPPRInput = func(key, i) {
if (mag != nil and wind != nil and mag >= 0 and mag <= 360 and wind >= 0 and wind <= 200) { if (mag != nil and wind != nil and mag >= 0 and mag <= 360 and wind >= 0 and wind <= 200) {
setprop("/FMGC/internal/dest-mag", weather[0]); setprop("/FMGC/internal/dest-mag", weather[0]);
setprop("/FMGC/internal/dest-wind", weather[1]); setprop("/FMGC/internal/dest-wind", weather[1]);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
fmgc.updateARPT(); fmgc.updateARPT();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L4") { } else if (key == "L4") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
fmgc.FMGCInternal.transAlt = 18000; fmgc.FMGCInternal.transAlt = 18000;
fmgc.FMGCInternal.transAltSet = 0; fmgc.FMGCInternal.transAltSet = 0;
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (int(scratchpad) != nil and (tfs == 4 or tfs == 5) and scratchpad >= 1000 and scratchpad <= 39000) { if (int(scratchpad) != nil and (tfs == 4 or tfs == 5) and scratchpad >= 1000 and scratchpad <= 39000) {
fmgc.FMGCInternal.transAlt = math.round(scratchpad, 500); fmgc.FMGCInternal.transAlt = math.round(scratchpad, 500);
fmgc.FMGCInternal.transAltSet = 1; fmgc.FMGCInternal.transAltSet = 1;
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} elsif (int(scratchpad) != nil and (tfs == 2 or tfs == 3) and scratchpad >= 10 and scratchpad <= 390) { } elsif (int(scratchpad) != nil and (tfs == 2 or tfs == 3) and scratchpad >= 10 and scratchpad <= 390) {
fmgc.FMGCInternal.transAlt = math.round(scratchpad * 100, 5); fmgc.FMGCInternal.transAlt = math.round(scratchpad * 100, 5);
fmgc.FMGCInternal.transAltSet = 1; fmgc.FMGCInternal.transAltSet = 1;
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L5") { } else if (key == "L5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/vapp-speed-set", 0); setprop("/FMGC/internal/vapp-speed-set", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { } else if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("/FMGC/internal/vapp-speed-set", 1); setprop("/FMGC/internal/vapp-speed-set", 1);
setprop("/FMGC/internal/computed-speeds/vapp_appr", scratchpad); setprop("/FMGC/internal/computed-speeds/vapp_appr", scratchpad);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L6") { } else if (key == "L6") {
setprop("/MCDU[" ~ i ~ "]/page", "PERFDES"); setprop("/MCDU[" ~ i ~ "]/page", "PERFDES");
} else if (key == "R2") { } else if (key == "R2") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/baro", 99999); setprop("/FMGC/internal/baro", 99999);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil and scratchpad >= getprop("/FMGC/internal/ldg-elev") and scratchpad <= 5000 + getprop("/FMGC/internal/ldg-elev")) { } else if (int(scratchpad) != nil and scratchpad >= getprop("/FMGC/internal/ldg-elev") and scratchpad <= 5000 + getprop("/FMGC/internal/ldg-elev")) {
if (getprop("/FMGC/internal/radio-no") == 0) { if (getprop("/FMGC/internal/radio-no") == 0) {
setprop("/FMGC/internal/radio", 99999); setprop("/FMGC/internal/radio", 99999);
} }
setprop("/FMGC/internal/baro", scratchpad); setprop("/FMGC/internal/baro", scratchpad);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "R3") { } else if (key == "R3") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/radio", 99999); setprop("/FMGC/internal/radio", 99999);
setprop("/FMGC/internal/radio-no", 0); setprop("/FMGC/internal/radio-no", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (scratchpad == "NO") { } else if (scratchpad == "NO") {
setprop("/FMGC/internal/radio", 99999); setprop("/FMGC/internal/radio", 99999);
setprop("/FMGC/internal/radio-no", 1); setprop("/FMGC/internal/radio-no", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 700) { } else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 700) {
setprop("/FMGC/internal/baro", 99999); setprop("/FMGC/internal/baro", 99999);
setprop("/FMGC/internal/radio-no", 0); setprop("/FMGC/internal/radio-no", 0);
setprop("/FMGC/internal/radio", scratchpad); setprop("/FMGC/internal/radio", scratchpad);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "R4") { } else if (key == "R4") {
if (scratchpad == "" and ldg_config_f_set.getValue() == 1 and ldg_config_3_set.getValue() == 0) { if (scratchpad == "" and ldg_config_f_set.getValue() == 1 and ldg_config_3_set.getValue() == 0) {
setprop("/FMGC/internal/ldg-config-3-set", 1); setprop("/FMGC/internal/ldg-config-3-set", 1);
setprop("/FMGC/internal/ldg-config-f-set", 0); setprop("/FMGC/internal/ldg-config-f-set", 0);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "R5") { } else if (key == "R5") {
if (scratchpad == "" and ldg_config_3_set.getValue() == 1 and ldg_config_f_set.getValue() == 0) { if (scratchpad == "" and ldg_config_3_set.getValue() == 1 and ldg_config_f_set.getValue() == 0) {
setprop("/FMGC/internal/ldg-config-3-set", 0); setprop("/FMGC/internal/ldg-config-3-set", 0);
setprop("/FMGC/internal/ldg-config-f-set", 1); setprop("/FMGC/internal/ldg-config-f-set", 1);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "R6") { } else if (key == "R6") {
setprop("/MCDU[" ~ i ~ "]/page", "PERFGA"); setprop("/MCDU[" ~ i ~ "]/page", "PERFGA");

View file

@ -8,8 +8,7 @@ var perfCLBInput = func(key, i) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0); setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var ci = int(scratchpad); var ci = int(scratchpad);
var cis = size(scratchpad); var cis = size(scratchpad);
@ -17,20 +16,19 @@ var perfCLBInput = func(key, i) {
if (ci != nil and ci >= 0 and ci <= 999) { if (ci != nil and ci >= 0 and ci <= 999) {
setprop("/FMGC/internal/cost-index", ci); setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1); setprop("/FMGC/internal/cost-index-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L5") { } else if (key == "L5") {
if (getprop("/FMGC/status/phase") == 2) { if (getprop("/FMGC/status/phase") == 2) {
setprop("MCDU[" ~ i ~ "]/page", "PERFTO"); setprop("MCDU[" ~ i ~ "]/page", "PERFTO");
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L6") { } else if (key == "L6") {
if (getprop("/FMGC/status/phase") == 2) { if (getprop("/FMGC/status/phase") == 2) {
@ -41,7 +39,7 @@ var perfCLBInput = func(key, i) {
setprop("/FMGC/internal/decel", 1); setprop("/FMGC/internal/decel", 1);
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
setprop("/FMGC/internal/activate-once", 1); setprop("/FMGC/internal/activate-once", 1);

View file

@ -8,8 +8,7 @@ var perfCRZInput = func(key, i) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0); setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var ci = int(scratchpad); var ci = int(scratchpad);
var cis = size(scratchpad); var cis = size(scratchpad);
@ -17,12 +16,12 @@ var perfCRZInput = func(key, i) {
if (ci != nil and ci >= 0 and ci <= 999) { if (ci != nil and ci >= 0 and ci <= 999) {
setprop("/FMGC/internal/cost-index", ci); setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1); setprop("/FMGC/internal/cost-index-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L6") { } else if (key == "L6") {
@ -34,7 +33,7 @@ var perfCRZInput = func(key, i) {
setprop("/FMGC/internal/decel", 1); setprop("/FMGC/internal/decel", 1);
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
setprop("/FMGC/internal/activate-once", 1); setprop("/FMGC/internal/activate-once", 1);

View file

@ -8,8 +8,7 @@ var perfDESInput = func(key, i) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0); setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var ci = int(scratchpad); var ci = int(scratchpad);
var cis = size(scratchpad); var cis = size(scratchpad);
@ -17,12 +16,12 @@ var perfDESInput = func(key, i) {
if (ci != nil and ci >= 0 and ci <= 999) { if (ci != nil and ci >= 0 and ci <= 999) {
setprop("/FMGC/internal/cost-index", ci); setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1); setprop("/FMGC/internal/cost-index-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L6") { } else if (key == "L6") {
@ -34,7 +33,7 @@ var perfDESInput = func(key, i) {
setprop("/FMGC/internal/decel", 1); setprop("/FMGC/internal/decel", 1);
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
setprop("/FMGC/internal/activate-once", 1); setprop("/FMGC/internal/activate-once", 1);

View file

@ -9,8 +9,7 @@ var perfGAInput = func(key, i) {
setprop("systems/thrust/clbreduc-ft", "1500"); setprop("systems/thrust/clbreduc-ft", "1500");
setprop("/FMGC/internal/accel-agl-ft", "1500"); setprop("/FMGC/internal/accel-agl-ft", "1500");
setprop("MCDUC/thracc-set", 0); setprop("MCDUC/thracc-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 7 and tfs <= 9 and find("/", scratchpad) != -1) { if (tfs >= 7 and tfs <= 9 and find("/", scratchpad) != -1) {
@ -21,12 +20,12 @@ var perfGAInput = func(key, i) {
setprop("systems/thrust/clbreduc-ft", thracc[0]); setprop("systems/thrust/clbreduc-ft", thracc[0]);
setprop("/FMGC/internal/accel-agl-ft", thracc[1]); setprop("/FMGC/internal/accel-agl-ft", thracc[1]);
setprop("MCDUC/thracc-set", 1); setprop("MCDUC/thracc-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L6") { } else if (key == "L6") {
@ -35,16 +34,15 @@ var perfGAInput = func(key, i) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/eng-out-reduc", "1500"); setprop("/FMGC/internal/eng-out-reduc", "1500");
setprop("MCDUC/reducacc-set", 0); setprop("MCDUC/reducacc-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (int(scratchpad) != nil and tfs >= 3 and tfs <= 5) { if (int(scratchpad) != nil and tfs >= 3 and tfs <= 5) {
setprop("/FMGC/internal/eng-out-reduc", scratchpad); setprop("/FMGC/internal/eng-out-reduc", scratchpad);
setprop("MCDUC/reducacc-set", 1); setprop("MCDUC/reducacc-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} }

View file

@ -10,49 +10,46 @@ var perfTOInput = func(key, i) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/v1", 0); setprop("/FMGC/internal/v1", 0);
setprop("/FMGC/internal/v1-set", 0); setprop("/FMGC/internal/v1-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3) { if (tfs == 3) {
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("/FMGC/internal/v1", scratchpad); setprop("/FMGC/internal/v1", scratchpad);
setprop("/FMGC/internal/v1-set", 1); setprop("/FMGC/internal/v1-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L2") { } else if (key == "L2") {
if (getprop("/FMGC/status/phase") != 1) { if (getprop("/FMGC/status/phase") != 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/vr", 0); setprop("/FMGC/internal/vr", 0);
setprop("/FMGC/internal/vr-set", 0); setprop("/FMGC/internal/vr-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3) { if (tfs == 3) {
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("/FMGC/internal/vr", scratchpad); setprop("/FMGC/internal/vr", scratchpad);
setprop("/FMGC/internal/vr-set", 1); setprop("/FMGC/internal/vr-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L3") { } else if (key == "L3") {
if (getprop("/FMGC/status/phase") != 1) { if (getprop("/FMGC/status/phase") != 1) {
@ -60,8 +57,7 @@ var perfTOInput = func(key, i) {
setprop("/FMGC/internal/v2", 0); setprop("/FMGC/internal/v2", 0);
setprop("/FMGC/internal/v2-set", 0); setprop("/FMGC/internal/v2-set", 0);
setprop("it-autoflight/settings/togaspd", 157); setprop("it-autoflight/settings/togaspd", 157);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3) { if (tfs == 3) {
@ -69,31 +65,30 @@ var perfTOInput = func(key, i) {
setprop("/FMGC/internal/v2", scratchpad); setprop("/FMGC/internal/v2", scratchpad);
setprop("/FMGC/internal/v2-set", 1); setprop("/FMGC/internal/v2-set", 1);
setprop("it-autoflight/settings/togaspd", scratchpad); setprop("it-autoflight/settings/togaspd", scratchpad);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "L4") { } else if (key == "L4") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
fmgc.FMGCInternal.transAlt = 18000; fmgc.FMGCInternal.transAlt = 18000;
fmgc.FMGCInternal.transAltSet = 0; fmgc.FMGCInternal.transAltSet = 0;
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (int(scratchpad) != nil and (tfs == 4 or tfs <= 5) and scratchpad >= 1000 and scratchpad <= 39000) { if (int(scratchpad) != nil and (tfs == 4 or tfs <= 5) and scratchpad >= 1000 and scratchpad <= 39000) {
fmgc.FMGCInternal.transAlt = int(scratchpad / 10) * 10; fmgc.FMGCInternal.transAlt = int(scratchpad / 10) * 10;
fmgc.FMGCInternal.transAltSet = 1; fmgc.FMGCInternal.transAltSet = 1;
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L5") { } else if (key == "L5") {
@ -101,8 +96,7 @@ var perfTOInput = func(key, i) {
setprop("systems/thrust/clbreduc-ft", "1500"); setprop("systems/thrust/clbreduc-ft", "1500");
setprop("/FMGC/internal/accel-agl-ft", "1500"); setprop("/FMGC/internal/accel-agl-ft", "1500");
setprop("MCDUC/thracc-set", 0); setprop("MCDUC/thracc-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (find("/", scratchpad) != -1) { if (find("/", scratchpad) != -1) {
@ -115,18 +109,18 @@ var perfTOInput = func(key, i) {
setprop("systems/thrust/clbreduc-ft", int(thrred / 10) * 10); setprop("systems/thrust/clbreduc-ft", int(thrred / 10) * 10);
setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10);
setprop("MCDUC/thracc-set", 1); setprop("MCDUC/thracc-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else if (thrreds == 0 and int(acc) != nil and (accs >= 3 and accs <= 5) and acc >= 400 and acc <= 39000) { } else if (thrreds == 0 and int(acc) != nil and (accs >= 3 and accs <= 5) and acc >= 400 and acc <= 39000) {
setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (num(scratchpad) != nil and (tfs >= 3 and tfs <= 5) and scratchpad >= 400 and scratchpad <= 39000) { } else if (num(scratchpad) != nil and (tfs >= 3 and tfs <= 5) and scratchpad >= 400 and scratchpad <= 39000) {
setprop("systems/thrust/clbreduc-ft", int(scratchpad / 10) * 10); setprop("systems/thrust/clbreduc-ft", int(scratchpad / 10) * 10);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R3") { } else if (key == "R3") {
@ -134,8 +128,7 @@ var perfTOInput = func(key, i) {
setprop("/FMGC/internal/to-flap", 0); setprop("/FMGC/internal/to-flap", 0);
setprop("/FMGC/internal/to-ths", "0.0"); setprop("/FMGC/internal/to-ths", "0.0");
setprop("/FMGC/internal/flap-ths-set", 0); setprop("/FMGC/internal/flap-ths-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
if (find("/", scratchpad) != -1) { if (find("/", scratchpad) != -1) {
var flapths = split("/", scratchpad); var flapths = split("/", scratchpad);
@ -150,62 +143,61 @@ var perfTOInput = func(key, i) {
if (flaps == 0 and getprop("/FMGC/internal/flap-ths-set")) { if (flaps == 0 and getprop("/FMGC/internal/flap-ths-set")) {
if (trims == 5 and find("DN", trim) != -1 and validtrima) { if (trims == 5 and find("DN", trim) != -1 and validtrima) {
setprop("/FMGC/internal/to-ths", -1 * trima); setprop("/FMGC/internal/to-ths", -1 * trima);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else if (trims == 5 and find("DN", trim) != -1 and validtrimb) { } else if (trims == 5 and find("DN", trim) != -1 and validtrimb) {
setprop("/FMGC/internal/to-ths", -1 * trimb); setprop("/FMGC/internal/to-ths", -1 * trimb);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else if (trims == 5 and find("UP", trim) != -1 and validtrima) { } else if (trims == 5 and find("UP", trim) != -1 and validtrima) {
setprop("/FMGC/internal/to-ths", trima); setprop("/FMGC/internal/to-ths", trima);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else if (trims == 5 and find("UP", trim) != -1 and validtrimb) { } else if (trims == 5 and find("UP", trim) != -1 and validtrimb) {
setprop("/FMGC/internal/to-ths", trimb); setprop("/FMGC/internal/to-ths", trimb);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (flaps == 1 and num(flap) != nil and flap >= 0 and flap <= 3) { } else if (flaps == 1 and num(flap) != nil and flap >= 0 and flap <= 3) {
if (trims == 5 and find("DN", trim) != -1 and validtrima) { if (trims == 5 and find("DN", trim) != -1 and validtrima) {
setprop("/FMGC/internal/to-flap", flap); setprop("/FMGC/internal/to-flap", flap);
setprop("/FMGC/internal/to-ths", -1 * trima); setprop("/FMGC/internal/to-ths", -1 * trima);
setprop("/FMGC/internal/flap-ths-set", 1); setprop("/FMGC/internal/flap-ths-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else if (trims == 5 and find("DN", trim) != -1 and validtrimb) { } else if (trims == 5 and find("DN", trim) != -1 and validtrimb) {
setprop("/FMGC/internal/to-flap", flap); setprop("/FMGC/internal/to-flap", flap);
setprop("/FMGC/internal/to-ths", -1 * trimb); setprop("/FMGC/internal/to-ths", -1 * trimb);
setprop("/FMGC/internal/flap-ths-set", 1); setprop("/FMGC/internal/flap-ths-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else if (trims == 5 and find("UP", trim) != -1 and validtrima) { } else if (trims == 5 and find("UP", trim) != -1 and validtrima) {
setprop("/FMGC/internal/to-flap", flap); setprop("/FMGC/internal/to-flap", flap);
setprop("/FMGC/internal/to-ths", trima); setprop("/FMGC/internal/to-ths", trima);
setprop("/FMGC/internal/flap-ths-set", 1); setprop("/FMGC/internal/flap-ths-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else if (trims == 5 and find("UP", trim) != -1 and validtrimb) { } else if (trims == 5 and find("UP", trim) != -1 and validtrimb) {
setprop("/FMGC/internal/to-flap", flap); setprop("/FMGC/internal/to-flap", flap);
setprop("/FMGC/internal/to-ths", trimb); setprop("/FMGC/internal/to-ths", trimb);
setprop("/FMGC/internal/flap-ths-set", 1); setprop("/FMGC/internal/flap-ths-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else if (size(scratchpad) == 1 and num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 3) { } else if (size(scratchpad) == 1 and num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 3) {
setprop("/FMGC/internal/to-flap", scratchpad); setprop("/FMGC/internal/to-flap", scratchpad);
if (!getprop("/FMGC/internal/flap-ths-set")) { if (!getprop("/FMGC/internal/flap-ths-set")) {
setprop("/FMGC/internal/flap-ths-set", 1); setprop("/FMGC/internal/flap-ths-set", 1);
} }
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R4") { } else if (key == "R4") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/flex", 0); setprop("/FMGC/internal/flex", 0);
setprop("/FMGC/internal/flex-set", 0); setprop("/FMGC/internal/flex-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 1 or tfs == 2) { if (tfs == 1 or tfs == 2) {
@ -214,28 +206,27 @@ var perfTOInput = func(key, i) {
setprop("/FMGC/internal/flex-set", 1); setprop("/FMGC/internal/flex-set", 1);
var flex_calc = getprop("/FMGC/internal/flex") - getprop("environment/temperature-degc"); var flex_calc = getprop("/FMGC/internal/flex") - getprop("environment/temperature-degc");
setprop("/FMGC/internal/flex-cmd", flex_calc); setprop("/FMGC/internal/flex-cmd", flex_calc);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R5") { } else if (key == "R5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/eng-out-reduc", "1500"); setprop("/FMGC/internal/eng-out-reduc", "1500");
setprop("MCDUC/reducacc-set", 0); setprop("MCDUC/reducacc-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (int(scratchpad) != nil and (tfs == 4 or tfs == 5) and scratchpad >= 1000 and scratchpad <= 39000) { if (int(scratchpad) != nil and (tfs == 4 or tfs == 5) and scratchpad >= 1000 and scratchpad <= 39000) {
setprop("/FMGC/internal/eng-out-reduc", scratchpad); setprop("/FMGC/internal/eng-out-reduc", scratchpad);
setprop("MCDUC/reducacc-set", 1); setprop("MCDUC/reducacc-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R6") { } else if (key == "R6") {

View file

@ -11,13 +11,12 @@ var progCLBInput = func(key, i) {
setprop("/FMGC/internal/activate-twice", 0); setprop("/FMGC/internal/activate-twice", 0);
setprop("/FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil) { } else if (int(scratchpad) != nil) {
var crzs = size(scratchpad); var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
setprop("/FMGC/internal/cruise-fl-prog", scratchpad); setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
if (getprop("/FMGC/status/phase") == 5) { if (getprop("/FMGC/status/phase") == 5) {
setprop("/FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("/FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
@ -25,10 +24,10 @@ var progCLBInput = func(key, i) {
setprop("/FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} }

View file

@ -11,13 +11,12 @@ var progCRZInput = func(key, i) {
setprop("/FMGC/internal/activate-twice", 0); setprop("/FMGC/internal/activate-twice", 0);
setprop("/FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil) { } else if (int(scratchpad) != nil) {
var crzs = size(scratchpad); var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
setprop("/FMGC/internal/cruise-fl-prog", scratchpad); setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
if (getprop("/FMGC/status/phase") == 5) { if (getprop("/FMGC/status/phase") == 5) {
setprop("/FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("/FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
@ -25,10 +24,10 @@ var progCRZInput = func(key, i) {
setprop("/FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} }

View file

@ -11,13 +11,12 @@ var progDESInput = func(key, i) {
setprop("/FMGC/internal/activate-twice", 0); setprop("/FMGC/internal/activate-twice", 0);
setprop("/FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil) { } else if (int(scratchpad) != nil) {
var crzs = size(scratchpad); var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
setprop("/FMGC/internal/cruise-fl-prog", scratchpad); setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) { if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) {
setprop("/FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("/FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
@ -25,10 +24,10 @@ var progDESInput = func(key, i) {
setprop("/FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} }

View file

@ -7,18 +7,17 @@ var progTOInput = func(key, i) {
if (key == "L1") { if (key == "L1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl")); setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil) { } else if (int(scratchpad) != nil) {
var crzs = size(scratchpad); var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100 and getprop("/FMGC/internal/cruise-lvl-set")) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100 and getprop("/FMGC/internal/cruise-lvl-set")) {
setprop("/FMGC/internal/cruise-fl-prog", scratchpad); setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} }

View file

@ -7,8 +7,7 @@ var radnavInput = func(key, i) {
if (key == "L1") { if (key == "L1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/vor1freq-set", 0); setprop("/FMGC/internal/vor1freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3 or tfs == 5 or tfs == 6) { if (tfs == 3 or tfs == 5 or tfs == 6) {
@ -17,47 +16,45 @@ var radnavInput = func(key, i) {
or scratchpad == 109.10 or scratchpad == 109.15 or scratchpad == 109.30 or scratchpad == 109.35 or scratchpad == 109.50 or scratchpad == 109.55 or scratchpad == 109.70 or scratchpad == 109.75 or scratchpad == 109.90 or scratchpad == 109.95 or scratchpad == 109.10 or scratchpad == 109.15 or scratchpad == 109.30 or scratchpad == 109.35 or scratchpad == 109.50 or scratchpad == 109.55 or scratchpad == 109.70 or scratchpad == 109.75 or scratchpad == 109.90 or scratchpad == 109.95
or scratchpad == 110.10 or scratchpad == 110.15 or scratchpad == 110.30 or scratchpad == 110.35 or scratchpad == 110.50 or scratchpad == 110.55 or scratchpad == 110.70 or scratchpad == 110.75 or scratchpad == 110.90 or scratchpad == 110.95 or scratchpad == 110.10 or scratchpad == 110.15 or scratchpad == 110.30 or scratchpad == 110.35 or scratchpad == 110.50 or scratchpad == 110.55 or scratchpad == 110.70 or scratchpad == 110.75 or scratchpad == 110.90 or scratchpad == 110.95
or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) { or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} else { } else {
setprop("instrumentation/nav[2]/frequencies/selected-mhz", scratchpad); setprop("instrumentation/nav[2]/frequencies/selected-mhz", scratchpad);
setprop("/FMGC/internal/vor1freq-set", 1); setprop("/FMGC/internal/vor1freq-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} }
} else if (scratchpad >= 112.00 and scratchpad <= 117.95) { } else if (scratchpad >= 112.00 and scratchpad <= 117.95) {
setprop("instrumentation/nav[2]/frequencies/selected-mhz", scratchpad); setprop("instrumentation/nav[2]/frequencies/selected-mhz", scratchpad);
setprop("/FMGC/internal/vor1freq-set", 1); setprop("/FMGC/internal/vor1freq-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L2") { } else if (key == "L2") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/vor1crs-set", 0); setprop("/FMGC/internal/vor1crs-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 3) { if (tfs >= 1 and tfs <= 3) {
if (scratchpad >= 0 and scratchpad <= 360) { if (scratchpad >= 0 and scratchpad <= 360) {
setprop("instrumentation/nav[2]/radials/selected-deg", scratchpad); setprop("instrumentation/nav[2]/radials/selected-deg", scratchpad);
setprop("/FMGC/internal/vor1crs-set", 1); setprop("/FMGC/internal/vor1crs-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L3") { } else if (key == "L3") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/ils1freq-set", 0); setprop("/FMGC/internal/ils1freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3 or tfs == 5 or tfs == 6) { if (tfs == 3 or tfs == 5 or tfs == 6) {
@ -68,63 +65,60 @@ var radnavInput = func(key, i) {
or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) { or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) {
setprop("instrumentation/nav[0]/frequencies/selected-mhz", scratchpad); setprop("instrumentation/nav[0]/frequencies/selected-mhz", scratchpad);
setprop("/FMGC/internal/ils1freq-set", 1); setprop("/FMGC/internal/ils1freq-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
if (num(getprop("/FMGC/internal/ils1freq-calculated")) != 0 and num(getprop("/FMGC/internal/ils1freq-calculated")) != num(getprop("instrumentation/nav[0]/frequencies/selected-mhz"))) { 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"); genericMessage(i, "RWY/LS MISMATCH", "amb");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L4") { } else if (key == "L4") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/ils1crs-set", 0); setprop("/FMGC/internal/ils1crs-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 3) { if (tfs >= 1 and tfs <= 3) {
if (scratchpad >= 0 and scratchpad <= 360) { if (scratchpad >= 0 and scratchpad <= 360) {
setprop("instrumentation/nav[0]/radials/selected-deg", scratchpad); setprop("instrumentation/nav[0]/radials/selected-deg", scratchpad);
setprop("/FMGC/internal/ils1crs-set", 1); setprop("/FMGC/internal/ils1crs-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "L5") { } else if (key == "L5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/adf1freq-set", 0); setprop("/FMGC/internal/adf1freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3 or tfs == 4) { if (tfs == 3 or tfs == 4) {
if (scratchpad >= 190 and scratchpad <= 1750) { if (scratchpad >= 190 and scratchpad <= 1750) {
setprop("instrumentation/adf[0]/frequencies/selected-khz", scratchpad); setprop("instrumentation/adf[0]/frequencies/selected-khz", scratchpad);
setprop("/FMGC/internal/adf1freq-set", 1); setprop("/FMGC/internal/adf1freq-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R1") { } else if (key == "R1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/vor2freq-set", 0); setprop("/FMGC/internal/vor2freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3 or tfs == 5 or tfs == 6) { if (tfs == 3 or tfs == 5 or tfs == 6) {
@ -133,59 +127,57 @@ var radnavInput = func(key, i) {
or scratchpad == 109.10 or scratchpad == 109.15 or scratchpad == 109.30 or scratchpad == 109.35 or scratchpad == 109.50 or scratchpad == 109.55 or scratchpad == 109.70 or scratchpad == 109.75 or scratchpad == 109.90 or scratchpad == 109.95 or scratchpad == 109.10 or scratchpad == 109.15 or scratchpad == 109.30 or scratchpad == 109.35 or scratchpad == 109.50 or scratchpad == 109.55 or scratchpad == 109.70 or scratchpad == 109.75 or scratchpad == 109.90 or scratchpad == 109.95
or scratchpad == 110.10 or scratchpad == 110.15 or scratchpad == 110.30 or scratchpad == 110.35 or scratchpad == 110.50 or scratchpad == 110.55 or scratchpad == 110.70 or scratchpad == 110.75 or scratchpad == 110.90 or scratchpad == 110.95 or scratchpad == 110.10 or scratchpad == 110.15 or scratchpad == 110.30 or scratchpad == 110.35 or scratchpad == 110.50 or scratchpad == 110.55 or scratchpad == 110.70 or scratchpad == 110.75 or scratchpad == 110.90 or scratchpad == 110.95
or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) { or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} else { } else {
setprop("instrumentation/nav[3]/frequencies/selected-mhz", scratchpad); setprop("instrumentation/nav[3]/frequencies/selected-mhz", scratchpad);
setprop("/FMGC/internal/vor2freq-set", 1); setprop("/FMGC/internal/vor2freq-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} }
} else if (scratchpad >= 112.00 and scratchpad <= 117.95) { } else if (scratchpad >= 112.00 and scratchpad <= 117.95) {
setprop("instrumentation/nav[3]/frequencies/selected-mhz", scratchpad); setprop("instrumentation/nav[3]/frequencies/selected-mhz", scratchpad);
setprop("/FMGC/internal/vor2freq-set", 1); setprop("/FMGC/internal/vor2freq-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R2") { } else if (key == "R2") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/vor2crs-set", 0); setprop("/FMGC/internal/vor2crs-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 3) { if (tfs >= 1 and tfs <= 3) {
if (scratchpad >= 0 and scratchpad <= 360) { if (scratchpad >= 0 and scratchpad <= 360) {
setprop("instrumentation/nav[3]/radials/selected-deg", scratchpad); setprop("instrumentation/nav[3]/radials/selected-deg", scratchpad);
setprop("/FMGC/internal/vor2crs-set", 1); setprop("/FMGC/internal/vor2crs-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} else if (key == "R5") { } else if (key == "R5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/adf2freq-set", 0); setprop("/FMGC/internal/adf2freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); mcdu_scratchpad.scratchpads[i].empty();
mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3 or tfs == 4) { if (tfs == 3 or tfs == 4) {
if (scratchpad >= 190 and scratchpad <= 1750) { if (scratchpad >= 190 and scratchpad <= 1750) {
setprop("instrumentation/adf[1]/frequencies/selected-khz", scratchpad); setprop("instrumentation/adf[1]/frequencies/selected-khz", scratchpad);
setprop("/FMGC/internal/adf2freq-set", 1); setprop("/FMGC/internal/adf2freq-set", 1);
mcdu.clearScratchpad(i); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
notAllowed(i); mcdu_message(i, "NOT ALLOWED");
} }
} }
} }

View file

@ -118,8 +118,7 @@ var vertRev = {
if (!dirToFlag) { if (!dirToFlag) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
} else { } else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1); mcdu_message(me.computer, "DIR TO IN PROGRESS");
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
} }
me._checkTmpy(); me._checkTmpy();
} }