1
0
Fork 0

Improvements

This commit is contained in:
legoboyvdlp R 2020-05-23 01:40:01 +01:00
parent 5788e99be3
commit 97e00861cb
20 changed files with 73 additions and 48 deletions

View file

@ -4005,7 +4005,6 @@
<file>Aircraft/A320-family/Nasal/FMGC/FMGC.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/FMGC-b.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/FMGC-c.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/mcdu-messages.nas</file>
</fmgc>
<mcdu>
<file>Aircraft/A320-family/Nasal/MCDU/DUPLICATE.nas</file> <!-- dynamic page - init before others as used in various pages -->
@ -4056,6 +4055,9 @@
<canvas_mcdu>
<file>Aircraft/A320-family/Models/Instruments/MCDU/MCDU.nas</file>
</canvas_mcdu>
<mcdu_scratchpad> <!-- delay till after canvas mcdu -->
<file>Aircraft/A320-family/Nasal/FMGC/mcdu-messages.nas</file>
</mcdu_scratchpad>
<!-- Autopush -->
<autopush>
<file>Aircraft/A320-family/Nasal/Autopush/autopush.nas</file>

View file

@ -217,7 +217,6 @@ var ldg_config_f_set = props.globals.getNode("/FMGC/internal/ldg-config-f-set",
# Fetch nodes into vectors
var pageProp = [props.globals.getNode("/MCDU[0]/page", 1), props.globals.getNode("/MCDU[1]/page", 1)];
var active = [props.globals.getNode("/MCDU[0]/active", 1), props.globals.getNode("/MCDU[1]/active", 1)];
var scratchpad = [fmgc.scratchpads[0].scratchpad, fmgc.scratchpads[1].scratchpad];
# Create Nodes:
var pageSwitch = [props.globals.initNode("/MCDU[0]/internal/switch", 0, "BOOL"), props.globals.initNode("/MCDU[1]/internal/switch", 0, "BOOL")];
@ -347,7 +346,7 @@ var canvas_MCDU_base = {
me["ArrowRight"].show();
me["arrowsDepArr"].hide();
me["Simple_L0"].hide();
me["Simple_L0S"].hide();
me["Simple_C3B"].hide();
me["Simple_C4B"].hide();
@ -4196,8 +4195,6 @@ var canvas_MCDU_base = {
pageSwitch[i].setBoolValue(1);
}
}
me["Scratchpad"].setText(sprintf("%s", scratchpad[i].getValue()));
},
# ack = ignore, wht = white, grn = green, blu = blue, amb = amber, yel = yellow, mag = magenta
colorLeft: func(a, b, c, d, e, f) {
@ -4929,6 +4926,9 @@ var canvas_MCDU_base = {
}
}
},
updateScratchpad: func(i) {
me["Scratchpad"].setText(sprintf("%s", mcdu_scratchpad.scratchpads[i].scratchpad));
},
};
var canvas_MCDU_1 = {
@ -4941,6 +4941,9 @@ var canvas_MCDU_1 = {
update: func() {
me.updateCommon(0);
},
updateScratchpadCall: func() {
me.updateScratchpad(0);
},
};
var canvas_MCDU_2 = {
@ -4953,6 +4956,9 @@ var canvas_MCDU_2 = {
update: func() {
me.updateCommon(1);
},
updateScratchpadCall: func() {
me.updateScratchpad(1);
},
};
setlistener("sim/signals/fdm-initialized", func {
@ -4975,6 +4981,8 @@ setlistener("sim/signals/fdm-initialized", func {
MCDU_1 = canvas_MCDU_1.new(group_MCDU1, "Aircraft/A320-family/Models/Instruments/MCDU/res/mcdu.svg");
MCDU_2 = canvas_MCDU_2.new(group_MCDU2, "Aircraft/A320-family/Models/Instruments/MCDU/res/mcdu.svg");
MCDU_1.updateScratchpadCall();
MCDU_2.updateScratchpadCall();
MCDU_update.start();
});

View file

@ -11,7 +11,7 @@ var TypeIMessage = {
};
var TypeIIMessage = {
new: func(msgText, colour, isInhibit = 0) {
new: func(msgText, colour = "w", isInhibit = 0) {
var msg = { parents: [TypeIIMessage] };
msg.msgText = msgText;
msg.colour = colour;
@ -45,17 +45,18 @@ var MessageQueueController = {
};
var scratchpadController = {
new: func() {
new: func(mcdu) {
var sp = { parents: [scratchpadController] };
sp.scratchpad = "";
sp.scratchpadSave = "";
sp.scratchpadColour = "w";
scratchpadShowTypeIMsg = 0;
scratchpadShowTypeIIMsg = 0;
sp.scratchpadShowTypeIMsg = 0;
sp.scratchpadShowTypeIIMsg = 0;
sp.mcdu = mcdu;
return sp;
},
addCharToScratchpad: func(character) {
addChar: func(character) {
if (size(me.scratchpad) >= 22) {
return;
}
@ -71,8 +72,9 @@ var scratchpadController = {
}
me.scratchpad = me.scratchpad ~ character;
me.update();
},
showTypeIMsg: func(msg) {
showTypeI: func(msg) {
# any shown type ii is hidden
if (me.scratchpadShowTypeIIMsg) {
me.clearTypeIIMsg();
@ -82,25 +84,30 @@ var scratchpadController = {
# save any data entered
me.scratchpadSave = me.scratchpad;
me.scratchpad = msg;
me.update();
},
showTypeIIMsg: func(msg) {
showTypeII: func(msg) {
# only show if scratchpad empty
if (me.scratchpad = "") {
me.scratchpadShowTypeIIMsg = 1;
me.scratchpad = msg;
}
me.update();
},
clearTypeIMsg: func() {
clearTypeI: func() {
me.scratchpad = me.scratchpadSave;
me.scratchpadSave = nil;
me.scratchpadShowTypeIMsg = 0;
me.update();
},
clearTypeIIMsg: func() {
clearTypeII: func() {
me.scratchpadShowTypeIIMsg = 0;
me.empty();
me.update();
},
empty: func() {
me.scratchpad = "";
me.update();
},
clear: func() {
if (me.showTypeIMsg) {
@ -110,6 +117,14 @@ var scratchpadController = {
} else {
me.clearTypeIIMsg();
}
me.update();
},
update: func() {
if (me.mcdu == 1) {
canvas_mcdu.MCDU_1.updateScratchpadCall();
} else {
canvas_mcdu.MCDU_2.updateScratchpadCall();
}
},
};
@ -142,4 +157,4 @@ var MessageController = {
},
};
var scratchpads = [scratchpadController.new(), scratchpadController.new()];
var scratchpads = [scratchpadController.new(1), scratchpadController.new(2)];

View file

@ -460,7 +460,7 @@ 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", getprop("MCDU[" ~ i ~ "]/scratchpad"));
setprop("MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "NOT IN DATABASE");
@ -470,7 +470,7 @@ 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", getprop("MCDU[" ~ i ~ "]/scratchpad"));
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");

View file

@ -29,7 +29,7 @@ var extra_fuel = props.globals.getNode("FMGC/internal/extra-fuel", 1);
var extra_time = props.globals.getNode("FMGC/internal/extra-time", 1);
var fuelPredInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel")));

View file

@ -4,7 +4,7 @@
# Copyright (c) 2020 Matthew Maring (mattmaring)
var initInputA = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L2") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/alt-airport", "");

View file

@ -3,7 +3,7 @@
# Copyright (c) 2020 Matthew Maring (mattmaring)
var initInputB = func(key, i) {
var scratchpad = getprop("/MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/taxi-fuel", 0.4);

View file

@ -91,21 +91,21 @@ var initInputIRS = func(key, i) {
setprop("MCDU[" ~ i ~ "]/page", "INITA");
}
} else if (getprop("FMGC/internal/tofrom-set") == 0) {
if (getprop("MCDU[" ~ i ~ "]/scratchpad") != "SELECT REFERENCE") {
if (mcdu_scratchpad.scratchpads[i].scratchpad != "SELECT REFERENCE") {
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
} else {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
setprop("MCDU[" ~ i ~ "]/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) {
if (getprop("MCDU[" ~ i ~ "]/scratchpad") != "IRS NOT ALIGNED") {
if (mcdu_scratchpad.scratchpads[i].scratchpad != "IRS NOT ALIGNED") {
if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", "");
} else {
setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad"));
setprop("MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);

View file

@ -249,7 +249,7 @@ var lskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(1);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].fieldL1(getprop("/MCDU[" ~ i ~ "]/scratchpad"));
canvas_mcdu.myDirTo[i].fieldL1(mcdu_scratchpad.scratchpads[i].scratchpad);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
canvas_mcdu.myDuplicate[i].pushButtonLeft(1);
} else {
@ -398,7 +398,7 @@ var lskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
canvas_mcdu.myDuplicate[i].pushButtonLeft(5);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "CLOSESTAIRPORT") {
canvas_mcdu.myClosestAirport[i].manAirportCall(getprop("/MCDU[" ~ i ~ "]/scratchpad"));
canvas_mcdu.myClosestAirport[i].manAirportCall(mcdu_scratchpad.scratchpads[i].scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
@ -619,11 +619,11 @@ var rskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
perfAPPRInput("R6",i);
} else if ((getprop("/MCDU[" ~ i ~ "]/page") == "DATA") or (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") or (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2")) {
if (getprop("/MCDU[" ~ i ~ "]/scratchpad") != "AOC DISABLED") {
if (mcdu_scratchpad.scratchpads[i].scratchpad != "AOC DISABLED") {
if (getprop("/MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", "");
} else {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", getprop("/MCDU[" ~ i ~ "]/scratchpad"));
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
}
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);
@ -807,7 +807,7 @@ var pagebutton = func(btn, i) {
var button = func(btn, i) {
if (getprop("/MCDU[" ~ i ~ "]/scratchpad-msg") == 0 and getprop("/MCDU[" ~ i ~ "]/page") != "MCDU") {
var scratchpad = getprop("/MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (btn == "SLASH") {
setprop("/MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ "/");
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
@ -815,7 +815,7 @@ var button = func(btn, i) {
setprop("/MCDU[" ~ i ~ "]/scratchpad", scratchpad ~ " ");
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
} else if (btn == "CLR") {
var scratchpad = getprop("/MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (size(scratchpad) == 0) {
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "CLR");
@ -840,7 +840,7 @@ var button = func(btn, i) {
} else {
if (btn == "CLR") {
setprop("/MCDU[" ~ i ~ "]/scratchpad-color", "wht");
var scratchpad = getprop("/MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (size(scratchpad) == 0) {
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "CLR");
@ -854,11 +854,11 @@ var button = func(btn, i) {
}
var genericMessage = func(i, text, color) {
if (getprop("/MCDU[" ~ i ~ "]/scratchpad") != text) {
if (mcdu_scratchpad.scratchpads[i].scratchpad != text) {
if (getprop("/MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", "");
} else {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", getprop("/MCDU[" ~ i ~ "]/scratchpad"));
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
}
setprop("/MCDU[" ~ i ~ "]/scratchpad-color", color);
@ -868,11 +868,11 @@ var genericMessage = func(i, text, color) {
var notAllowed = func(i) {
setprop("/MCDU[" ~ i ~ "]/scratchpad-color", "wht");
if (getprop("/MCDU[" ~ i ~ "]/scratchpad") != "NOT ALLOWED") {
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", getprop("/MCDU[" ~ i ~ "]/scratchpad"));
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
}
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);
@ -881,11 +881,11 @@ var notAllowed = func(i) {
var formatError = func(i) {
setprop("/MCDU[" ~ i ~ "]/scratchpad-color", "wht");
if (getprop("/MCDU[" ~ i ~ "]/scratchpad") != "FORMAT ERROR") {
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", getprop("/MCDU[" ~ i ~ "]/scratchpad"));
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", mcdu_scratchpad.scratchpads[i].scratchpad);
}
}
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);

View file

@ -5,7 +5,7 @@ var ldg_config_3_set = props.globals.getNode("/FMGC/internal/ldg-config-3-set",
var ldg_config_f_set = props.globals.getNode("/FMGC/internal/ldg-config-f-set", 1);
var perfAPPRInput = func(key, i) {
var scratchpad = getprop("/MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/dest-qnh", -1);

View file

@ -3,7 +3,7 @@
# Copyright (c) 2020 Matthew Maring (mattmaring)
var perfCLBInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L2") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0);

View file

@ -3,7 +3,7 @@
# Copyright (c) 2020 Matthew Maring (mattmaring)
var perfCRZInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L2") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0);

View file

@ -3,7 +3,7 @@
# Copyright (c) 2020 Matthew Maring (mattmaring)
var perfDESInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L2") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0);

View file

@ -3,7 +3,7 @@
# uses universal values, will implement separately once FPLN is finished
var perfGAInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L5") {
if (scratchpad == "CLR") {
setprop("systems/thrust/clbreduc-ft", "1500");

View file

@ -4,7 +4,7 @@
# Copyright (c) 2020 Matthew Maring (mattmaring)
var perfTOInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") {
if (getprop("/FMGC/status/phase") != 1) {
if (scratchpad == "CLR") {

View file

@ -1,7 +1,7 @@
# Copyright (c) 2020 Matthew Maring (mattmaring)
var progCLBInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));

View file

@ -1,7 +1,7 @@
# Copyright (c) 2020 Matthew Maring (mattmaring)
var progCRZInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));

View file

@ -1,7 +1,7 @@
# Copyright (c) 2020 Matthew Maring (mattmaring)
var progDESInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));

View file

@ -3,7 +3,7 @@
var altSet = props.globals.getNode("it-autoflight/input/alt", 1);
var progTOInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));

View file

@ -3,7 +3,7 @@
# Copyright (c) 2020 Josh Davidson (Octal450)
var radnavInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/vor1freq-set", 0);