diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index a25af947..0af96a50 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -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", "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_ZFWCGZFW","INITB_Block","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2","PERFTO_FE", - "PERFTO_SE","PERFTO_OE"]; + "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"]; }, update: func() { 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"))); } else if (page == "INITB") { me["Simple"].show(); - me["Simple_Center"].hide(); + me["Simple_Center"].show(); me["INITA"].hide(); me["INITB"].show(); me["PERFTO"].hide(); @@ -820,6 +820,18 @@ var canvas_MCDU_base = { me["Simple_L4_Arrow"].hide(); me["Simple_L5_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_R2"].show(); me["Simple_R3"].hide(); @@ -850,10 +862,31 @@ var canvas_MCDU_base = { me.colorLeft("blu", "wht", "wht", "wht", "wht", "wht"); me.colorLeftS("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.colorRightS("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) { me["INITB_Block"].hide(); me["Simple_R2"].show(); @@ -874,10 +907,11 @@ var canvas_MCDU_base = { me["Simple_L4S"].setText("ALTN/TIME"); me["Simple_L5S"].setText("FINAL/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_R4"].setText("---.-"); me["Simple_R5"].setText("---.-"); - me["Simple_R1S"].setText("ZFWCG/ ZFW"); + me["Simple_R1S"].setText("ZFWCG/ ZFW"); me["Simple_R2S"].setText("BLOCK"); me["Simple_R4S"].setText("TOW"); me["Simple_R5S"].setText("LW"); diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg index c1f73cae..6895e780 100644 --- a/Models/Instruments/MCDU/res/mcdu.svg +++ b/Models/Instruments/MCDU/res/mcdu.svg @@ -41,13 +41,13 @@ inkscape:window-height="1030" id="namedview371" showgrid="true" - inkscape:zoom="0.99999999" - inkscape:cx="796.50063" - inkscape:cy="810.8993" + inkscape:zoom="0.5" + inkscape:cx="997.98642" + inkscape:cy="772.65269" inkscape:window-x="1592" inkscape:window-y="-8" inkscape:window-maximized="1" - inkscape:current-layer="Simple_Center" + inkscape:current-layer="INITB" showguides="false" inkscape:snap-global="false" units="px"> @@ -1277,9 +1277,23 @@ inkscape:groupmode="layer" id="INITB" inkscape:label="INITB"> + / + id="INITB_ZFW" + inkscape:label="#g3600"> / + transform="translate(0,44.720803)" + id="g3590"> + y="100.6336" /> + + + + + y="100.6336" /> + y="100.6336" /> = 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") { setprop("/FMGC/internal/block", 0.0); setprop("/FMGC/internal/block-set", 0); @@ -15,7 +70,9 @@ var initInputB = func(key) { } else { var tfs = size(scratchpad); 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) { setprop("/FMGC/internal/block", scratchpad); setprop("/FMGC/internal/block-set", 1); diff --git a/Nasal/MCDU1/MCDU.nas b/Nasal/MCDU1/MCDU.nas index 7a72cfb4..9091098f 100644 --- a/Nasal/MCDU1/MCDU.nas +++ b/Nasal/MCDU1/MCDU.nas @@ -34,10 +34,14 @@ var MCDU_reset = func { setprop("/FMGC/internal/vr", 0); setprop("/FMGC/internal/v2", 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/vr-set", 0); setprop("/FMGC/internal/v2-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-ths", "0.0"); setprop("/FMGC/internal/tofrom-set", 0); @@ -225,6 +229,8 @@ var rskbutton = func(btn) { if (btn == "1") { if (getprop("/MCDU[0]/page") == "INITA") { initInputA("R1"); + } else if (getprop("/MCDU[0]/page") == "INITB") { + initInputB("R1"); } else if (getprop("/MCDU[0]/page") == "RADNAV") { radnavInput("R1"); } else if (getprop("/MCDU[0]/page") == "PRINTFUNC") { diff --git a/Nasal/MCDU1/PERFTO.nas b/Nasal/MCDU1/PERFTO.nas index 028c1b14..efa0e737 100644 --- a/Nasal/MCDU1/PERFTO.nas +++ b/Nasal/MCDU1/PERFTO.nas @@ -129,7 +129,7 @@ var perfTOInput = func(key) { setprop("/MCDU[0]/scratchpad", ""); } else { 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 thrred = size(thracc[0]); var acc = size(thracc[1]); @@ -162,7 +162,7 @@ var perfTOInput = func(key) { setprop("/MCDU[0]/scratchpad", ""); } else { var tfs = size(scratchpad); - if (tfs == 7) { + if (tfs == 7 and find("/", scratchpad) != -1) { var flapths = split("/UP", scratchpad); 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]); diff --git a/Nasal/MCDU2/DATA.nas b/Nasal/MCDU2/DATA.nas index c217430c..7fadc9a1 100644 --- a/Nasal/MCDU2/DATA.nas +++ b/Nasal/MCDU2/DATA.nas @@ -54,10 +54,10 @@ var printInput2 = func(key) { setprop("/FMGC/print/mcdu/page2/L4auto", 1); } if (key == "L6") { - setprop("/MCDU[0]/page", "DATA"); + setprop("/MCDU[1]/page", "DATA"); } if (key == "R1") { - setprop("/FMGC/print/mcdu/pag2e/R1req", 1); + setprop("/FMGC/print/mcdu/page2/R1req", 1); } if (key == "R2") { setprop("/FMGC/print/mcdu/page2/R2req", 1); diff --git a/Nasal/MCDU2/INITA.nas b/Nasal/MCDU2/INITA.nas index a8036e95..3c546451 100644 --- a/Nasal/MCDU2/INITA.nas +++ b/Nasal/MCDU2/INITA.nas @@ -108,7 +108,7 @@ var initInputA = func(key) { setprop("/MCDU[1]/scratchpad", ""); } else { var tfs = size(scratchpad); - if (tfs == 9) { + if (tfs == 9 and find("/", scratchpad) != -1) { var fromto = split("/", scratchpad); var froms = size(fromto[0]); var tos = size(fromto[1]); @@ -158,5 +158,4 @@ var initInputA = func(key) { } } } - } diff --git a/Nasal/MCDU2/INITB.nas b/Nasal/MCDU2/INITB.nas index 0a6b9a98..0b0558a3 100644 --- a/Nasal/MCDU2/INITB.nas +++ b/Nasal/MCDU2/INITB.nas @@ -6,7 +6,62 @@ var initInputB = func(key) { 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") { setprop("/FMGC/internal/block", 0.0); setprop("/FMGC/internal/block-set", 0); @@ -15,7 +70,9 @@ var initInputB = func(key) { } else { var tfs = size(scratchpad); 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) { setprop("/FMGC/internal/block", scratchpad); setprop("/FMGC/internal/block-set", 1); diff --git a/Nasal/MCDU2/MCDU.nas b/Nasal/MCDU2/MCDU.nas index 53968e36..12640f77 100644 --- a/Nasal/MCDU2/MCDU.nas +++ b/Nasal/MCDU2/MCDU.nas @@ -34,10 +34,14 @@ var MCDU_reset = func { setprop("/FMGC/internal/vr", 0); setprop("/FMGC/internal/v2", 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/vr-set", 0); setprop("/FMGC/internal/v2-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-ths", "0.0"); setprop("/FMGC/internal/tofrom-set", 0); @@ -99,7 +103,7 @@ var lskbutton = func(btn) { radnavInput("L1"); } else if (getprop("/MCDU[1]/page") == "DATA") { dataInput("L1"); - } else if (getprop("/MCDU[1]/page") == "PRINTFUNC") { + } else if (getprop("/MCDU[1]/page") == "PRINTFUNC") { printInput("L1"); } else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") { printInput2("L1"); @@ -187,6 +191,8 @@ var lskbutton = func(btn) { radnavInput("L5"); } else if (getprop("/MCDU[1]/page") == "PRINTFUNC") { printInput("L5"); + } else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") { + printInput2("L5"); } else { if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") { setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad")); @@ -205,12 +211,6 @@ var lskbutton = func(btn) { perfDESInput("L6"); } else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") { 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 { if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") { setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad")); @@ -229,6 +229,8 @@ var rskbutton = func(btn) { if (btn == "1") { if (getprop("/MCDU[1]/page") == "INITA") { initInputA("R1"); + } else if (getprop("/MCDU[1]/page") == "INITB") { + initInputB("R1"); } else if (getprop("/MCDU[1]/page") == "RADNAV") { radnavInput("R1"); } else if (getprop("/MCDU[1]/page") == "PRINTFUNC") { @@ -309,6 +311,12 @@ var rskbutton = func(btn) { perfCLBInput("R6"); } else if (getprop("/MCDU[1]/page") == "CRZ") { 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") { initInputA("R6"); } else { diff --git a/Nasal/MCDU2/PERFTO.nas b/Nasal/MCDU2/PERFTO.nas index d09cdadb..2c6b59c7 100644 --- a/Nasal/MCDU2/PERFTO.nas +++ b/Nasal/MCDU2/PERFTO.nas @@ -129,7 +129,7 @@ var perfTOInput = func(key) { setprop("/MCDU[1]/scratchpad", ""); } else { 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 thrred = size(thracc[0]); var acc = size(thracc[1]); @@ -162,7 +162,7 @@ var perfTOInput = func(key) { setprop("/MCDU[1]/scratchpad", ""); } else { var tfs = size(scratchpad); - if (tfs == 7) { + if (tfs == 7 and find("/", scratchpad) != -1) { var flapths = split("/UP", scratchpad); 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]); diff --git a/revision.txt b/revision.txt index b093c522..c3287e8c 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4318 \ No newline at end of file +4319 \ No newline at end of file