System: MCDU INITB add ZFW, ZFWCG, and autofil

This commit is contained in:
Joshua Davidson 2018-04-04 12:39:13 -04:00
parent 86c24f5896
commit c648913441
13 changed files with 226 additions and 41 deletions

View file

@ -86,8 +86,8 @@ var canvas_MCDU_base = {
return ["Simple","Simple_Center","Scratchpad","Simple_Title","Simple_PageNum","ArrowLeft","ArrowRight","Simple_L1","Simple_L2","Simple_L3","Simple_L4","Simple_L5","Simple_L6","Simple_L1S","Simple_L2S","Simple_L3S","Simple_L4S","Simple_L5S","Simple_L6S", return ["Simple","Simple_Center","Scratchpad","Simple_Title","Simple_PageNum","ArrowLeft","ArrowRight","Simple_L1","Simple_L2","Simple_L3","Simple_L4","Simple_L5","Simple_L6","Simple_L1S","Simple_L2S","Simple_L3S","Simple_L4S","Simple_L5S","Simple_L6S",
"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_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_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_ZFWCGZFW","INITB_Block","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2","PERFTO_FE", "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_SE","PERFTO_OE"]; "PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE"];
}, },
update: func() { update: func() {
if (getprop("/systems/electrical/bus/ac1") >= 110) { if (getprop("/systems/electrical/bus/ac1") >= 110) {
@ -792,7 +792,7 @@ var canvas_MCDU_base = {
me["Simple_R6"].setText(sprintf("%5.0f", getprop("/FMGC/internal/tropo"))); me["Simple_R6"].setText(sprintf("%5.0f", getprop("/FMGC/internal/tropo")));
} else if (page == "INITB") { } else if (page == "INITB") {
me["Simple"].show(); me["Simple"].show();
me["Simple_Center"].hide(); me["Simple_Center"].show();
me["INITA"].hide(); me["INITA"].hide();
me["INITB"].show(); me["INITB"].show();
me["PERFTO"].hide(); me["PERFTO"].hide();
@ -820,6 +820,18 @@ var canvas_MCDU_base = {
me["Simple_L4_Arrow"].hide(); me["Simple_L4_Arrow"].hide();
me["Simple_L5_Arrow"].hide(); me["Simple_L5_Arrow"].hide();
me["Simple_L6_Arrow"].hide(); me["Simple_L6_Arrow"].hide();
me["Simple_C1"].show();
me["Simple_C2"].hide();
me["Simple_C3"].hide();
me["Simple_C4"].hide();
me["Simple_C5"].hide();
me["Simple_C6"].hide();
me["Simple_C1S"].hide();
me["Simple_C2S"].hide();
me["Simple_C3S"].hide();
me["Simple_C4S"].hide();
me["Simple_C5S"].hide();
me["Simple_C6S"].hide();
me["Simple_R1"].hide(); me["Simple_R1"].hide();
me["Simple_R2"].show(); me["Simple_R2"].show();
me["Simple_R3"].hide(); me["Simple_R3"].hide();
@ -850,10 +862,31 @@ var canvas_MCDU_base = {
me.colorLeft("blu", "wht", "wht", "wht", "wht", "wht"); me.colorLeft("blu", "wht", "wht", "wht", "wht", "wht");
me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
me.colorCenter("blu", "wht", "wht", "wht", "wht", "wht");
me.colorRight("blu", "blu", "wht", "wht", "wht", "wht"); me.colorRight("blu", "blu", "wht", "wht", "wht", "wht");
me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht");
if (getprop("/FMGC/internal/zfwcg-set") == 1) {
me["Simple_C1"].setFontSize(normal);
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", getprop("/FMGC/internal/zfwcg")));
me["INITB_ZFWCG"].hide();
} else {
me["Simple_C1"].setFontSize(small);
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", getprop("/FMGC/internal/zfwcg")));
me["INITB_ZFWCG"].hide();
}
if (getprop("/FMGC/internal/zfw-set") == 1) {
me["INITB_ZFW"].hide();
me["INITB_ZFW_S"].show();
me["Simple_R1"].show();
} else {
me["INITB_ZFW"].show();
me["INITB_ZFW_S"].hide();
me["Simple_R1"].hide();
}
if (getprop("/FMGC/internal/block-set") == 1) { if (getprop("/FMGC/internal/block-set") == 1) {
me["INITB_Block"].hide(); me["INITB_Block"].hide();
me["Simple_R2"].show(); me["Simple_R2"].show();
@ -874,6 +907,7 @@ var canvas_MCDU_base = {
me["Simple_L4S"].setText("ALTN/TIME"); me["Simple_L4S"].setText("ALTN/TIME");
me["Simple_L5S"].setText("FINAL/TIME"); me["Simple_L5S"].setText("FINAL/TIME");
me["Simple_L6S"].setText("EXTRA/TIME"); me["Simple_L6S"].setText("EXTRA/TIME");
me["Simple_R1"].setText(sprintf("%3.1f", getprop("/FMGC/internal/zfw")));
me["Simple_R2"].setText(sprintf("%3.1f", getprop("/FMGC/internal/block"))); me["Simple_R2"].setText(sprintf("%3.1f", getprop("/FMGC/internal/block")));
me["Simple_R4"].setText("---.-"); me["Simple_R4"].setText("---.-");
me["Simple_R5"].setText("---.-"); me["Simple_R5"].setText("---.-");

View file

@ -41,13 +41,13 @@
inkscape:window-height="1030" inkscape:window-height="1030"
id="namedview371" id="namedview371"
showgrid="true" showgrid="true"
inkscape:zoom="0.99999999" inkscape:zoom="0.5"
inkscape:cx="796.50063" inkscape:cx="997.98642"
inkscape:cy="810.8993" inkscape:cy="772.65269"
inkscape:window-x="1592" inkscape:window-x="1592"
inkscape:window-y="-8" inkscape:window-y="-8"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:current-layer="Simple_Center" inkscape:current-layer="INITB"
showguides="false" showguides="false"
inkscape:snap-global="false" inkscape:snap-global="false"
units="px"> units="px">
@ -1277,9 +1277,23 @@
inkscape:groupmode="layer" inkscape:groupmode="layer"
id="INITB" id="INITB"
inkscape:label="INITB"> inkscape:label="INITB">
<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:#179ab7;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="818.74951"
y="187.10254"
id="INITB_ZFW_S"
sodipodi:linespacing="125%"
transform="scale(0.991516,1.0085566)"
inkscape:label="#text4244"><tspan
sodipodi:role="line"
id="tspan3575"
x="818.74951"
y="187.10254"
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:end;text-anchor:end;fill:#179ab7;fill-opacity:1">/</tspan></text>
<g <g
inkscape:label="#g4320" id="INITB_ZFW"
id="INITB_ZFWCGZFW"> inkscape:label="#g3600">
<text <text
inkscape:label="#text4244" inkscape:label="#text4244"
transform="scale(0.991516,1.0085566)" transform="scale(0.991516,1.0085566)"
@ -1300,25 +1314,26 @@
sodipodi:linespacing="125%" sodipodi:linespacing="125%"
id="text4322" id="text4322"
y="187.10254" y="187.10254"
x="853.75775" x="818.74951"
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:#bb6100;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" 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:#bb6100;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan 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:end;text-anchor:end;fill:#bb6100;fill-opacity:1" 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:end;text-anchor:end;fill:#bb6100;fill-opacity:1"
y="187.10254" y="187.10254"
x="853.75775" x="818.74951"
id="tspan4324" id="tspan4324"
sodipodi:role="line">/</tspan></text> sodipodi:role="line">/</tspan></text>
<g <g
id="g4326"> transform="translate(0,44.720803)"
id="g3590">
<rect <rect
y="145.3544" y="100.6336"
x="968.38361" x="968.38361"
height="41.350403" height="41.350403"
width="39.4547" width="39.4547"
id="rect4328" id="rect4328"
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#bb6100;stroke-width:4.03199148;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#bb6100;stroke-width:4.03199148;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<rect <rect
y="145.3544" y="100.6336"
x="889.46741" x="889.46741"
height="41.350403" height="41.350403"
width="39.4547" width="39.4547"
@ -1330,23 +1345,32 @@
width="39.4547" width="39.4547"
height="41.350403" height="41.350403"
x="850.01111" x="850.01111"
y="145.3544" /> y="100.6336" />
</g>
</g>
<g
id="INITB_ZFWCG"
inkscape:label="#g3610"
transform="translate(-34.71127,0)">
<g
transform="translate(0,44.720803)"
id="g3595">
<rect <rect
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#bb6100;stroke-width:4.03199148;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#bb6100;stroke-width:4.03199148;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
id="rect4384" id="rect4384"
width="39.4547" width="39.4547"
height="41.350403" height="41.350403"
x="759.62421" x="759.62421"
y="145.3544" /> y="100.6336" />
<rect <rect
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#bb6100;stroke-width:4.03199148;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#bb6100;stroke-width:4.03199148;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
id="rect4386" id="rect4386"
width="39.4547" width="39.4547"
height="41.350403" height="41.350403"
x="680.70801" x="680.70801"
y="145.3544" /> y="100.6336" />
<rect <rect
y="145.3544" y="100.6336"
x="641.25171" x="641.25171"
height="41.350403" height="41.350403"
width="39.4547" width="39.4547"

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View file

@ -346,7 +346,7 @@ var various = maketimer(1, func {
setprop("/it-autoflight/settings/reduc-agl-ft", getprop("/FMGC/internal/reduc-agl-ft")); setprop("/it-autoflight/settings/reduc-agl-ft", getprop("/FMGC/internal/reduc-agl-ft"));
} }
setprop("/FMGC/internal/gw", math.round(getprop("fdm/jsbsim/inertia/weight-lbs"), 100)); setprop("/FMGC/internal/gw", math.round(getprop("/fdm/jsbsim/inertia/weight-lbs"), 100));
}); });
var various2 = maketimer(0.5, func { var various2 = maketimer(0.5, func {

View file

@ -108,7 +108,7 @@ var initInputA = func(key) {
setprop("/MCDU[0]/scratchpad", ""); setprop("/MCDU[0]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 9) { if (tfs == 9 and find("/", scratchpad) != -1) {
var fromto = split("/", scratchpad); var fromto = split("/", scratchpad);
var froms = size(fromto[0]); var froms = size(fromto[0]);
var tos = size(fromto[1]); var tos = size(fromto[1]);

View file

@ -6,7 +6,62 @@
var initInputB = func(key) { var initInputB = func(key) {
var scratchpad = getprop("/MCDU[0]/scratchpad"); var scratchpad = getprop("/MCDU[0]/scratchpad");
if (key == "R2") { if (key == "R1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/zfw", 0);
setprop("/FMGC/internal/zfwcg", 55.1); # 25KG default
setprop("/FMGC/internal/zfw-set", 0);
setprop("/FMGC/internal/zfwcg-set", 0);
setprop("/MCDU[0]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 0) {
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
setprop("/MCDU[0]/scratchpad", "/" ~ sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
} else if (tfs >= 2 and tfs <= 11 and find("/", scratchpad) != -1) {
var zfwi = split("/", scratchpad);
var zfwcg = size(zfwi[0]);
var zfw = size(zfwi[1]);
if (zfwcg >= 1 and zfwcg <= 5 and zfwi[0] > 0 and zfwi[0] <= 99.9) {
setprop("/FMGC/internal/zfwcg", zfwi[0]);
setprop("/FMGC/internal/zfwcg-set", 1);
}
if (zfw >= 1 and zfw <= 5 and zfwi[1] > 0 and zfwi[1] <= 999.9) {
setprop("/FMGC/internal/zfw", zfwi[1]);
setprop("/FMGC/internal/zfw-set", 1);
}
if ((zfwcg >= 1 and zfwcg <= 5 and zfwi[0] > 0 and zfwi[0] <= 99.9) or (zfw >= 1 and zfw <= 5 and zfwi[1] > 0 and zfwi[1] <= 999.9)) {
setprop("/MCDU[0]/scratchpad", "");
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else if (tfs >= 1 and tfs <= 5) {
var zfwcg = size(scratchpad);
if (zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) {
setprop("/FMGC/internal/zfwcg", scratchpad);
setprop("/FMGC/internal/zfwcg-set", 1);
setprop("/MCDU[0]/scratchpad", "");
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[0]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[0]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R2") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/block", 0.0); setprop("/FMGC/internal/block", 0.0);
setprop("/FMGC/internal/block-set", 0); setprop("/FMGC/internal/block-set", 0);
@ -15,7 +70,9 @@ var initInputB = func(key) {
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
var maxblock = getprop("/options/maxblock"); var maxblock = getprop("/options/maxblock");
if (tfs >= 1 and tfs <= 5) { if (tfs == 0) {
setprop("/MCDU[0]/scratchpad", sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)));
} else if (tfs >= 1 and tfs <= 5) {
if (scratchpad >= 1.0 and scratchpad <= maxblock) { if (scratchpad >= 1.0 and scratchpad <= maxblock) {
setprop("/FMGC/internal/block", scratchpad); setprop("/FMGC/internal/block", scratchpad);
setprop("/FMGC/internal/block-set", 1); setprop("/FMGC/internal/block-set", 1);

View file

@ -34,10 +34,14 @@ var MCDU_reset = func {
setprop("/FMGC/internal/vr", 0); setprop("/FMGC/internal/vr", 0);
setprop("/FMGC/internal/v2", 0); setprop("/FMGC/internal/v2", 0);
setprop("/FMGC/internal/block", 0.0); setprop("/FMGC/internal/block", 0.0);
setprop("/FMGC/internal/zfw", 0);
setprop("/FMGC/internal/zfwcg", 55.1); # 25KG default
setprop("/FMGC/internal/v1-set", 0); setprop("/FMGC/internal/v1-set", 0);
setprop("/FMGC/internal/vr-set", 0); setprop("/FMGC/internal/vr-set", 0);
setprop("/FMGC/internal/v2-set", 0); setprop("/FMGC/internal/v2-set", 0);
setprop("/FMGC/internal/block-set", 0); setprop("/FMGC/internal/block-set", 0);
setprop("/FMGC/internal/zfw-set", 0);
setprop("/FMGC/internal/zfwcg-set", 0);
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/tofrom-set", 0); setprop("/FMGC/internal/tofrom-set", 0);
@ -225,6 +229,8 @@ var rskbutton = func(btn) {
if (btn == "1") { if (btn == "1") {
if (getprop("/MCDU[0]/page") == "INITA") { if (getprop("/MCDU[0]/page") == "INITA") {
initInputA("R1"); initInputA("R1");
} else if (getprop("/MCDU[0]/page") == "INITB") {
initInputB("R1");
} else if (getprop("/MCDU[0]/page") == "RADNAV") { } else if (getprop("/MCDU[0]/page") == "RADNAV") {
radnavInput("R1"); radnavInput("R1");
} else if (getprop("/MCDU[0]/page") == "PRINTFUNC") { } else if (getprop("/MCDU[0]/page") == "PRINTFUNC") {

View file

@ -129,7 +129,7 @@ var perfTOInput = func(key) {
setprop("/MCDU[0]/scratchpad", ""); setprop("/MCDU[0]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 7 and tfs <= 9) { if (tfs >= 7 and tfs <= 9 and find("/", scratchpad) != -1) {
var thracc = split("/", scratchpad); var thracc = split("/", scratchpad);
var thrred = size(thracc[0]); var thrred = size(thracc[0]);
var acc = size(thracc[1]); var acc = size(thracc[1]);
@ -162,7 +162,7 @@ var perfTOInput = func(key) {
setprop("/MCDU[0]/scratchpad", ""); setprop("/MCDU[0]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 7) { if (tfs == 7 and find("/", scratchpad) != -1) {
var flapths = split("/UP", scratchpad); var flapths = split("/UP", scratchpad);
if ((flapths[0] >= 1 and flapths[0] <= 4) and (flapths[1] >= 0.0 and flapths[1] <= 2.5)) { if ((flapths[0] >= 1 and flapths[0] <= 4) and (flapths[1] >= 0.0 and flapths[1] <= 2.5)) {
setprop("/FMGC/internal/to-flap", flapths[0]); setprop("/FMGC/internal/to-flap", flapths[0]);

View file

@ -54,10 +54,10 @@ var printInput2 = func(key) {
setprop("/FMGC/print/mcdu/page2/L4auto", 1); setprop("/FMGC/print/mcdu/page2/L4auto", 1);
} }
if (key == "L6") { if (key == "L6") {
setprop("/MCDU[0]/page", "DATA"); setprop("/MCDU[1]/page", "DATA");
} }
if (key == "R1") { if (key == "R1") {
setprop("/FMGC/print/mcdu/pag2e/R1req", 1); setprop("/FMGC/print/mcdu/page2/R1req", 1);
} }
if (key == "R2") { if (key == "R2") {
setprop("/FMGC/print/mcdu/page2/R2req", 1); setprop("/FMGC/print/mcdu/page2/R2req", 1);

View file

@ -108,7 +108,7 @@ var initInputA = func(key) {
setprop("/MCDU[1]/scratchpad", ""); setprop("/MCDU[1]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 9) { if (tfs == 9 and find("/", scratchpad) != -1) {
var fromto = split("/", scratchpad); var fromto = split("/", scratchpad);
var froms = size(fromto[0]); var froms = size(fromto[0]);
var tos = size(fromto[1]); var tos = size(fromto[1]);
@ -158,5 +158,4 @@ var initInputA = func(key) {
} }
} }
} }
} }

View file

@ -6,7 +6,62 @@
var initInputB = func(key) { var initInputB = func(key) {
var scratchpad = getprop("/MCDU[1]/scratchpad"); var scratchpad = getprop("/MCDU[1]/scratchpad");
if (key == "R2") { if (key == "R1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/zfw", 0);
setprop("/FMGC/internal/zfwcg", 55.1); # 25KG default
setprop("/FMGC/internal/zfw-set", 0);
setprop("/FMGC/internal/zfwcg-set", 0);
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[1]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 0) {
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
setprop("/MCDU[1]/scratchpad", "/" ~ sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
} else if (tfs >= 2 and tfs <= 11 and find("/", scratchpad) != -1) {
var zfwi = split("/", scratchpad);
var zfwcg = size(zfwi[0]);
var zfw = size(zfwi[1]);
if (zfwcg >= 1 and zfwcg <= 5 and zfwi[0] > 0 and zfwi[0] <= 99.9) {
setprop("/FMGC/internal/zfwcg", zfwi[0]);
setprop("/FMGC/internal/zfwcg-set", 1);
}
if (zfw >= 1 and zfw <= 5 and zfwi[1] > 0 and zfwi[1] <= 999.9) {
setprop("/FMGC/internal/zfw", zfwi[1]);
setprop("/FMGC/internal/zfw-set", 1);
}
if ((zfwcg >= 1 and zfwcg <= 5 and zfwi[0] > 0 and zfwi[0] <= 99.9) or (zfw >= 1 and zfw <= 5 and zfwi[1] > 0 and zfwi[1] <= 999.9)) {
setprop("/MCDU[1]/scratchpad", "");
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else if (tfs >= 1 and tfs <= 5) {
var zfwcg = size(scratchpad);
if (zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) {
setprop("/FMGC/internal/zfwcg", scratchpad);
setprop("/FMGC/internal/zfwcg-set", 1);
setprop("/MCDU[1]/scratchpad", "");
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R2") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/block", 0.0); setprop("/FMGC/internal/block", 0.0);
setprop("/FMGC/internal/block-set", 0); setprop("/FMGC/internal/block-set", 0);
@ -15,7 +70,9 @@ var initInputB = func(key) {
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
var maxblock = getprop("/options/maxblock"); var maxblock = getprop("/options/maxblock");
if (tfs >= 1 and tfs <= 5) { if (tfs == 0) {
setprop("/MCDU[1]/scratchpad", sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)));
} else if (tfs >= 1 and tfs <= 5) {
if (scratchpad >= 1.0 and scratchpad <= maxblock) { if (scratchpad >= 1.0 and scratchpad <= maxblock) {
setprop("/FMGC/internal/block", scratchpad); setprop("/FMGC/internal/block", scratchpad);
setprop("/FMGC/internal/block-set", 1); setprop("/FMGC/internal/block-set", 1);

View file

@ -34,10 +34,14 @@ var MCDU_reset = func {
setprop("/FMGC/internal/vr", 0); setprop("/FMGC/internal/vr", 0);
setprop("/FMGC/internal/v2", 0); setprop("/FMGC/internal/v2", 0);
setprop("/FMGC/internal/block", 0.0); setprop("/FMGC/internal/block", 0.0);
setprop("/FMGC/internal/zfw", 0);
setprop("/FMGC/internal/zfwcg", 55.1); # 25KG default
setprop("/FMGC/internal/v1-set", 0); setprop("/FMGC/internal/v1-set", 0);
setprop("/FMGC/internal/vr-set", 0); setprop("/FMGC/internal/vr-set", 0);
setprop("/FMGC/internal/v2-set", 0); setprop("/FMGC/internal/v2-set", 0);
setprop("/FMGC/internal/block-set", 0); setprop("/FMGC/internal/block-set", 0);
setprop("/FMGC/internal/zfw-set", 0);
setprop("/FMGC/internal/zfwcg-set", 0);
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/tofrom-set", 0); setprop("/FMGC/internal/tofrom-set", 0);
@ -187,6 +191,8 @@ var lskbutton = func(btn) {
radnavInput("L5"); radnavInput("L5");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC") { } else if (getprop("/MCDU[1]/page") == "PRINTFUNC") {
printInput("L5"); printInput("L5");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
printInput2("L5");
} else { } else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") { if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad")); setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
@ -205,12 +211,6 @@ var lskbutton = func(btn) {
perfDESInput("L6"); perfDESInput("L6");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") { } else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
printInput2("L6"); printInput2("L6");
} else if ((getprop("/MCDU[1]/page") == "DATA") or (getprop("/MCDU[1]/page") == "PRINTFUNC") or (getprop("/MCDU[1]/page") == "PRINTFUNC2")) {
if (getprop("/MCDU[1]/scratchpad") != "AOC DISABLED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[0]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "AOC DISABLED");
} else { } else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") { if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad")); setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
@ -229,6 +229,8 @@ var rskbutton = func(btn) {
if (btn == "1") { if (btn == "1") {
if (getprop("/MCDU[1]/page") == "INITA") { if (getprop("/MCDU[1]/page") == "INITA") {
initInputA("R1"); initInputA("R1");
} else if (getprop("/MCDU[1]/page") == "INITB") {
initInputB("R1");
} else if (getprop("/MCDU[1]/page") == "RADNAV") { } else if (getprop("/MCDU[1]/page") == "RADNAV") {
radnavInput("R1"); radnavInput("R1");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC") { } else if (getprop("/MCDU[1]/page") == "PRINTFUNC") {
@ -309,6 +311,12 @@ var rskbutton = func(btn) {
perfCLBInput("R6"); perfCLBInput("R6");
} else if (getprop("/MCDU[1]/page") == "CRZ") { } else if (getprop("/MCDU[1]/page") == "CRZ") {
perfCRZInput("R6"); perfCRZInput("R6");
} else if ((getprop("/MCDU[1]/page") == "DATA") or (getprop("/MCDU[1]/page") == "PRINTFUNC") or (getprop("/MCDU[1]/page") == "PRINTFUNC2")) {
if (getprop("/MCDU[1]/scratchpad") != "AOC DISABLED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "AOC DISABLED");
} else if (getprop("/MCDU[1]/page") == "INITA") { } else if (getprop("/MCDU[1]/page") == "INITA") {
initInputA("R6"); initInputA("R6");
} else { } else {

View file

@ -129,7 +129,7 @@ var perfTOInput = func(key) {
setprop("/MCDU[1]/scratchpad", ""); setprop("/MCDU[1]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 7 and tfs <= 9) { if (tfs >= 7 and tfs <= 9 and find("/", scratchpad) != -1) {
var thracc = split("/", scratchpad); var thracc = split("/", scratchpad);
var thrred = size(thracc[0]); var thrred = size(thracc[0]);
var acc = size(thracc[1]); var acc = size(thracc[1]);
@ -162,7 +162,7 @@ var perfTOInput = func(key) {
setprop("/MCDU[1]/scratchpad", ""); setprop("/MCDU[1]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 7) { if (tfs == 7 and find("/", scratchpad) != -1) {
var flapths = split("/UP", scratchpad); var flapths = split("/UP", scratchpad);
if ((flapths[0] >= 1 and flapths[0] <= 4) and (flapths[1] >= 0.0 and flapths[1] <= 2.5)) { if ((flapths[0] >= 1 and flapths[0] <= 4) and (flapths[1] >= 0.0 and flapths[1] <= 2.5)) {
setprop("/FMGC/internal/to-flap", flapths[0]); setprop("/FMGC/internal/to-flap", flapths[0]);

View file

@ -1 +1 @@
4318 4319