FMGC: Make F-PLN list scrollable

This commit is contained in:
Joshua Davidson 2019-02-17 11:25:44 -07:00
parent ab7375a53a
commit dbd72d9189
5 changed files with 106 additions and 55 deletions
Models/Instruments/MCDU
Nasal

View file

@ -183,7 +183,7 @@ var canvas_MCDU_base = {
"Simple_L1_Arrow","Simple_L2_Arrow","Simple_L3_Arrow","Simple_L4_Arrow","Simple_L5_Arrow","Simple_L6_Arrow","Simple_R1","Simple_R2","Simple_R3","Simple_R4","Simple_R5","Simple_R6","Simple_R1S","Simple_R2S","Simple_R3S","Simple_R4S","Simple_R5S",
"Simple_R6S","Simple_R1_Arrow","Simple_R2_Arrow","Simple_R3_Arrow","Simple_R4_Arrow","Simple_R5_Arrow","Simple_R6_Arrow","Simple_C1","Simple_C2","Simple_C3","Simple_C4","Simple_C5","Simple_C6","Simple_C1S","Simple_C2S","Simple_C3S","Simple_C4S",
"Simple_C5S","Simple_C6S","INITA","INITA_CoRoute","INITA_FltNbr","INITA_CostIndex","INITA_CruiseFLTemp","INITA_FromTo","INITA_InitRequest","INITA_AlignIRS","INITB","INITB_ZFWCG","INITB_ZFW","INITB_ZFW_S","INITB_Block","PERFTO","PERFTO_V1","PERFTO_VR",
"PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","FPLN","FPLN_From","FPLN_TMPY_group","FPLN_Callsign","FPLN_L1","FPLN_L2","FPLN_L3","FPLN_L4","FPLN_L5","FPLN_L6","FPLN_L1S","FPLN_L2S","FPLN_L3S","FPLN_L4S","FPLN_L5S","FPLN_L6S"];
"PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","FPLN","FPLN_From","FPLN_TMPY_group","FPLN_Callsign","FPLN_L1","FPLN_L2","FPLN_L3","FPLN_L4","FPLN_L5","FPLN_L6","FPLN_L1S","FPLN_L2S","FPLN_L3S","FPLN_L4S","FPLN_L5S","FPLN_L6S","FPLN_6_group"];
},
update: func() {
if (ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) {
@ -327,8 +327,10 @@ var canvas_MCDU_base = {
if (TMPYActive.getBoolValue()) {
me["FPLN_TMPY_group"].show();
me["FPLN_6_group"].hide();
} else {
me["FPLN_TMPY_group"].hide();
me["FPLN_6_group"].show();
}
if (fplnCSwitch[i].getBoolValue() != 1) {

View file

@ -28,12 +28,12 @@
id="namedview371"
showgrid="true"
inkscape:zoom="1"
inkscape:cx="1222.1866"
inkscape:cy="221.42045"
inkscape:cx="131.34947"
inkscape:cy="381.42045"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="FPLN"
inkscape:current-layer="svg2"
showguides="false"
inkscape:snap-global="false"
units="px">
@ -1735,20 +1735,6 @@
x="20.138426"
id="tspan4432"
sodipodi:role="line">TEXT</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:71.89044189px;line-height:125%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="20.138426"
y="773.87396"
id="FPLN_L6"
sodipodi:linespacing="125%"
transform="scale(0.991516,1.0085566)"
inkscape:label="#text4244"><tspan
sodipodi:role="line"
id="tspan4436"
x="20.138426"
y="773.87396"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">TEXT</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:71.89044189px;line-height:125%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
@ -1819,20 +1805,38 @@
x="63.546234"
y="599.80499"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">TEXT</tspan></text>
<text
inkscape:label="#text4244"
transform="scale(0.991516,1.0085566)"
sodipodi:linespacing="125%"
id="FPLN_L6S"
y="717.159"
x="63.546234"
style="font-style:normal;font-weight:normal;font-size:71.89044189px;line-height:125%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1"
y="717.159"
<g
id="FPLN_6_group"
inkscape:label="#g3626">
<text
inkscape:label="#text4244"
transform="scale(0.991516,1.0085566)"
sodipodi:linespacing="125%"
id="FPLN_L6"
y="773.87396"
x="20.138426"
style="font-style:normal;font-weight:normal;font-size:71.89044189px;line-height:125%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1"
y="773.87396"
x="20.138426"
id="tspan4436"
sodipodi:role="line">TEXT</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:71.89044189px;line-height:125%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="63.546234"
id="tspan5000"
sodipodi:role="line">TEXT</tspan></text>
y="717.159"
id="FPLN_L6S"
sodipodi:linespacing="125%"
transform="scale(0.991516,1.0085566)"
inkscape:label="#text4244"><tspan
sodipodi:role="line"
id="tspan5000"
x="63.546234"
y="717.159"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">TEXT</tspan></text>
</g>
<g
id="FPLN_TMPY_group"
inkscape:label="#g3767">

Before

(image error) Size: 106 KiB

After

(image error) Size: 106 KiB

View file

@ -10,6 +10,7 @@ var left3 = [props.globals.initNode("MCDU[0]/F-PLN/left-3", "", "STRING"), props
var left4 = [props.globals.initNode("MCDU[0]/F-PLN/left-4", "", "STRING"), props.globals.initNode("MCDU[1]/F-PLN/left-4", "", "STRING")];
var left5 = [props.globals.initNode("MCDU[0]/F-PLN/left-5", "", "STRING"), props.globals.initNode("MCDU[1]/F-PLN/left-5", "", "STRING")];
var left6 = [props.globals.initNode("MCDU[0]/F-PLN/left-6", "", "STRING"), props.globals.initNode("MCDU[1]/F-PLN/left-6", "", "STRING")];
var left7 = ["", ""]; # Not actually used, only for logic
var left1s = [props.globals.initNode("MCDU[0]/F-PLN/left-1s", "", "STRING"), props.globals.initNode("MCDU[1]/F-PLN/left-1s", "", "STRING")];
var left2s = [props.globals.initNode("MCDU[0]/F-PLN/left-2s", "", "STRING"), props.globals.initNode("MCDU[1]/F-PLN/left-2s", "", "STRING")];
var left3s = [props.globals.initNode("MCDU[0]/F-PLN/left-3s", "", "STRING"), props.globals.initNode("MCDU[1]/F-PLN/left-3s", "", "STRING")];
@ -30,21 +31,48 @@ var altn_fpln_end = "----END OF ALTN F-PLN---";
var no_altn_fpln_end = "------NO ALTN F-PLN-----";
var offset = [0, 0];
var fp = 0;
var fp = 1;
var num = 0;
var wpColor = "grn";
var page = "";
var offsetThreshold = 6; # 6 WPs for F-PLN, 5 for TMPY F-PLN
var active_out = [nil, props.globals.getNode("/FMGC/flightplan[1]/active")];
var num_out = [props.globals.getNode("/FMGC/flightplan[0]/num"), props.globals.getNode("/FMGC/flightplan[1]/num")];
var TMPYActive = props.globals.getNode("/FMGC/internal/tmpy-active");
var TMPYActive_out = props.globals.initNode("/MCDUC/tmpy-active", 0, "BOOL");
var pageProp = [props.globals.getNode("/MCDU[0]/page", 1), props.globals.getNode("/MCDU[1]/page", 1)];
var updateFPLN = func(i) {
setlistener("/FMGC/internal/tmpy-active", func {
if (TMPYActive.getBoolValue()) {
fp = 0;
wpColor = "yel";
offsetThreshold = 5;
} else {
fp = 1;
wpColor = "grn";
offsetThreshold = 6;
}
}, 0, 0);
var slewFPLN = func(d, i) {
if (d == 1) {
if (left7[i] != "" and offsetThreshold == 6) {
offset[i] = offset[i] + 1;
} else if (left6[i].getValue() != "" and offsetThreshold == 5) {
offset[i] = offset[i] + 1;
}
} else if (d == -1) {
if (offset[i] > 0) {
offset[i] = offset[i] - 1;
}
}
}
var updateFPLN = func(i) {
page = pageProp[i].getValue();
if (page != "F-PLNA" and page != "F-PLNB") {
offset[i] = 0; # Reset offset to 0 when no longer viewing F-PLN page
}
num = num_out[fp].getValue();
@ -161,32 +189,43 @@ var updateFPLN = func(i) {
}
# Line 6:
if (fp != 0) {
if (offset[i] + 5 < num) {
left6[i].setValue(fmgc.wpID[fp][offset[i] + 5].getValue());
if (offset[i] + 5 == fmgc.arrivalAirportI[fp]) {
left6s[i].setValue("DEST");
line6c[i].setValue("wht");
} else {
left6s[i].setValue("C" ~ math.round(fmgc.wpCoursePrev[fp][offset[i] + 5].getValue()) ~ "g");
line6c[i].setValue(wpColor);
}
} else if (offset[i] + 5 == num) {
left6[i].setValue(fpln_end);
left6s[i].setValue("");
line6c[i].setValue("wht");
} else if (offset[i] + 5 == num + 1) {
left6[i].setValue(no_altn_fpln_end);
left6s[i].setValue("");
if (offset[i] + 5 < num) {
left6[i].setValue(fmgc.wpID[fp][offset[i] + 5].getValue());
if (offset[i] + 5 == fmgc.arrivalAirportI[fp]) {
left6s[i].setValue("DEST");
line6c[i].setValue("wht");
} else {
left6[i].setValue("");
left6s[i].setValue("C" ~ math.round(fmgc.wpCoursePrev[fp][offset[i] + 5].getValue()) ~ "g");
line6c[i].setValue(wpColor);
}
} else if (offset[i] + 5 == num) {
left6[i].setValue(fpln_end);
left6s[i].setValue("");
line6c[i].setValue("wht");
} else if (offset[i] + 5 == num + 1) {
left6[i].setValue(no_altn_fpln_end);
left6s[i].setValue("");
line6c[i].setValue("wht");
} else {
left6[i].setValue("");
left6s[i].setValue("");
}
# Line 7:
# Not actually used, only for logic
if (offset[i] + 6 < num) {
left7[i] = fmgc.wpID[fp][offset[i] + 6].getValue();
} else if (offset[i] + 6 == num) {
left7[i] = fpln_end;
} else if (offset[i] + 6 == num + 1) {
left7[i] = no_altn_fpln_end;
} else {
left7[i] = "";
}
# if (offset[i] + offsetThreshold > num) {
# offset[i] = num - offsetThreshold;
# }
if (offset[i] > 0) {
showFromInd[i].setBoolValue(0);
} else {

View file

@ -329,9 +329,13 @@ var arrowbutton = func(btn, i) {
setprop("/MCDU[" ~ i ~ "]/page", "PRINTFUNC");
}
} else if (btn == "up") {
# Nothing for now
if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
slewFPLN(1, i);
}
} else if (btn == "down") {
# Nothing for now
if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
slewFPLN(-1, i);
}
}
}

View file

@ -79,6 +79,8 @@ var flightplan = {
me.checkWPOutputs(n);
TMPYActive.setBoolValue(0);
me.reset0();
mcdu.offset[0] = 0;
mcdu.offset[1] = 0;
},
updateARPT: func(dep, arr, n) {
if (n == 1) { # Which flightplan?
@ -226,4 +228,4 @@ var flightplan = {
},
};
var outputPropsTimer = maketimer(0.4, flightplan.outputProps);
var outputPropsTimer = maketimer(0.1, flightplan.outputProps);