From 75a0ba7655483040b152cbfc9ad7bb57676dcbb1 Mon Sep 17 00:00:00 2001 From: fly Date: Tue, 20 Oct 2020 02:59:33 +1100 Subject: [PATCH 01/33] ND align overlay by MiSKLaCH, see #182. Missing logic Signed-off-by: fly --- Models/Instruments/ND/canvas/res/airbusND.svg | 3798 ++++++++--------- 1 file changed, 1894 insertions(+), 1904 deletions(-) diff --git a/Models/Instruments/ND/canvas/res/airbusND.svg b/Models/Instruments/ND/canvas/res/airbusND.svg index c328bec6..fc7e5289 100644 --- a/Models/Instruments/ND/canvas/res/airbusND.svg +++ b/Models/Instruments/ND/canvas/res/airbusND.svg @@ -1,6 +1,4 @@ - - image/svg+xmlGijs de RooyGijs de RooyABCD + style="fill:#000000;fill-opacity:1;stroke:none" + d="M -0.34375,-0.1875 V 1029.6562 H 1025.6562 V -0.1875 Z M 542,88.9375 c 225.78305,15.28555 404.21875,203.69918 404.21875,433.875 0,230.17781 -178.4357,418.58895 -404.21875,433.875 -20.00001,-0.0211 -40,-0.0415 -60,-0.0625 C 256.53394,941.0132 78.46875,752.76279 78.46875,522.8125 78.46875,292.8642 256.53394,104.58004 482,88.96875 c 20,-0.01041 39.99999,-0.02084 60,-0.03125 z" + id="compass_mask_ctr" + inkscape:label="#rect7903" + inkscape:connector-curvature="0" />ABCD 999.9 + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + x="844.04407" + y="88.124893" + id="wpActiveDist" + inkscape:label="#text7243">999.9 0 + sodipodi:nodetypes="cccc" + inkscape:connector-curvature="0" + id="aplSymMap" + d="m 512,866.4 v -68 m 34.5,24 h -70 m 50,32 h -30" + style="fill:none;stroke:#f2f235;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:label="#path7253" />0 33 + inkscape:label="#text7243" + id="text3080" + y="208.85693" + x="13.677773" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(-30.000011)">33 30 + transform="rotate(-60.000017)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-476.08929" + y="100.35367" + id="text3084" + inkscape:label="#text7243">30 27 + inkscape:label="#text7243" + id="text3088" + y="-244.93858" + x="-845.96948" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(-90)">27 24 + transform="rotate(-120.00001)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-996.42627" + y="-725.91412" + id="text3092" + inkscape:label="#text7243">24 21 + inkscape:label="#text7243" + id="text3096" + y="-1217.4061" + x="-882.57745" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(-150.00002)">21 18 + transform="scale(-1)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-533.67151" + y="-1586.3594" + id="text3100" + inkscape:label="#text7243">18 15 + inkscape:label="#text7243" + id="text3104" + y="-1735.3862" + x="-55.0742" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(149.99999)">15 12 + transform="rotate(119.99998)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="435.53021" + y="-1619.6591" + id="text3108" + inkscape:label="#text7243">12 9 + inkscape:label="#text7243" + id="text3112" + y="-1277.9312" + x="812.80585" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(90)">9 6 + transform="rotate(59.999989)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="958.61719" + y="-798.08197" + id="text3116" + inkscape:label="#text7243">6 3 + inkscape:label="#text7243" + id="text3120" + y="-310.4165" + x="840.15833" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(29.999983)">3 + sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccscccccc" + id="path3181" + d="m 506.79074,113.88758 -0.0324,-47.425719 M 385.29746,129.63288 377.18964,78.83862 m 253.05616,50.9535 9.13806,-50.95457 M 268.31279,162.69358 250.97354,114.6993 m 517.15342,-6.78471 -19.35817,53.17859 m -592.55586,52.34579 -24.87585,-41.47658 m 755.15742,-5.15646 -26.03049,45.11663 M 56.304373,285.89095 24.797627,249.63565 m 973.750743,-11.0407 -35.93133,42.44737 M -31.194719,373.71054 -67.406083,344.72525 M 1091.5883,331.9981 c -22.7366,19.07137 -22.1222,18.62758 -41.5869,36.01143 m -1189.78713,85.48342 39.34258,21.065 m 1218.37775,-5.08277 50.5019,-28.23095 m -1362.66713,131.33575 43.60301,14.82023 m 1323.34702,-6.64767 54.4496,-21.37034 m -1457.14774,139.90349 47.22791,6.40119 m 1442.86453,-17.20568 -55.4851,8.78644 m 10.6902,122.76376 56.2981,0.0361 m -1462.46565,7.96423 -47.25107,0.0324 m 1498.21242,123.33728 -57.7243,-9.41248 m -1381.61201,8.6004 -45.69587,7.58449 m 1451.87638,122.46658 -53.9093,-21.2372 m -1320.24759,9.4195 -44.51888,16.9023 m 1363.01737,115.4692 -50.0037,-29.2083 m -1214.536267,7.507 -43.732403,25.4014 m 1233.65167,103.6518 -43.4214,-36.2558 m -1075.030153,5.2315 -39.744281,33.5338 39.811749,-33.4582 c -0.02153,0 -0.04303,-0.108 -0.06457,-0.108 z m 1024.548253,125.2638 -36.86245,-43.6809 m -900.186878,4.4169 -34.181692,40.9317 34.249266,-40.8993 c -0.02153,0 -0.05385,0 -0.06456,0 z m 798.648028,64.7132 -0.10761,0.108 29.93113,51.8828 -29.83428,-51.9584 z m -697.87744,4.6547 -27.17968,47.3037 27.24747,-47.2713 c -0.0215,0 -0.0431,0 -0.0646,0 z m 588.22899,47.2713 c -0.0323,0 -0.0646,0 -0.0968,0 l 20.30917,55.814 -20.20802,-55.8464 z m -477.172,3.402 -18.96736,52.4444 19.06851,-52.412 c -0.0323,0 -0.0646,0 -0.0968,0 z m 360.18171,28.6629 c -0.0322,0 -0.0646,0 -0.0968,0 l 10.22129,57.9201 -10.1223,-57.9525 z m -242.25419,1.8469 -9.81996,56.1056 9.92108,-56.1056 c -0.0322,0 -0.0646,0 -0.0967,0 z m 121.21156,9.4823 0.0646,58.1576 0.0646,-58.1576 c -0.0431,0 -0.0861,0 -0.13344,0 z" + style="fill:#ededed;fill-opacity:1;fill-rule:nonzero;stroke:#ededed;stroke-width:5.39007;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:connector-curvature="0" /> 1 + inkscape:label="#text7243" + id="text3553" + y="-41.774002" + x="630.51953" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(10)">1 2 + transform="rotate(20)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="749.66882" + y="-169.55167" + id="text3557" + inkscape:label="#text7243">2 4 + inkscape:label="#text7243" + id="text3561" + y="-467.84677" + x="906.01428" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(40.000001)">4 5 + transform="rotate(50.000001)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="946.68445" + y="-629.89954" + id="text3565" + inkscape:label="#text7243">5 7 + inkscape:label="#text7243" + id="text3569" + y="-965.50079" + x="935.96802" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(70.000001)">7 8 + transform="rotate(80.000001)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="885.99927" + y="-1130.7375" + id="text3573" + inkscape:label="#text7243">8 10 + inkscape:label="#text7243" + id="text3577" + y="-1413.2047" + x="694.41644" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(100)">10 11 + transform="rotate(110)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="574.31689" + y="-1532.7445" + id="text3581" + inkscape:label="#text7243">11 13 + inkscape:label="#text7243" + id="text3585" + y="-1686.1906" + x="275.10657" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(130)">13 14 + transform="rotate(140)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="107.89569" + y="-1721.7783" + id="text3589" + inkscape:label="#text7243">14 16 + inkscape:label="#text7243" + id="text3593" + y="-1712.662" + x="-225.14418" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(160)">16 17 + transform="rotate(170)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-388.07861" + y="-1663.1273" + id="text3597" + inkscape:label="#text7243">17 19 + inkscape:label="#text7243" + id="text3601" + y="-1485.8134" + x="-674.18842" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(-170)">19 20 + transform="rotate(-160)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-788.46277" + y="-1361.9167" + id="text3605" + inkscape:label="#text7243">20 22 + inkscape:label="#text7243" + id="text3609" + y="-1057.6316" + x="-948.54529" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(-140)">22 23 + transform="rotate(-130)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-986.69818" + y="-891.58624" + id="text3613" + inkscape:label="#text7243">23 25 + inkscape:label="#text7243" + id="text3617" + y="-554.00256" + x="-977.29974" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(-110)">25 26 + transform="rotate(-99.999999)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-927.61865" + y="-391.20975" + id="text3621" + inkscape:label="#text7243">26 28 + inkscape:label="#text7243" + id="text3625" + y="-109.09068" + x="-748.75885" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(-80)">28 29 + transform="rotate(-70)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-626.797" + y="1.9003587" + id="text3629" + inkscape:label="#text7243">29 31 + inkscape:label="#text7243" + id="text3633" + y="163.85368" + x="-329.55032" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(-49.999999)">31 32 + transform="rotate(-39.999999)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-165.2688" + y="201.06667" + id="text3637" + inkscape:label="#text7243">32 34 + inkscape:label="#text7243" + id="text3641" + y="190.6203" + x="170.84694" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(-19.999999)">34 35 + transform="rotate(-9.9999995)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="334.76819" + y="141.04767" + id="text3645" + inkscape:label="#text7243">35 999°/ 99 + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + x="36.862175" + y="92.904839" + id="wind" + inkscape:label="#text7243">999°/ 99 999 + inkscape:label="#text7243" + id="gs" + y="53.306854" + x="101.87437" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + xml:space="preserve">999 999 + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + x="248.49673" + y="53.306854" + id="tas" + inkscape:label="#text7243">999 GS + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#ededed;fill-opacity:1;stroke:none" + x="38.276394" + y="53.306854" + id="gsLbl" + inkscape:label="#text7243">GS TAS + inkscape:label="#text7243" + id="tasLbl" + y="53.306854" + x="170.17084" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve">TAS 999 + id="hdgGroup" + inkscape:label="#g3141">999 HDG + inkscape:label="#text7243" + id="hdgTrk" + y="67.549522" + x="373.44498" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + xml:space="preserve">HDG MAG + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + x="578.66278" + y="67.549522" + id="truMag" + inkscape:label="#text7243">MAG VOR 1 + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + x="71.73262" + y="913.5495" + id="vorL" + inkscape:label="#text7243">VOR 1 NM + inkscape:label="#text7243" + id="dmeL" + y="993.85461" + x="151.73262" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#179ab7;fill-opacity:1;stroke:none" + xml:space="preserve">NM 99.9 + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + x="71.129601" + y="993.85461" + id="dmeLDist" + inkscape:label="#text7243">99.9 ABC + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + x="71.73262" + y="954.56171" + id="vorLId" + inkscape:label="#text7243">ABC VOR 2 + inkscape:label="#text7243" + id="vorR" + y="913.5495" + x="859.7326" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + xml:space="preserve">VOR 2 NM + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#179ab7;fill-opacity:1;stroke:none" + x="931.7326" + y="993.85461" + id="dmeR" + inkscape:label="#text7243">NM 99.9 + inkscape:label="#text7243" + id="dmeRDist" + y="993.85461" + x="859.12958" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + xml:space="preserve">99.9 ABC + inkscape:label="#text7243" + id="vorRId" + y="954.56171" + x="859.7326" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + xml:space="preserve">ABC 08 34.4z + inkscape:label="#text7243" + id="eta" + y="126.06245" + x="892.04407" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none" + xml:space="preserve">08 34.4z 99 + inkscape:connector-curvature="0" + id="path3159" + d="m 434.872,733.378 44.548,53.034" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />99 + id="trkInd" + inkscape:label="#g3107" + inkscape:transform-center-y="-318.607" + inkscape:transform-center-x="-0.165">  + inkscape:transform-center-x="-0.198874" + inkscape:transform-center-y="4.4952743" + inkscape:label="#g4072" + id="staArrowL" + style="display:inline;stroke:#cecdce" + transform="matrix(1,0,0,1.1805235,0.174175,-281.5729)">  + inkscape:label="#text7243" + id="status.arpt" + y="734.12946" + x="41.732624" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0099d9;fill-opacity:0;stroke:none" + xml:space="preserve">  + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0099d9;fill-opacity:1;stroke:none" + x="41.732624" + y="697.12939" + id="status.wpt" + inkscape:label="#text7243">  + inkscape:label="#text7243" + id="status.sta" + y="661.12933" + x="41.732624" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0099d9;fill-opacity:1;stroke:none" + xml:space="preserve">  NM + id="hdgBug" + inkscape:label="#g3190" + inkscape:transform-center-y="-698.613" + transform="translate(0,-19.021655)">NM ILS + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#cecdce;fill-opacity:1;stroke:none" + x="785.289" + y="53.929054" + id="ilsLbl" + inkscape:label="#text7243">ILS 999.99 + inkscape:label="#text7243" + id="ilsFreq" + y="53.929054" + x="888.28894" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#af0063;fill-opacity:1;stroke:none" + xml:space="preserve">999.99 360 + style="fill:none;stroke:#cecdce;stroke-width:2.4611;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="m 20.951614,914.85538 v 82.41763 m 4.201291,-92.8082 -4.04,-8.83104 -4.040001,8.50433 L 12,914.85538 h 8.951614 l 8.467743,0.21255 z" + id="vorLSym" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccccccc" + inkscape:label="#path3100" + inkscape:transform-center-y="-498.20098" + inkscape:transform-center-x="-0.080644898" />360 00' 00'' + id="chrono_box" + transform="matrix(0.8,0,0,0.8,4.598825,187.15349)" + inkscape:label="Chrono">00' 00'' 99 + inkscape:label="#text7243" + id="range_r" + y="648.10156" + x="863.21796" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#179ab7;fill-opacity:1;stroke:none" + xml:space="preserve">99 .1L + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:Sans;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#0dc04b;fill-opacity:0.988235;stroke:none" + x="445.28204" + y="833.28204" + id="legDistL" + inkscape:label="#leg_dist_l">.1L .1L + id="legDistR" + y="833.28204" + x="555.28204" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:Sans;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#0dc04b;fill-opacity:0.988235;stroke:none" + xml:space="preserve" + inkscape:label="#leg_dist_r">.1L OFST + inkscape:label="#offset_lbl" + id="offsetLbl" + y="739.28204" + x="13.282043" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:Sans;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#0dc04b;fill-opacity:0.988235;stroke:none" + xml:space="preserve">OFST .1L + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:Sans;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#0dc04b;fill-opacity:1;stroke:none" + x="442.35898" + y="527.74359" + id="legDistCtrL" + inkscape:label="#text4463">.1L .1L + inkscape:label="#text4463" + id="legDistCtrR" + y="527.74359" + x="552.35901" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:Sans;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#0dc04b;fill-opacity:1;stroke:none" + xml:space="preserve">.1L N + inkscape:label="#locPtr" + sodipodi:nodetypes="ccccsc" />N 33 + transform="rotate(-30.000011)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-7.8740234" + y="204.77251" + id="text3924" + inkscape:label="#text7243">33 30 + inkscape:label="#text7243" + id="text3928" + y="90.638428" + x="-495.84357" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(-60.000017)">30 W + transform="rotate(-90)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-855.73431" + y="-255.34297" + id="text3932" + inkscape:label="#text7243">W 24 + inkscape:label="#text7243" + id="text3936" + y="-732.65826" + x="-1009.933" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(-120.00001)">24 21 + transform="rotate(-150.00002)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-896.57874" + y="-1222.205" + id="text3940" + inkscape:label="#text7243">21 S + inkscape:label="#text7243" + id="text3944" + y="-1583.8081" + x="-531.64703" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="scale(-1)">S 15 + transform="rotate(149.99999)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="-66.888977" + y="-1735.4456" + id="text3948" + inkscape:label="#text7243">15 12 + inkscape:label="#text7243" + id="text3952" + y="-1623.8905" + x="422.39053" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(119.99998)">12 E + transform="rotate(90)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="801.43085" + y="-1265.2094" + id="text3956" + inkscape:label="#text7243">E 6 + inkscape:label="#text7243" + id="text3960" + y="-802.38336" + x="950.93414" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + xml:space="preserve" + transform="rotate(59.999989)">6 3 + transform="rotate(29.999983)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none" + x="835.90314" + y="-305.99823" + id="text3964" + inkscape:label="#text7243">3 CRS + inkscape:connector-curvature="0" + style="fill:#ededed;fill-opacity:1;fill-rule:nonzero;stroke:#ededed;stroke-width:10.8998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 512.67364,65.745319 -0.0325,47.605391 c 0.0217,0 0.0434,0 0.0651,0 z m -132.08525,11.581267 8.07143,45.916394 c 0.0217,0 0.0434,-0.0325 0.0651,-0.0325 l -8.13757,-45.882788 z m 264.17049,0 -8.47473,47.739814 c 0.0325,0 0.0651,0 0.0976,0 l 8.37391,-47.739814 z m -392.20212,34.301514 15.63331,43.11512 c 0.0325,-0.0108 0.0651,-0.0217 0.0976,-0.0325 z m 520.23484,0 -16.98416,46.55925 c 0.0217,0 0.0434,0.0217 0.0651,0.0325 l 16.91585,-46.59177 z m -640.40212,56.01246 22.69108,39.40104 c 0.0217,-0.0108 0.0434,-0.0217 0.0651,-0.0325 l -22.75937,-39.36635 z m 760.56398,0 -25.37974,44.12548 M 23.805421,243.67498 52.91028,278.45023 c 0.0217,-0.0217 0.0434,-0.0434 0.0651,-0.0651 l -29.172127,-34.7069 z m 977.732579,0 -33.6562,40.04065 m -1037.838534,53.71636 34.709353,29.17054 c 0.02157,-0.0217 0.04315,-0.0434 0.06483,-0.0651 L -69.958902,337.43199 Z M 1054.2218,371.87335 c 0,0.0217 0,0.0542 0,0.0651 l 41.0564,-34.50639 c -13.5626,11.43057 -27.3854,22.98257 -41.0564,34.44135 z m -1200.21482,74.14159 39.36815,22.75709 c 0.0108,-0.0217 0.0217,-0.0434 0.0325,-0.0651 l -39.40273,-22.68881 z m 1317.32372,0 -47.4853,27.38179 c 0,0.0217 0,0.0434 0,0.0651 l 47.4527,-27.4501 z m -1373.33801,120.16097 43.08267,15.73222 c 0.0108,-0.0325 0.0217,-0.0651 0.0325,-0.0976 l -43.11736,-15.6325 z m 1429.35561,0 -52.6351,19.11023 c 0,0.0325 0,0.0651 0,0.0976 l 52.6025,-19.20997 z m -1463.66001,128.02599 45.88627,8.13714 c 0,-0.0217 0.0325,-0.0434 0.0325,-0.0651 l -45.91989,-8.06992 z m 1497.96221,0 -56.3102,9.89227 c 0,0.0325 0,0.0651 0,0.0976 l 56.3102,-9.99417 z m -46.7807,132.01217 c 0,0.0434 0,0.0868 0,0.13335 l 58.3701,-0.0651 -58.3701,-0.0651 z m -1415.1555,0.0325 -47.60681,0.0325 47.60681,0.0325 c 0,-0.0217 0,-0.0434 0,-0.0651 z m 1403.772,121.80989 c 0,0.0325 0,0.0651 0,0.0976 l 58.1642,10.19798 -58.1642,-10.2988 z m -1392.05569,1.82451 -47.74232,8.47429 47.74232,-8.37238 c 0,-0.0325 0,-0.0651 0,-0.0976 z M 1171.3307,1065.9269 v 0.1085 l 56.0501,20.3483 -56.0176,-20.4567 z m -1326.77633,3.4799 -46.56168,16.9768 46.5942,-16.9118 c 0,0 -0.0217,0 -0.0325,-0.1084 z m 1274.68343,106.9774 -0.1085,0.1084 52.1688,30.0508 -52.0929,-30.1592 z m -1221.16921,4.6616 -44.06161,25.4976 44.09511,-25.4325 c -0.0108,0 -0.0217,0 -0.0325,-0.1085 z m 1150.91681,95.1392 c 0,0 0,0 -0.1084,0.1084 l 46.3904,38.8644 -46.3254,-38.9294 z m -1078.898623,5.2687 -40.043511,33.6607 40.111486,-33.5848 c -0.02168,0 -0.04337,-0.1085 -0.06505,-0.1085 z m 992.587903,81.0244 c 0,0 0,0 -0.1085,0.1085 l 38.93922,46.3121 -38.86322,-46.3879 z m -904.430192,5.3011 -34.439067,41.0869 34.507147,-41.0543 c -0.0217,0 -0.0542,0 -0.0651,0 z m 804.660922,64.9584 -0.10842,0.1085 30.15647,52.0794 -30.0589,-52.1552 z m -703.13161,4.6724 -27.38432,47.4829 27.45262,-47.4504 c -0.0217,0 -0.0434,0 -0.0651,0 z m 592.65763,47.4504 c -0.0325,0 -0.0651,0 -0.0976,0 l 20.46209,56.0254 -20.36018,-56.058 z m -480.76452,3.4148 -19.11015,52.6432 19.21206,-52.6106 c -0.0325,0 -0.0651,0 -0.0976,0 z m 362.89345,28.7717 c -0.0325,0 -0.0651,0 -0.0976,0 l 10.29826,58.1394 -10.19852,-58.172 z m -244.07809,1.8537 -9.89388,56.3181 9.99579,-56.3181 c -0.0325,0 -0.0651,0 -0.0976,0 z m 122.12415,9.5183 0.0651,58.3779 0.0651,-58.3779 c -0.0434,0 -0.0868,0 -0.13444,0 z" + id="path3968" + sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccscccscccscccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccscccccc" />CRS + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#ededed;fill-opacity:1;stroke:none" + x="854.72168" + y="124.87983" + id="dmeLbl" + inkscape:label="#text7243">  999 + inkscape:label="#text7243" + id="crs" + y="90.062439" + x="913.95801" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#179ab7;fill-opacity:1;stroke:none" + xml:space="preserve">999 99.9 + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#ededed;fill-opacity:1;stroke:none" + x="913.95801" + y="126.12444" + id="dme" + inkscape:label="#text7243">99.9 ILS APP + id="gsGroup" + transform="rotate(-90,1200.426,445.834)" + inkscape:label="#g4160">ILS APP N + style="display:inline" + id="planArcs" + inkscape:label="#g3956" + transform="matrix(1.02827,0,0,1.0306342,-14.7256,-31.455079)">N W + sodipodi:nodetypes="ccccccccc" + inkscape:connector-curvature="0" + id="path3576" + d="M 499.2445,114.47708 512.24986,93.983218 525.2545,114.47708 Z" + style="display:inline;fill:#cecdce;stroke:none" + inkscape:label="#path4994" + inkscape:transform-center-y="711.514" />W E + id="text3209" + y="530.25165" + x="894.65656" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#cecdce;fill-opacity:1;stroke:none" + xml:space="preserve">E S + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#cecdce;fill-opacity:1;stroke:none" + x="501.9375" + y="922.25531" + id="text3213">S 99 + inkscape:label="#path4994" + style="display:inline;fill:#cecdce;stroke:none" + d="M 105.51917,531.817 85.025313,518.81164 105.51917,505.807 Z" + id="path3863" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccccccc" + inkscape:transform-center-x="-711.514" />99 99 + inkscape:label="#text7243" + id="rangePln1" + y="102.56212" + x="512.06421" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;display:inline;fill:#ededed;fill-opacity:0;stroke:none" + xml:space="preserve">99 99 + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;display:inline;fill:#179ab7;fill-opacity:1;stroke:none" + x="374.21063" + y="666.73596" + id="rangePln3" + inkscape:label="#text7243">99 99 + inkscape:label="#text7243" + id="rangePln4" + y="818.55823" + x="231.77499" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;display:inline;fill:#179ab7;fill-opacity:1;stroke:none" + xml:space="preserve">99 99 + inkscape:label="#text7243" + id="rangePln5" + y="560.56152" + x="993.04187" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;display:inline;fill:#179ab7;fill-opacity:1;stroke:none" + xml:space="preserve">99 \ No newline at end of file + transform="matrix(1.02827,0,0,1.02827,9.2744,-29.1838)" + inkscape:label="#g3956" + id="g3230" + style="display:inline" />GPS PRIMARY LOSTHDGMAP NOT AVAIL From 6c5030d813174efe73bd9b072143770241ca1df3 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 26 Oct 2020 20:27:25 +0000 Subject: [PATCH 02/33] Bugfix the roll on IESI, and add pitch arrows --- Models/Instruments/IESI/IESI.nas | 4 +- Models/Instruments/IESI/res/iesi.svg | 178 ++++++++++++++++----------- 2 files changed, 111 insertions(+), 71 deletions(-) diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index b566aa0a..d5d8bcde 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -184,10 +184,10 @@ var canvas_IESI = { # Attitude me._roll = pts.Orientation.roll.getValue(); me.AI_horizon_trans.setTranslation(0, pitch.getValue() * 16.74); - me.AI_horizon_rot.setRotation(me._roll * D2R, me["AI_center"].getCenter()); + me.AI_horizon_rot.setRotation(-me._roll * D2R, me["AI_center"].getCenter()); me["AI_slipskid"].setTranslation(skid.getValue(), 0); - me["AI_bank"].setRotation(me._roll * D2R); + me["AI_bank"].setRotation(-me._roll * D2R); # Altitude me.altitude = altitude.getValue(); diff --git a/Models/Instruments/IESI/res/iesi.svg b/Models/Instruments/IESI/res/iesi.svg index 0e841834..a68c652f 100644 --- a/Models/Instruments/IESI/res/iesi.svg +++ b/Models/Instruments/IESI/res/iesi.svg @@ -41,9 +41,9 @@ inkscape:window-height="705" id="namedview371" showgrid="true" - inkscape:zoom="0.45254834" - inkscape:cx="247.89479" - inkscape:cy="5057.0874" + inkscape:zoom="0.90509668" + inkscape:cx="529.7525" + inkscape:cy="2142.6048" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" @@ -167,7 +167,7 @@ inkscape:label="#rect5809" /> @@ -182,7 +182,7 @@ @@ -190,11 +190,11 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4330" - d="m 478.8848,411.41322 30.07794,0" + d="m 478.8848,411.41322 h 30.07794" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.60000038;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -213,7 +213,7 @@ sodipodi:role="line">10 @@ -221,11 +221,11 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4356" - d="m 437.0192,204.95642 113.79938,0" + d="M 437.0192,204.95642 H 550.81858" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.60000038;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -233,7 +233,7 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4361" - d="m 464.4576,287.66442 58.9279,0" + d="m 464.4576,287.66442 h 58.9279" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.60000038;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -264,11 +264,11 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4383" - d="m 478.8848,80.99882 30.07794,0" + d="m 478.8848,80.99882 h 30.07794" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.60000038;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -287,7 +287,7 @@ sodipodi:role="line">30 @@ -311,8 +311,8 @@ y="-102.35725" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:72px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:end;text-anchor:end;fill:#ffffff;fill-opacity:1;stroke-width:0.75">40 @@ -333,42 +333,42 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4441" - d="M 437.0192,-546.31398 H 550.81858" - style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.60000038;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + d="M 409.24083,-546.31398 H 578.59685" + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:11.71118736;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> 80 @@ -387,13 +387,13 @@ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:72px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:end;text-anchor:end;fill:#ffffff;fill-opacity:1;stroke-width:0.75">10 @@ -401,13 +401,13 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4481" - d="m 464.4576,782.86798 58.9279,0" + d="m 464.4576,782.86798 h 58.9279" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.60000038;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -461,7 +461,7 @@ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:72px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:end;text-anchor:end;fill:#ffffff;fill-opacity:1;stroke-width:0.75">30 @@ -482,8 +482,8 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4513" - d="m 437.0192,1360.363 113.79938,-4e-4" - style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.60000038;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + d="m 422.01904,1360.363 143.79963,-4e-4" + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.60008335;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> 50 @@ -508,14 +508,54 @@ transform="scale(0.95383278,1.0484018)" id="text4557" y="1558.7142" - x="433.55658" + x="417.83078" style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:end;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.75" xml:space="preserve">80 + + + + + + + + @@ -577,7 +617,7 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4301" - d="m 831.8533,444.21199 40.80028,0" + d="m 831.8533,444.21199 h 40.80028" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:8;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -629,17 +669,17 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4317" - d="m 831.8533,547.63311 40.80028,0" + d="m 831.8533,547.63311 h 40.80028" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:8;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -647,11 +687,11 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4323" - d="m 831.8533,754.47455 40.80028,0" + d="m 831.8533,754.47455 h 40.80028" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:8;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -659,7 +699,7 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4327" - d="m 831.8533,857.89567 40.80028,0" + d="m 831.8533,857.89567 h 40.80028" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:8;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -691,11 +731,11 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4337" - d="m 831.8533,237.36975 40.80028,0" + d="m 831.8533,237.36975 h 40.80028" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:8;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -703,7 +743,7 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4341" - d="m 831.8533,340.79087 40.80028,0" + d="m 831.8533,340.79087 h 40.80028" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:8;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -729,11 +769,11 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4349" - d="m 831.8533,-72.893608 40.80028,0" + d="m 831.8533,-72.893608 h 40.80028" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:8;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -741,11 +781,11 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4353" - d="m 831.8533,30.527512 40.80028,0" + d="m 831.8533,30.527512 h 40.80028" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:8;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -768,7 +808,7 @@ @@ -827,7 +867,7 @@ sodipodi:nodetypes="cccccccc" inkscape:connector-curvature="0" id="path958" - d="m 1001.8296,610.5928 -116.9056,0 0,-22.2 -181.6688,-1.4e-4 0,-96.33104 181.6688,-2e-5 2.6e-4,-22.2 116.90534,0" + d="M 1001.8296,610.5928 H 884.924 v -22.2 l -181.6688,-1.4e-4 v -96.33104 l 181.6688,-2e-5 2.6e-4,-22.2 h 116.90534" style="fill:none;fill-opacity:1;stroke:#ffff00;stroke-width:8;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -1003,7 +1043,7 @@ sodipodi:nodetypes="cccc" inkscape:connector-curvature="0" id="AI_bank_center" - d="m 529.71671,148.28357 -71.591,0 35.7955,44.80749 z" + d="m 529.71671,148.28357 h -71.591 l 35.7955,44.80749 z" style="fill:#c9d121;fill-opacity:1;stroke:none;stroke-width:2.71116304;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" inkscape:label="#path905" /> Date: Tue, 27 Oct 2020 17:28:03 +0000 Subject: [PATCH 03/33] Improve metadata --- A320-main.xml | 74 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index 0a526661..7a7818cb 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -12,10 +12,49 @@ Josh Davidson/Octal450 (Flight Dynamics, Systems, Displays), Jonathan Redpath/legoboyvdlp, merspieler, Matthew Maring/mattmaring (Systems, Displays), Thorsten Herrmann/TH-555, Semir Gebran/CaptB (3D, Textures) + + + Josh Davidson + Flight Dynamics, Systems, Displays + Octal450 + + + Jonathan Redpath + Systems, Displays, FMGC + legoboyvdlp + + + merspieler + Systems, Displays + + + Matthew Maring + Fuel predictions, FMGC + mattmaring + + + Thorsten Herrmann + Cockpit 3D model + TH-555 + + + Semir Gebran + 3D model + CaptB + + + vezza + Systems, Displays + + + - Pre V1.0 - + Airbus A320 + The Airbus A320 is a family of narrow body airliners built by Airbus Industrie. First flown in 1987, + the aircraft is the most produced airliner ever, with over 9,500 built to date. It was one of the first airliners + to use digital flight controls and fly by wire, and a fully glass cockpit. + false false @@ -130,7 +169,7 @@ Splash/wing3.png - + 4 5 @@ -138,6 +177,8 @@ 4 + Pre V1.0 + transport airbus @@ -153,6 +194,13 @@ 2-engine + + http://wiki.flightgear.org/Airbus_A320_Family + https://forum.flightgear.org + https://en.wikipedia.org/wiki/Airbus_A320_family + https://github.com/legoboyvdlp/A320-family + + @@ -514,6 +562,26 @@ 2019.2.0 + + + M + A320 + SDE2FGHIRWXY + S + + + + 4500 + 4500 + + + 41000 + 0.82 + 350 + + + + From cbaa9f2aa8318b8363e97dd4b739cdc447cb52fc Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 27 Oct 2020 17:45:06 +0000 Subject: [PATCH 04/33] Bugfix unclearable warning --- Nasal/ECAM/ECAM-logic.nas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 37041611..5f12161e 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -1374,10 +1374,10 @@ var messages_priority_2 = func { ECAM_controller.warningReset(tcasFault); } - if (warningNodes.Timers.navTerrFault.getValue() == 1 and (phaseVar2 == 2 or phaseVar2 == 6 or phaseVar2 == 7 or phaseVar2 == 9)) { + if (gpwsTerrFault.clearFlag == 0 and warningNodes.Timers.navTerrFault.getValue() == 1 and (phaseVar2 == 2 or phaseVar2 == 6 or phaseVar2 == 7 or phaseVar2 == 9)) { gpwsTerrFault.active = 1; - if (!getprop("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit")) { + if (gpwsTerrFaultOff.clearFlag == 0 and !getprop("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit")) { gpwsTerrFaultOff.active = 1; } else { ECAM_controller.warningReset(gpwsTerrFaultOff); From 6bb53d70d1510cc8169e673840f9f8ed77913622 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 27 Oct 2020 21:35:17 +0000 Subject: [PATCH 05/33] Add framework for new Emesary based display framework. This is based off work by Richard Harrison on the F-15, making use of the FrameNotification concept --- A320-main.xml | 8 +- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 243 ++++++++++-------- .../Instruments/Upper-ECAM/Upper-ECAM.new.nas | 113 ++++++++ .../Instruments/Upper-ECAM/res/cfm-eis2.svg | 45 +++- .../Instruments/Upper-ECAM/res/iae-eis2.svg | 45 +++- Nasal/FMGC/FMGC.nas | 1 + Nasal/emesary/M_frame_notification.nas | 99 +++++++ Nasal/emesary/exec.nas | 82 ++++++ 8 files changed, 524 insertions(+), 112 deletions(-) create mode 100644 Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas create mode 100644 Nasal/emesary/M_frame_notification.nas create mode 100644 Nasal/emesary/exec.nas diff --git a/A320-main.xml b/A320-main.xml index 7a7818cb..2ea9fc51 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -1182,6 +1182,7 @@ + 0 0 0 @@ -4335,6 +4336,9 @@ + + Aircraft/A320-family/Nasal/emesary/M_frame_notification.nas + Aircraft/A320-family/Nasal/Libraries/property-tree-setup.nas @@ -4442,7 +4446,9 @@ Aircraft/A320-family/Models/Instruments/ND/canvas/ND.nas - Aircraft/A320-family/Models/Instruments/Upper-ECAM/Upper-ECAM.nas + Aircraft/A320-family/Nasal/emesary/exec.nas + + Aircraft/A320-family/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas Aircraft/A320-family/Models/Instruments/Lower-ECAM/Lower-ECAM.nas diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 875a16f3..cba5c5fe 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -118,31 +118,8 @@ var thrLimit = 0; var canvas_upperECAM_base = { init: func(canvas_group, file) { - var font_mapper = func(family, weight) { - return "LiberationFonts/LiberationSans-Regular.ttf"; - }; - canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); - - var svg_keys = me.getKeys(); - foreach(var key; svg_keys) { - me[key] = canvas_group.getElementById(key); - - var clip_el = canvas_group.getElementById(key ~ "_clip"); - if (clip_el != nil) { - clip_el.setVisible(0); - var tran_rect = clip_el.getTransformedBounds(); - - var clip_rect = sprintf("rect(%d,%d, %d,%d)", - tran_rect[1], # 0 ys - tran_rect[2], # 1 xe - tran_rect[3], # 2 ye - tran_rect[0]); #3 xs - # coordinates are top,right,bottom,left (ys, xe, ye, xs) ref: l621 of simgear/canvas/CanvasElement.cxx - me[key].set("clip", clip_rect); - me[key].set("clip-frame", canvas.Element.PARENT); - } - } + # set font me["ECAML1"].setFont("LiberationMonoCustom.ttf"); @@ -199,29 +176,30 @@ var canvas_upperECAM_base = { update: func() { elapsedtime = pts.Sim.Time.elapsedSec.getValue(); cur_eng_option = eng_option.getValue(); - - if (systems.ELEC.Bus.acEss.getValue() >= 110 and du3_lgt.getValue() > 0.01) { - if (du3_test_time.getValue() + du3_test_amount.getValue() >= elapsedtime) { - upperECAM_cfm_eis2.page.hide(); - upperECAM_iae_eis2.page.hide(); - upperECAM_test.page.show(); - upperECAM_test.update(); + if (1 == 0) { + if (systems.ELEC.Bus.acEss.getValue() >= 110 and du3_lgt.getValue() > 0.01) { + if (du3_test_time.getValue() + du3_test_amount.getValue() >= elapsedtime) { + upperECAM_cfm_eis2.page.hide(); + upperECAM_iae_eis2.page.hide(); + upperECAM_test.page.show(); + upperECAM_test.update(); + } else { + upperECAM_test.page.hide(); + if (cur_eng_option == "CFM") { + upperECAM_cfm_eis2.page.show(); + upperECAM_iae_eis2.page.hide(); + upperECAM_cfm_eis2.update(); + } else if (cur_eng_option == "IAE") { + upperECAM_cfm_eis2.page.hide(); + upperECAM_iae_eis2.page.show(); + upperECAM_iae_eis2.update(); + } + } } else { upperECAM_test.page.hide(); - if (cur_eng_option == "CFM") { - upperECAM_cfm_eis2.page.show(); - upperECAM_iae_eis2.page.hide(); - upperECAM_cfm_eis2.update(); - } else if (cur_eng_option == "IAE") { - upperECAM_cfm_eis2.page.hide(); - upperECAM_iae_eis2.page.show(); - upperECAM_iae_eis2.update(); - } + upperECAM_cfm_eis2.page.hide(); + upperECAM_iae_eis2.page.hide(); } - } else { - upperECAM_test.page.hide(); - upperECAM_cfm_eis2.page.hide(); - upperECAM_iae_eis2.page.hide(); } }, getColorString: func(color) { @@ -241,7 +219,7 @@ var canvas_upperECAM_base = { return [1,1,1]; } }, - updateBase: func() { + updateBase: func(notification) { # Reversers rev_1_cur = pts.Engines.Engine.reverser[0].getValue(); rev_2_cur = pts.Engines.Engine.reverser[1].getValue(); @@ -280,27 +258,6 @@ var canvas_upperECAM_base = { me["REV2"].setColor(0.7333,0.3803,0); } - # Flap Indicator - flapsPos = pts.Controls.Flight.flapsPos.getValue(); - if (flapsPos == 1) { - me["FlapTxt"].setText("1"); - } else if (flapsPos == 2) { - me["FlapTxt"].setText("1+F"); - } else if (flapsPos == 3) { - me["FlapTxt"].setText("2"); - } else if (flapsPos == 4) { - me["FlapTxt"].setText("3"); - } else if (flapsPos == 5) { - me["FlapTxt"].setText("FULL"); - } else { - me["FlapTxt"].setText(" "); # More efficient then hide/show - } - - if (flapsPos > 0) { - me["FlapDots"].show(); - } else { - me["FlapDots"].hide(); - } if (pts.Fdm.JSBsim.Fcs.slatLocked.getValue()) { if (slatLockGoing == 0) { @@ -325,16 +282,6 @@ var canvas_upperECAM_base = { me["FlapLine"].setTranslation(flapXTranslate.getValue(),flapYTranslate.getValue()); me["SlatLine"].setTranslation(slatXTranslate.getValue(),slatYTranslate.getValue()); - # FOB - if (acconfig_weight_kgs.getValue()) - { - me["FOB-LBS"].setText(sprintf("%s", math.round(pts.Consumables.Fuel.totalFuelLbs.getValue() * LBS2KGS, 10))); - me["FOB-weight-unit"].setText("KG"); - } else { - me["FOB-LBS"].setText(sprintf("%s", math.round(pts.Consumables.Fuel.totalFuelLbs.getValue(), 10))); - me["FOB-weight-unit"].setText("LBS"); - } - # ECAM Messages me["ECAML1"].setText(sprintf("%s", ECAM_line1.getValue())); @@ -358,24 +305,70 @@ var canvas_upperECAM_base = { me["ECAMR8"].setText(sprintf("%s", ECAM_line8r.getValue())); me["ECAM_Right"].show(); + + foreach(var update_item; me.update_items) + { + update_item.update(notification); + } }, + updateAFloor: func() { + if (fadec.Thrust.alphaFloor.getBoolValue()) { + me["aFloor"].show(); + } else { + me["aFloor"].hide(); + } + }, + updateFlaps: func() { + # Flap Indicator + flapsPos = pts.Controls.Flight.flapsPos.getValue(); + if (flapsPos == 1) { + me["FlapTxt"].setText("1"); + } else if (flapsPos == 2) { + me["FlapTxt"].setText("1+F"); + } else if (flapsPos == 3) { + me["FlapTxt"].setText("2"); + } else if (flapsPos == 4) { + me["FlapTxt"].setText("3"); + } else if (flapsPos == 5) { + me["FlapTxt"].setText("FULL"); + } else { + me["FlapTxt"].setText(" "); # More efficient then hide/show + } + + if (flapsPos > 0) { + me["FlapDots"].show(); + } else { + me["FlapDots"].hide(); + } + }, + updateFlx: func() { + if (fadec.Thrust.thrustLimit.getValue() == "FLX") { + me["FlxLimDegreesC"].show(); + me["FlxLimTemp"].show(); + me["FlxLimTemp"].setText(sprintf("%2.0d",fmgc.FMGCNodes.flexTemp.getValue())); + } else { + me["FlxLimDegreesC"].hide(); + me["FlxLimTemp"].hide(); + } + }, + update_items: [ + props.UpdateManager.FromHashValue("fuelTotalLbs", 1, func(val) { + # FOB + + }), + ], }; var canvas_upperECAM_cfm_eis2 = { new: func(canvas_group, file) { var m = {parents: [canvas_upperECAM_cfm_eis2, canvas_upperECAM_base]}; m.init(canvas_group, file); - + m.updateAFloor(); + m.updateFlx(); return m; }, - getKeys: func() { - return ["N11-needle","N11-thr","N11-ylim","N11","N11-decpnt","N11-decimal","N11-box","N11-scale","N11-scale2","N11-scaletick","N11-scalenum","N11-XX","N11-XX2","N11-XX-box","EGT1-needle","EGT1","EGT1-scale","EGT1-box","EGT1-scale2","EGT1-scaletick", - "EGT1-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal","N12-box","N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N12-XX2","N12-XX-box","EGT2-needle","EGT2", - "EGT2-scale","EGT2-box","EGT2-scale2","EGT2-scaletick","EGT2-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","N1Lim-mode","N1Lim","N1Lim-decpnt","N1Lim-decimal","N1Lim-percent","N1Lim-XX","N1Lim-XX2","REV1", - "REV1-box","REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8","ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", - "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine"]; - }, - update: func() { + + update: func(notification) { # N1 N1_1_cur = N1_1.getValue(); N1_2_cur = N1_2.getValue(); @@ -615,7 +608,7 @@ var canvas_upperECAM_cfm_eis2 = { me["N1Lim-percent"].hide(); } - me.updateBase(); + me.updateBase(notification); }, }; @@ -623,7 +616,8 @@ var canvas_upperECAM_iae_eis2 = { new: func(canvas_group, file) { var m = {parents: [canvas_upperECAM_iae_eis2, canvas_upperECAM_base]}; m.init(canvas_group, file); - + m.updateAFloor(); + m.updateFlx(); return m; }, getKeys: func() { @@ -632,9 +626,9 @@ var canvas_upperECAM_iae_eis2 = { "EPR2-decimal","EPR2-box","EPR2-scale","EPR2-scaletick","EPR2-scalenum","EPR2-XX","EPR2-XX2","EGT2-needle","EGT2","EGT2-scale","EGT2-scale2","EGT2-box","EGT2-scaletick","EGT2-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal", "N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","EPRLim-mode","EPRLim","EPRLim-decpnt","EPRLim-decimal","EPRLim-XX","EPRLim-XX2","REV1","REV1-box", "REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8", "ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", - "FFlow1-weight-unit", "FFlow2-weight-unit", "FOB-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine"]; + "FFlow1-weight-unit", "FFlow2-weight-unit", "FOB-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; }, - update: func() { + update: func(notification) { N1_1_cur = N1_1.getValue(); N1_2_cur = N1_2.getValue(); N1_1_act = pts.Engines.Engine.n1Actual[0].getValue(); @@ -942,7 +936,7 @@ var canvas_upperECAM_iae_eis2 = { me["EPRLim-decimal"].hide(); } - me.updateBase(); + me.updateBase(notification); }, }; @@ -1009,22 +1003,58 @@ var createListenerForLine = func(prop, node, key) { }, 0, 0); }; +var _init = 0; + + +var UpperECAMRecipientCFM = +{ + new: func(_ident, group) + { + var new_class = emesary.Recipient.new(_ident); + new_class.MainScreen = nil; + new_class.Receive = func(notification) + { + if (notification.NotificationType == "FrameNotification") + { + if (new_class.MainScreen == nil) + new_class.MainScreen = canvas_upperECAM_cfm_eis2.new(group, "Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg"); + upperECAM_cfm_eis2 = new_class.MainScreen; + if (!math.mod(notifications.frameNotification.FrameCount,2)){ + new_class.MainScreen.update(notification); + } + return emesary.Transmitter.ReceiptStatus_OK; + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + return new_class; + }, +}; + +var UpperECAMRecipientIAE = +{ + new: func(_ident, group) + { + var new_class = emesary.Recipient.new(_ident); + new_class.MainScreen = nil; + new_class.Receive = func(notification) + { + if (notification.NotificationType == "FrameNotification") + { + if (new_class.MainScreen == nil) + new_class.MainScreen = canvas_upperECAM_iae_eis2.new(group, "Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/iae-eis2.svg"); + upperECAM_iae_eis2 = new_class.MainScreen; + if (!math.mod(notifications.frameNotification.FrameCount,2)){ + new_class.MainScreen.update(notification); + } + return emesary.Transmitter.ReceiptStatus_OK; + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + return new_class; + }, +}; setlistener("sim/signals/fdm-initialized", func { - upperECAM_display = canvas.new({ - "name": "upperECAM", - "size": [1024, 1024], - "view": [1024, 1024], - "mipmapping": 1 - }); - upperECAM_display.addPlacement({"node": "uecam.screen"}); - var group_cfm_eis2 = upperECAM_display.createGroup(); - var group_iae_eis2 = upperECAM_display.createGroup(); - var group_test = upperECAM_display.createGroup(); - - upperECAM_cfm_eis2 = canvas_upperECAM_cfm_eis2.new(group_cfm_eis2, "Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg"); - upperECAM_iae_eis2 = canvas_upperECAM_iae_eis2.new(group_iae_eis2, "Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/iae-eis2.svg"); - upperECAM_test = canvas_upperECAM_test.new(group_test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg"); createListenerForLine("/ECAM/msg/linec1", ECAM_line1c, "ECAML1"); createListenerForLine("/ECAM/msg/linec2", ECAM_line2c, "ECAML2"); @@ -1044,6 +1074,10 @@ setlistener("sim/signals/fdm-initialized", func { createListenerForLine("/ECAM/rightmsg/linec7", ECAM_line7rc, "ECAMR7"); createListenerForLine("/ECAM/rightmsg/linec8", ECAM_line8rc, "ECAMR8"); + if (!_init) { + + } + upperECAM_update.start(); if (rate.getValue() > 1) { u_rateApply(); @@ -1067,7 +1101,6 @@ setlistener("/systems/electrical/bus/ac-ess", func() { canvas_upperECAM_base.updateDu3(); }, 0, 0); - var slatLockGoing = 0; var slatLockTimer = maketimer(0.50, func { if (!slatLockFlash.getBoolValue()) { diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas new file mode 100644 index 00000000..0fea646d --- /dev/null +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas @@ -0,0 +1,113 @@ +var canvas_upperECAM = { + new: func(svg) { + var obj = {parents: [canvas_upperECAM] }; + obj.canvas = canvas.new({ + "name": "upperECAM", + "size": [1024, 1024], + "view": [1024, 1024], + "mipmapping": 1, + }); + + obj.canvas.addPlacement({"node": "uecam.screen"}); + obj.group = obj.canvas.createGroup(); + + obj.font_mapper = func(family, weight) { + return "LiberationFonts/LiberationSans-Regular.ttf"; + }; + + canvas.parsesvg(obj.group, svg, {"font-mapper": obj.font_mapper} ); + + foreach(var key; obj.getKeys()) { + obj[key] = obj.group.getElementById(key); + + var clip_el = obj.group.getElementById(key ~ "_clip"); + if (clip_el != nil) { + clip_el.setVisible(0); + var tran_rect = clip_el.getTransformedBounds(); + + var clip_rect = sprintf("rect(%d,%d, %d,%d)", + tran_rect[1], + tran_rect[2], + tran_rect[3], + tran_rect[0]); + obj[key].set("clip", clip_rect); + obj[key].set("clip-frame", canvas.Element.PARENT); + } + }; + + obj.update_items = [ + props.UpdateManager.FromHashValue("fuelTotalLbs", 1, func(val) { + if (acconfig_weight_kgs.getValue()) + { + obj["FOB-LBS"].setText(sprintf("%s", math.round(val * LBS2KGS, 10))); + obj["FOB-weight-unit"].setText("KG"); + } else { + obj["FOB-LBS"].setText(sprintf("%s", math.round(val, 10))); + obj["FOB-weight-unit"].setText("LBS"); + } + }), + props.UpdateManager.FromHashList(["AcEssBus", "DisplayBrightness"], 0.01, func(val) { + if (val.DisplayBrightness > 0.01 and val.AcEssBus >= 110) { + obj.group.setVisible(1); + } else { + obj.group.setVisible(0); + } + }), + ]; + + obj.page = obj.group; + return obj; + }, + getKeys: func() { + return ["N11-needle","N11-thr","N11-ylim","N11","N11-decpnt","N11-decimal","N11-box","N11-scale","N11-scale2","N11-scaletick","N11-scalenum","N11-XX","N11-XX2","N11-XX-box","EGT1-needle","EGT1","EGT1-scale","EGT1-box","EGT1-scale2","EGT1-scaletick", + "EGT1-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal","N12-box","N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N12-XX2","N12-XX-box","EGT2-needle","EGT2", + "EGT2-scale","EGT2-box","EGT2-scale2","EGT2-scaletick","EGT2-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","N1Lim-mode","N1Lim","N1Lim-decpnt","N1Lim-decimal","N1Lim-percent","N1Lim-XX","N1Lim-XX2","REV1", + "REV1-box","REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8","ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", + "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; + }, + update: func(notification) { + foreach(var update_item; me.update_items) + { + update_item.update(notification); + } + }, +}; + +var UpperECAMRecipient = +{ + new: func(_ident) + { + var new_class = emesary.Recipient.new(_ident); + new_class.MainScreen = nil; + new_class.Receive = func(notification) + { + if (notification.NotificationType == "FrameNotification") + { + if (new_class.MainScreen == nil) + new_class.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 Upper ECAM CFM"); + if (!math.mod(notifications.frameNotification.FrameCount,2)){ + new_class.MainScreen.update(notification); + } + return emesary.Transmitter.ReceiptStatus_OK; + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + return new_class; + }, +}; + +emesary.GlobalTransmitter.Register(UpperECAMRecipient.new("A320 Upper ECAM")); + +input = { + fuelTotalLbs: "/consumables/fuel/total-fuel-lbs", + AcEssBus: "/systems/electrical/bus/ac-ess", + DisplayBrightness: "/controls/lighting/DU/du3", +}; + +foreach (var name; keys(input)) { + emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Upper ECAM", name, input[name])); +} + +setlistener("/sim/signals/fdm-initialized", func() { + execLoop(); +}, 0, 0); \ No newline at end of file diff --git a/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg b/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg index 7ebab94f..46d3e37b 100644 --- a/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg +++ b/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg @@ -41,9 +41,9 @@ inkscape:window-height="705" id="namedview371" showgrid="true" - inkscape:zoom="1" - inkscape:cx="718.57047" - inkscape:cy="505.8628" + inkscape:zoom="0.25" + inkscape:cx="971.41703" + inkscape:cy="1420.8195" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" @@ -1428,4 +1428,43 @@ width="137.63597" id="SlatLine_clip" style="opacity:0.5;fill:none;fill-opacity:1;stroke:none;stroke-width:3.34691048;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" /> + A FLOOR + 00 + °C diff --git a/Models/Instruments/Upper-ECAM/res/iae-eis2.svg b/Models/Instruments/Upper-ECAM/res/iae-eis2.svg index 627986e2..f7500ea6 100644 --- a/Models/Instruments/Upper-ECAM/res/iae-eis2.svg +++ b/Models/Instruments/Upper-ECAM/res/iae-eis2.svg @@ -42,8 +42,8 @@ id="namedview371" showgrid="false" inkscape:zoom="0.43942712" - inkscape:cx="180.81625" - inkscape:cy="433.53356" + inkscape:cx="623.25944" + inkscape:cy="936.15332" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" @@ -1755,7 +1755,7 @@ x="650.08069" y="575.68427" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.25px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#0dc04b;fill-opacity:1;stroke-width:0.75">A-LOCK - + A FLOOR + 00 + °C diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index ab1292f2..243affc8 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -247,6 +247,7 @@ var postInit = func() { var FMGCNodes = { costIndex: props.globals.initNode("/FMGC/internal/cost-index", 0, "DOUBLE"), flexSet: props.globals.initNode("/FMGC/internal/flex-set", 0, "BOOL"), + flexTemp: props.globals.initNode("/FMGC/internal/flex", 0, "INT"), mngSpdAlt: props.globals.getNode("/FMGC/internal/mng-alt-spd"), mngMachAlt: props.globals.getNode("/FMGC/internal/mng-alt-mach"), toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"), diff --git a/Nasal/emesary/M_frame_notification.nas b/Nasal/emesary/M_frame_notification.nas new file mode 100644 index 00000000..713b75a6 --- /dev/null +++ b/Nasal/emesary/M_frame_notification.nas @@ -0,0 +1,99 @@ + #--------------------------------------------------------------------------- + # + # Title : Emesary based rt exec frame notifications + # + # File Type : Implementation File + # + # Description : Uses emesary notifications to permit nasal subsystems to be notified each frame. + # : A frame is defined by the timer rate; which is usually the maximum rate as determined by the FPS. + # : This is an alternative to the timer based or explicit function calling way of invoking + # : aircraft systems. + # : It has the advantage of using less timers and remaining modular, as each aircraft subsytem + # : can simply register itself with the global transmitter to receive the frame notification. + # + # Author : Richard Harrison (richard@zaretto.com) + # + # Creation Date : 4 June 2018 + # + # Version : 1.0 + # + # Copyright (C) 2018 Richard Harrison Released under GPL V2 + # + #---------------------------------------------------------------------------*/ + + +var FrameNotification = +{ + debug: 0, + new: func(_rate) + { + var new_class = emesary.Notification.new("FrameNotification", _rate); + new_class.Rate = _rate; + new_class.FrameRate = 60; + new_class.FrameCount = 0; + new_class.ElapsedSeconds = 0; + new_class.monitored = {}; + new_class.properties = {}; + + # + # embed a recipient within this notification to allow the monitored property + # mapping list to be modified. + new_class.Recipient = emesary.Recipient.new("FrameNotification"); + new_class.Recipient.Receive = func(notification) + { + if (notification.NotificationType == "FrameNotificationAddProperty") + { + var root_node = props.globals; + if (notification.root_node != nil) { + root_node = notification.root_node; + } + if (new_class.properties[notification.property] != nil + and new_class.properties[notification.property] != notification.variable) + print("[WARNING]: (",notification.module,") FrameNotification: already have variable ",new_class.properties[notification.property]," for ",notification.variable, " referencing property ",notification.property); + + if (new_class.monitored[notification.variable] != nil + and new_class.monitored[notification.variable].getPath() != notification.property + and new_class.monitored[notification.variable].getPath() != "/"~notification.property) + print("[WARNING]: (",notification.module,") FrameNotification: already have variable ",notification.variable,"=",new_class.monitored[notification.variable].getPath(), " using different property ",notification.property); + # else if (new_class.monitored[notification.variable] == nil) + # print("[INFO]: (",notification.module,") FrameNotification.",notification.variable, " = ",notification.property); + + new_class.monitored[notification.variable] = root_node.getNode(notification.property,1); + new_class.properties[notification.property] = notification.variable; + + print("[INFO]: (",notification.module,") FrameNotification.",notification.variable, " = ",notification.property, " -> ", new_class.monitored[notification.variable].getPath() ); + return emesary.Transmitter.ReceiptStatus_OK; + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + new_class.fetchvars = func() { + foreach (var mp; keys(new_class.monitored)){ + if(new_class.monitored[mp] != nil){ + if (FrameNotification.debug > 1) + print(" ",mp, " = ",new_class.monitored[mp].getValue()); + new_class[mp] = new_class.monitored[mp].getValue(); + } + } + }; + emesary.GlobalTransmitter.Register(new_class.Recipient); + return new_class; + }, +}; + +var FrameNotificationAddProperty = +{ + new: func(module, variable, property, root_node=nil) + { + var new_class = emesary.Notification.new("FrameNotificationAddProperty", variable); + if (root_node == nil) + root_node = props.globals; + new_class.module = module ; + new_class.variable = variable; + new_class.property = property; + new_class.root_node = root_node; + return new_class; + }, +}; +# +var frameNotification = FrameNotification.new(1); + diff --git a/Nasal/emesary/exec.nas b/Nasal/emesary/exec.nas new file mode 100644 index 00000000..7a39129b --- /dev/null +++ b/Nasal/emesary/exec.nas @@ -0,0 +1,82 @@ + #--------------------------------------------------------------------------- + # + # Title : Emesary based real time executive + # + # File Type : Implementation File + # + # Description : Uses emesary notifications to permit nasal subsystems to + # : be invoked in a controlled manner. + # + # Author : Richard Harrison (richard@zaretto.com) + # + # Creation Date : 4 June 2018 + # + # Version : 1.0 + # + # Copyright (C) 2018 Richard Harrison Released under GPL V2 + # + #---------------------------------------------------------------------------*/ + + + +# to add properties to the FrameNotification simply send a FrameNotificationAddProperty +# to the global transmitter. This will be received by the frameNotifcation object and +# included in the update. +#emesary.GlobalTransmitter.NotifyAll(new FrameNotificationAddProperty("MODULE", "wow","gear/gear[0]/wow")); +#emesary.GlobalTransmitter.NotifyAll(new FrameNotificationAddProperty("MODULE", "engine_n2", "engines/engine[0]/n2")); +# + + +# +# real time exec loop. +var frame_inc = 0; +var cur_frame_inc = 0.05; +var execLoop = func +{ + # + notifications.frameNotification.fetchvars(); + if (notifications.frameNotification.FrameCount >= 4) { + notifications.frameNotification.FrameCount = 0; + } + emesary.GlobalTransmitter.NotifyAll(notifications.frameNotification); + # + + notifications.frameNotification.FrameCount = notifications.frameNotification.FrameCount + 1; + # + # framecount + # 0: HUD targets, Radar, RWR + # 1: HUD targets, RDR, VSD + # 2: HUD targets, HUD trig, HUD text + # 3: HUD targets, VSD, RDR + # + if (notifications.frameNotification.frame_rate_worst < 5) { + frame_inc = 0.25;#3.3 + } elsif (notifications.frameNotification.frame_rate_worst < 10) { + frame_inc = 0.125;#6.6 + } elsif (notifications.frameNotification.frame_rate_worst < 15) { + frame_inc = 0.10;#8.3 + } elsif (notifications.frameNotification.frame_rate_worst < 20) { + frame_inc = 0.075;#12.5 + } elsif (notifications.frameNotification.frame_rate_worst < 25) { + frame_inc = 0.05;#14.3 + } else { + frame_inc = 0.05;#20.0 + } + + if (frame_inc != cur_frame_inc) { + cur_frame_inc = frame_inc; + } + settimer(execLoop, cur_frame_inc); +} + +# setup the properties to monitor for this system +input = { +FrameRate : "/sim/frame-rate", +frame_rate : "/sim/frame-rate", +frame_rate_worst : "/sim/frame-rate-worst", +elapsed_seconds : "/sim/time/elapsed-sec", +}; + +foreach (var name; keys(input)) { + emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("EXEC", name, input[name])); +} \ No newline at end of file From d1b65655baefc84b5300314114ae2fa18fda1702 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 28 Oct 2020 00:53:52 +0000 Subject: [PATCH 06/33] Most of the engine parameters ported. --- A320-main.xml | 13 + Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 904 +++++------------- .../Instruments/Upper-ECAM/Upper-ECAM.new.nas | 450 ++++++++- Nasal/emesary/exec.nas | 25 +- 4 files changed, 717 insertions(+), 675 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index 2ea9fc51..b7ae2535 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -611,6 +611,19 @@ + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index cba5c5fe..2dbc217b 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -18,17 +18,10 @@ var EPR_thr_2 = props.globals.initNode("/ECAM/Upper/EPRthr[1]", 0); var EPR_lim = props.globals.initNode("/ECAM/Upper/EPRylim", 0, "DOUBLE"); var EGT_1 = props.globals.initNode("/ECAM/Upper/EGT[0]", 0, "DOUBLE"); var EGT_2 = props.globals.initNode("/ECAM/Upper/EGT[1]", 0, "DOUBLE"); -var N1_1 = props.globals.initNode("/ECAM/Upper/N1[0]", 0, "DOUBLE"); -var N1_2 = props.globals.initNode("/ECAM/Upper/N1[1]", 0, "DOUBLE"); -var N1_thr_1 = props.globals.initNode("/ECAM/Upper/N1thr[0]", 0, "DOUBLE"); -var N1_thr_2 = props.globals.initNode("/ECAM/Upper/N1thr[1]", 0, "DOUBLE"); -var N1_lim = props.globals.initNode("/ECAM/Upper/N1ylim", 0, "DOUBLE"); var du3_test = props.globals.initNode("/instrumentation/du/du3-test", 0, "BOOL"); var du3_test_time = props.globals.initNode("/instrumentation/du/du3-test-time", 0.0, "DOUBLE"); var du3_test_amount = props.globals.initNode("/instrumentation/du/du3-test-amount", 0.0, "DOUBLE"); var du3_offtime = props.globals.initNode("/instrumentation/du/du3-off-time", 0.0, "DOUBLE"); -var slatLockFlash = props.globals.initNode("/instrumentation/du/slat-lock-flash", 0, "BOOL"); - # Fetch nodes: var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); @@ -122,22 +115,22 @@ var canvas_upperECAM_base = { # set font - me["ECAML1"].setFont("LiberationMonoCustom.ttf"); - me["ECAML2"].setFont("LiberationMonoCustom.ttf"); - me["ECAML3"].setFont("LiberationMonoCustom.ttf"); - me["ECAML4"].setFont("LiberationMonoCustom.ttf"); - me["ECAML5"].setFont("LiberationMonoCustom.ttf"); - me["ECAML6"].setFont("LiberationMonoCustom.ttf"); - me["ECAML7"].setFont("LiberationMonoCustom.ttf"); - me["ECAML8"].setFont("LiberationMonoCustom.ttf"); - me["ECAMR1"].setFont("LiberationMonoCustom.ttf"); - me["ECAMR2"].setFont("LiberationMonoCustom.ttf"); - me["ECAMR3"].setFont("LiberationMonoCustom.ttf"); - me["ECAMR4"].setFont("LiberationMonoCustom.ttf"); - me["ECAMR5"].setFont("LiberationMonoCustom.ttf"); - me["ECAMR6"].setFont("LiberationMonoCustom.ttf"); - me["ECAMR7"].setFont("LiberationMonoCustom.ttf"); - me["ECAMR8"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML1"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML2"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML3"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML4"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML5"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML6"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML7"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML8"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR1"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR2"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR3"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR4"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR5"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR6"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR7"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR8"].setFont("LiberationMonoCustom.ttf"); me.page = canvas_group; @@ -202,163 +195,28 @@ var canvas_upperECAM_base = { } } }, - getColorString: func(color) { - if (color == "w") { - return [0.8078,0.8039,0.8078]; - } else if (color == "m") { - return [0.6901,0.3333,0.7450]; - } else if (color == "c") { - return [0.0901,0.6039,0.7176]; - } else if (color == "g") { - return [0.0509,0.7529,0.2941]; - } else if (color == "a") { - return [0.7333,0.3803,0]; - } else if (color == "r") { - return [1,0,0]; - } else { - return [1,1,1]; - } - }, updateBase: func(notification) { - # Reversers - rev_1_cur = pts.Engines.Engine.reverser[0].getValue(); - rev_2_cur = pts.Engines.Engine.reverser[1].getValue(); - cur_eng_option = eng_option.getValue(); - if (rev_1_cur >= 0.01 and fadec.FADEC.Eng1.n1 == 1 and cur_eng_option == "CFM") { - me["REV1"].show(); - me["REV1-box"].show(); - } else if (rev_1_cur >= 0.01 and fadec.FADEC.Eng1.epr == 1 and cur_eng_option == "IAE") { - me["REV1"].show(); - me["REV1-box"].show(); - } else { - me["REV1"].hide(); - me["REV1-box"].hide(); - } - - if (rev_1_cur >= 0.95) { - me["REV1"].setColor(0.0509,0.7529,0.2941); - } else { - me["REV1"].setColor(0.7333,0.3803,0); - } - - if (rev_2_cur >= 0.01 and fadec.FADEC.Eng2.n1 == 1 and cur_eng_option == "CFM") { - me["REV2"].show(); - me["REV2-box"].show(); - } else if (rev_2_cur >= 0.01 and fadec.FADEC.Eng2.epr == 1 and cur_eng_option == "IAE") { - me["REV2"].show(); - me["REV2-box"].show(); - } else { - me["REV2"].hide(); - me["REV2-box"].hide(); - } - - if (rev_2_cur >= 0.95) { - me["REV2"].setColor(0.0509,0.7529,0.2941); - } else { - me["REV2"].setColor(0.7333,0.3803,0); - } - - - if (pts.Fdm.JSBsim.Fcs.slatLocked.getValue()) { - if (slatLockGoing == 0) { - slatLockGoing = 1; - } - if (slatLockGoing == 1) { - slatLockTimer.start(); - if (slatLockFlash.getValue()) { - me["SlatAlphaLock"].show(); - } else { - me["SlatAlphaLock"].hide(); - } - } - } else { - slatLockTimer.stop(); - slatLockGoing = 0; - me["SlatAlphaLock"].hide(); - } - - me["FlapIndicator"].setTranslation(flapXOffset.getValue(),flapYOffset.getValue()); - me["SlatIndicator"].setTranslation(slatXOffset.getValue(),slatYOffset.getValue()); - me["FlapLine"].setTranslation(flapXTranslate.getValue(),flapYTranslate.getValue()); - me["SlatLine"].setTranslation(slatXTranslate.getValue(),slatYTranslate.getValue()); # ECAM Messages - me["ECAML1"].setText(sprintf("%s", ECAM_line1.getValue())); - me["ECAML2"].setText(sprintf("%s", ECAM_line2.getValue())); - me["ECAML3"].setText(sprintf("%s", ECAM_line3.getValue())); - me["ECAML4"].setText(sprintf("%s", ECAM_line4.getValue())); - me["ECAML5"].setText(sprintf("%s", ECAM_line5.getValue())); - me["ECAML6"].setText(sprintf("%s", ECAM_line6.getValue())); - me["ECAML7"].setText(sprintf("%s", ECAM_line7.getValue())); - me["ECAML8"].setText(sprintf("%s", ECAM_line8.getValue())); - - me["ECAM_Left"].show(); + obj["ECAML1"].setText(sprintf("%s", ECAM_line1.getValue())); + obj["ECAML2"].setText(sprintf("%s", ECAM_line2.getValue())); + obj["ECAML3"].setText(sprintf("%s", ECAM_line3.getValue())); + obj["ECAML4"].setText(sprintf("%s", ECAM_line4.getValue())); + obj["ECAML5"].setText(sprintf("%s", ECAM_line5.getValue())); + obj["ECAML6"].setText(sprintf("%s", ECAM_line6.getValue())); + obj["ECAML7"].setText(sprintf("%s", ECAM_line7.getValue())); + obj["ECAML8"].setText(sprintf("%s", ECAM_line8.getValue())); - me["ECAMR1"].setText(sprintf("%s", ECAM_line1r.getValue())); - me["ECAMR2"].setText(sprintf("%s", ECAM_line2r.getValue())); - me["ECAMR3"].setText(sprintf("%s", ECAM_line3r.getValue())); - me["ECAMR4"].setText(sprintf("%s", ECAM_line4r.getValue())); - me["ECAMR5"].setText(sprintf("%s", ECAM_line5r.getValue())); - me["ECAMR6"].setText(sprintf("%s", ECAM_line6r.getValue())); - me["ECAMR7"].setText(sprintf("%s", ECAM_line7r.getValue())); - me["ECAMR8"].setText(sprintf("%s", ECAM_line8r.getValue())); + obj["ECAMR1"].setText(sprintf("%s", ECAM_line1r.getValue())); + obj["ECAMR2"].setText(sprintf("%s", ECAM_line2r.getValue())); + obj["ECAMR3"].setText(sprintf("%s", ECAM_line3r.getValue())); + obj["ECAMR4"].setText(sprintf("%s", ECAM_line4r.getValue())); + obj["ECAMR5"].setText(sprintf("%s", ECAM_line5r.getValue())); + obj["ECAMR6"].setText(sprintf("%s", ECAM_line6r.getValue())); + obj["ECAMR7"].setText(sprintf("%s", ECAM_line7r.getValue())); + obj["ECAMR8"].setText(sprintf("%s", ECAM_line8r.getValue())); - me["ECAM_Right"].show(); - - foreach(var update_item; me.update_items) - { - update_item.update(notification); - } - }, - updateAFloor: func() { - if (fadec.Thrust.alphaFloor.getBoolValue()) { - me["aFloor"].show(); - } else { - me["aFloor"].hide(); - } - }, - updateFlaps: func() { - # Flap Indicator - flapsPos = pts.Controls.Flight.flapsPos.getValue(); - if (flapsPos == 1) { - me["FlapTxt"].setText("1"); - } else if (flapsPos == 2) { - me["FlapTxt"].setText("1+F"); - } else if (flapsPos == 3) { - me["FlapTxt"].setText("2"); - } else if (flapsPos == 4) { - me["FlapTxt"].setText("3"); - } else if (flapsPos == 5) { - me["FlapTxt"].setText("FULL"); - } else { - me["FlapTxt"].setText(" "); # More efficient then hide/show - } - - if (flapsPos > 0) { - me["FlapDots"].show(); - } else { - me["FlapDots"].hide(); - } - }, - updateFlx: func() { - if (fadec.Thrust.thrustLimit.getValue() == "FLX") { - me["FlxLimDegreesC"].show(); - me["FlxLimTemp"].show(); - me["FlxLimTemp"].setText(sprintf("%2.0d",fmgc.FMGCNodes.flexTemp.getValue())); - } else { - me["FlxLimDegreesC"].hide(); - me["FlxLimTemp"].hide(); - } - }, - update_items: [ - props.UpdateManager.FromHashValue("fuelTotalLbs", 1, func(val) { - # FOB - - }), - ], -}; - var canvas_upperECAM_cfm_eis2 = { new: func(canvas_group, file) { var m = {parents: [canvas_upperECAM_cfm_eis2, canvas_upperECAM_base]}; @@ -369,243 +227,39 @@ var canvas_upperECAM_cfm_eis2 = { }, update: func(notification) { - # N1 - N1_1_cur = N1_1.getValue(); - N1_2_cur = N1_2.getValue(); - N1_1_act = pts.Engines.Engine.n1Actual[0].getValue(); - N1_2_act = pts.Engines.Engine.n1Actual[1].getValue(); - N1_lim_cur = N1_lim.getValue(); - N1_thr_1_act = N1_thr_1.getValue(); - N1_thr_2_act = N1_thr_2.getValue(); - rev_1_act = pts.Engines.Engine.reverser[0].getValue(); - rev_2_act = pts.Engines.Engine.reverser[1].getValue(); - EGT_1_cur = EGT_1.getValue(); - EGT_2_cur = EGT_2.getValue(); - n2cur_1 = pts.Engines.Engine.n2Actual[0].getValue(); - n2cur_2 = pts.Engines.Engine.n2Actual[1].getValue(); - - me["N11"].setText(sprintf("%s", math.floor(N1_1_act + 0.05))); - me["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(N1_1_act + 0.05, 1)))); - - me["N12"].setText(sprintf("%s", math.floor(N1_2_act + 0.05))); - me["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(N1_2_act + 0.05, 1)))); - - me["N11-needle"].setRotation((N1_1_cur + 90) * D2R); - me["N11-thr"].setRotation((N1_thr_1_act + 90) * D2R); - me["N11-ylim"].setRotation((N1_lim_cur + 90) * D2R); - - me["N12-needle"].setRotation((N1_2_cur + 90) * D2R); - me["N12-thr"].setRotation((N1_thr_2_act + 90) * D2R); - me["N12-ylim"].setRotation((N1_lim_cur + 90) * D2R); - - if (fadec.FADEC.Eng1.n1 == 1) { - me["N11-scale"].setColor(0.8078,0.8039,0.8078); - me["N11-scale2"].setColor(1,0,0); - me["N11"].show(); - me["N11-decimal"].show(); - me["N11-decpnt"].show(); - me["N11-needle"].show(); - me["N11-ylim"].show(); - me["N11-scaletick"].show(); - me["N11-scalenum"].show(); - me["N11-box"].show(); - me["N11-XX"].hide(); - me["N11-XX2"].hide(); - me["N11-XX-box"].hide(); - } else { - me["N11-scale"].setColor(0.7333,0.3803,0); - me["N11-scale2"].setColor(0.7333,0.3803,0); - me["N11"].hide(); - me["N11-decimal"].hide(); - me["N11-decpnt"].hide(); - me["N11-needle"].hide(); - me["N11-ylim"].hide(); - me["N11-scaletick"].hide(); - me["N11-scalenum"].hide(); - me["N11-box"].hide(); - me["N11-XX"].show(); - me["N11-XX2"].show(); - me["N11-XX-box"].show(); - } - - if (rev_1_act < 0.01 and fadec.FADEC.Eng1.n1 == 1) { - me["N11-thr"].show(); - } else { - me["N11-thr"].hide(); - } - - if (fadec.FADEC.Eng2.n1 == 1) { - me["N12-scale"].setColor(0.8078,0.8039,0.8078); - me["N12-scale2"].setColor(1,0,0); - me["N12"].show(); - me["N12-decimal"].show(); - me["N12-decpnt"].show(); - me["N12-needle"].show(); - me["N12-ylim"].show(); - me["N12-scaletick"].show(); - me["N12-scalenum"].show(); - me["N12-box"].show(); - me["N12-XX"].hide(); - me["N12-XX2"].hide(); - me["N12-XX-box"].hide(); - } else { - me["N12-scale"].setColor(0.7333,0.3803,0); - me["N12-scale2"].setColor(0.7333,0.3803,0); - me["N12"].hide(); - me["N12-decimal"].hide(); - me["N12-decpnt"].hide(); - me["N12-needle"].hide(); - me["N12-ylim"].hide(); - me["N12-scaletick"].hide(); - me["N12-scalenum"].hide(); - me["N12-box"].hide(); - me["N12-XX"].show(); - me["N12-XX2"].show(); - me["N12-XX-box"].show(); - } - - if (rev_2_act < 0.01 and fadec.FADEC.Eng2.n1 == 1) { - me["N12-thr"].show(); - } else { - me["N12-thr"].hide(); - } - - # EGT - me["EGT1"].setText(sprintf("%s", math.round(pts.Engines.Engine.egtActual[0].getValue()))); - me["EGT2"].setText(sprintf("%s", math.round(pts.Engines.Engine.egtActual[1].getValue()))); - - me["EGT1-needle"].setRotation((EGT_1_cur + 90) * D2R); - me["EGT2-needle"].setRotation((EGT_2_cur + 90) * D2R); - - if (fadec.FADEC.Eng1.egt == 1) { - me["EGT1-scale"].setColor(0.8078,0.8039,0.8078); - me["EGT1-scale2"].setColor(1,0,0); - me["EGT1"].show(); - me["EGT1-needle"].show(); - me["EGT1-scaletick"].show(); - me["EGT1-box"].show(); - me["EGT1-XX"].hide(); - } else { - me["EGT1-scale"].setColor(0.7333,0.3803,0); - me["EGT1-scale2"].setColor(0.7333,0.3803,0); - me["EGT1"].hide(); - me["EGT1-needle"].hide(); - me["EGT1-scaletick"].hide(); - me["EGT1-box"].hide(); - me["EGT1-XX"].show(); - } - - if (fadec.FADEC.Eng2.egt == 1) { - me["EGT2-scale"].setColor(0.8078,0.8039,0.8078); - me["EGT2-scale2"].setColor(1,0,0); - me["EGT2"].show(); - me["EGT2-needle"].show(); - me["EGT2-scaletick"].show(); - me["EGT2-box"].show(); - me["EGT2-XX"].hide(); - } else { - me["EGT2-scale"].setColor(0.7333,0.3803,0); - me["EGT2-scale2"].setColor(0.7333,0.3803,0); - me["EGT2"].hide(); - me["EGT2-needle"].hide(); - me["EGT2-scaletick"].hide(); - me["EGT2-box"].hide(); - me["EGT2-XX"].show(); - } - - # N2 - - me["N21"].setText(sprintf("%s", math.floor(n2cur_1 + 0.05))); - me["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(n2cur_1 + 0.05, 1)))); - me["N22"].setText(sprintf("%s", math.floor(n2cur_2 + 0.05))); - me["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(n2cur_2 + 0.05, 1)))); - - if (fadec.FADEC.Eng1.n2 == 1) { - me["N21"].show(); - me["N21-decimal"].show(); - me["N21-decpnt"].show(); - me["N21-XX"].hide(); - } else { - me["N21"].hide(); - me["N21-decimal"].hide(); - me["N21-decpnt"].hide(); - me["N21-XX"].show(); - } - - if (fadec.FADEC.Eng2.n2 == 1) { - me["N22"].show(); - me["N22-decimal"].show(); - me["N22-decpnt"].show(); - me["N22-XX"].hide(); - } else { - me["N22"].hide(); - me["N22-decimal"].hide(); - me["N22-decpnt"].hide(); - me["N22-XX"].show(); - } - - # FF - fuel1 = pts.Engines.Engine.fuelFlow[0].getValue(); - fuel2 = pts.Engines.Engine.fuelFlow[1].getValue(); - - if (acconfig_weight_kgs.getValue()) { - me["FF1"].setText(sprintf("%s", math.round(fuel1 * LBS2KGS, 10))); - me["FF2"].setText(sprintf("%s", math.round(fuel2 * LBS2KGS, 10))); - me["FFlow-weight-unit"].setText("KG/H"); - } else { - me["FF1"].setText(sprintf("%s", math.round(fuel1, 10))); - me["FF2"].setText(sprintf("%s", math.round(fuel2, 10))); - me["FFlow-weight-unit"].setText("LBS/H"); - } - - if (fadec.FADEC.Eng1.ff == 1) { - me["FF1"].show(); - me["FF1-XX"].hide(); - } else { - me["FF1"].hide(); - me["FF1-XX"].show(); - } - - if (fadec.FADEC.Eng2.ff == 1) { - me["FF2"].show(); - me["FF2-XX"].hide(); - } else { - me["FF2"].hide(); - me["FF2-XX"].show(); - } # N1 Limit thrLimit = thr_limit.getValue(); n1Limit = n1_limit.getValue(); - me["N1Lim-mode"].setText(sprintf("%s", thrLimit)); - me["N1Lim"].setText(sprintf("%s", math.floor(n1Limit + 0.05))); - me["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(n1Limit + 0.05, 1)))); + obj["N1Lim-mode"].setText(sprintf("%s", thrLimit)); + obj["N1Lim"].setText(sprintf("%s", math.floor(n1Limit + 0.05))); + obj["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(n1Limit + 0.05, 1)))); fadecPower1 = fadecpower_1.getValue(); fadecPower2 = fadecpower_2.getValue(); fadecPowerStart = fadecpowerup.getValue(); if (fadecPower1 or fadecPower2 or fadecPowerStart) { - me["N1Lim-mode"].show(); - me["N1Lim-XX"].hide(); - me["N1Lim-XX2"].hide(); + obj["N1Lim-mode"].show(); + obj["N1Lim-XX"].hide(); + obj["N1Lim-XX2"].hide(); } else { - me["N1Lim-mode"].hide(); - me["N1Lim-XX"].show(); - me["N1Lim-XX2"].show(); + obj["N1Lim-mode"].hide(); + obj["N1Lim-XX"].show(); + obj["N1Lim-XX2"].show(); } if ((fadecPower1 or fadecPower2 or fadecPowerStart) and thrLimit != "MREV") { - me["N1Lim"].show(); - me["N1Lim-decpnt"].show(); - me["N1Lim-decimal"].show(); - me["N1Lim-percent"].show(); + obj["N1Lim"].show(); + obj["N1Lim-decpnt"].show(); + obj["N1Lim-decimal"].show(); + obj["N1Lim-percent"].show(); } else { - me["N1Lim"].hide(); - me["N1Lim-decpnt"].hide(); - me["N1Lim-decimal"].hide(); - me["N1Lim-percent"].hide(); + obj["N1Lim"].hide(); + obj["N1Lim-decpnt"].hide(); + obj["N1Lim-decimal"].hide(); + obj["N1Lim-percent"].hide(); } me.updateBase(notification); @@ -649,291 +303,291 @@ var canvas_upperECAM_iae_eis2 = { n2cur_2 = pts.Engines.Engine.n2Actual[1].getValue(); # EPR - me["EPR1"].setText(sprintf("%1.0f", math.floor(EPR_1_act))); - me["EPR1-decimal"].setText(sprintf("%03d", (EPR_1_act - int(EPR_1_act)) * 1000)); - me["EPR2"].setText(sprintf("%1.0f", math.floor(EPR_2_act))); - me["EPR2-decimal"].setText(sprintf("%03d", (EPR_2_act - int(EPR_2_act)) * 1000)); + obj["EPR1"].setText(sprintf("%1.0f", math.floor(EPR_1_act))); + obj["EPR1-decimal"].setText(sprintf("%03d", (EPR_1_act - int(EPR_1_act)) * 1000)); + obj["EPR2"].setText(sprintf("%1.0f", math.floor(EPR_2_act))); + obj["EPR2-decimal"].setText(sprintf("%03d", (EPR_2_act - int(EPR_2_act)) * 1000)); - me["EPR1-needle"].setRotation((EPR_1_cur + 90) * D2R); - me["EPR1-thr"].setRotation((EPR_thr_1_act + 90) * D2R); - me["EPR1-ylim"].setRotation((EPR_lim_cur + 90) * D2R); - me["EPR2-needle"].setRotation((EPR_2_cur + 90) * D2R); - me["EPR2-thr"].setRotation((EPR_thr_2_act + 90) * D2R); - me["EPR2-ylim"].setRotation((EPR_lim_cur + 90) * D2R); + obj["EPR1-needle"].setRotation((EPR_1_cur + 90) * D2R); + obj["EPR1-thr"].setRotation((EPR_thr_1_act + 90) * D2R); + obj["EPR1-ylim"].setRotation((EPR_lim_cur + 90) * D2R); + obj["EPR2-needle"].setRotation((EPR_2_cur + 90) * D2R); + obj["EPR2-thr"].setRotation((EPR_thr_2_act + 90) * D2R); + obj["EPR2-ylim"].setRotation((EPR_lim_cur + 90) * D2R); if (fadec.FADEC.Eng1.epr == 1) { - me["EPR1-scale"].setColor(0.8078,0.8039,0.8078); - me["EPR1"].show(); - me["EPR1-decpnt"].show(); - me["EPR1-decimal"].show(); - me["EPR1-needle"].show(); - me["EPR1-ylim"].show(); - me["EPR1-scaletick"].show(); - me["EPR1-scalenum"].show(); - me["EPR1-box"].show(); - me["EPR1-XX"].hide(); - me["EPR1-XX2"].hide(); + obj["EPR1-scale"].setColor(0.8078,0.8039,0.8078); + obj["EPR1"].show(); + obj["EPR1-decpnt"].show(); + obj["EPR1-decimal"].show(); + obj["EPR1-needle"].show(); + obj["EPR1-ylim"].show(); + obj["EPR1-scaletick"].show(); + obj["EPR1-scalenum"].show(); + obj["EPR1-box"].show(); + obj["EPR1-XX"].hide(); + obj["EPR1-XX2"].hide(); } else { - me["EPR1-scale"].setColor(0.7333,0.3803,0); - me["EPR1"].hide(); - me["EPR1-decpnt"].hide(); - me["EPR1-decimal"].hide(); - me["EPR1-needle"].hide(); - me["EPR1-ylim"].hide(); - me["EPR1-scaletick"].hide(); - me["EPR1-scalenum"].hide(); - me["EPR1-box"].hide(); - me["EPR1-XX"].show(); - me["EPR1-XX2"].show(); + obj["EPR1-scale"].setColor(0.7333,0.3803,0); + obj["EPR1"].hide(); + obj["EPR1-decpnt"].hide(); + obj["EPR1-decimal"].hide(); + obj["EPR1-needle"].hide(); + obj["EPR1-ylim"].hide(); + obj["EPR1-scaletick"].hide(); + obj["EPR1-scalenum"].hide(); + obj["EPR1-box"].hide(); + obj["EPR1-XX"].show(); + obj["EPR1-XX2"].show(); } if (rev_1_act < 0.01 and fadec.FADEC.Eng1.epr == 1) { - me["EPR1-thr"].show(); + obj["EPR1-thr"].show(); } else { - me["EPR1-thr"].hide(); + obj["EPR1-thr"].hide(); } if (fadec.FADEC.Eng2.epr == 1) { - me["EPR2-scale"].setColor(0.8078,0.8039,0.8078); - me["EPR2"].show(); - me["EPR2-decpnt"].show(); - me["EPR2-decimal"].show(); - me["EPR2-needle"].show(); - me["EPR2-ylim"].show(); - me["EPR2-scaletick"].show(); - me["EPR2-scalenum"].show(); - me["EPR2-box"].show(); - me["EPR2-XX"].hide(); - me["EPR2-XX2"].hide(); + obj["EPR2-scale"].setColor(0.8078,0.8039,0.8078); + obj["EPR2"].show(); + obj["EPR2-decpnt"].show(); + obj["EPR2-decimal"].show(); + obj["EPR2-needle"].show(); + obj["EPR2-ylim"].show(); + obj["EPR2-scaletick"].show(); + obj["EPR2-scalenum"].show(); + obj["EPR2-box"].show(); + obj["EPR2-XX"].hide(); + obj["EPR2-XX2"].hide(); } else { - me["EPR2-scale"].setColor(0.7333,0.3803,0); - me["EPR2"].hide(); - me["EPR2-decpnt"].hide(); - me["EPR2-decimal"].hide(); - me["EPR2-needle"].hide(); - me["EPR2-ylim"].hide(); - me["EPR2-scaletick"].hide(); - me["EPR2-scalenum"].hide(); - me["EPR2-box"].hide(); - me["EPR2-XX"].show(); - me["EPR2-XX2"].show(); + obj["EPR2-scale"].setColor(0.7333,0.3803,0); + obj["EPR2"].hide(); + obj["EPR2-decpnt"].hide(); + obj["EPR2-decimal"].hide(); + obj["EPR2-needle"].hide(); + obj["EPR2-ylim"].hide(); + obj["EPR2-scaletick"].hide(); + obj["EPR2-scalenum"].hide(); + obj["EPR2-box"].hide(); + obj["EPR2-XX"].show(); + obj["EPR2-XX2"].show(); } if (rev_2_act < 0.01 and fadec.FADEC.Eng2.epr == 1) { - me["EPR2-thr"].show(); + obj["EPR2-thr"].show(); } else { - me["EPR2-thr"].hide(); + obj["EPR2-thr"].hide(); } # EGT - me["EGT1"].setText(sprintf("%s", math.round(pts.Engines.Engine.egtActual[0].getValue()))); - me["EGT2"].setText(sprintf("%s", math.round(pts.Engines.Engine.egtActual[1].getValue()))); + obj["EGT1"].setText(sprintf("%s", math.round(pts.Engines.Engine.egtActual[0].getValue()))); + obj["EGT2"].setText(sprintf("%s", math.round(pts.Engines.Engine.egtActual[1].getValue()))); - me["EGT1-needle"].setRotation((EGT_1_cur + 90) * D2R); - me["EGT2-needle"].setRotation((EGT_2_cur + 90) * D2R); + obj["EGT1-needle"].setRotation((EGT_1_cur + 90) * D2R); + obj["EGT2-needle"].setRotation((EGT_2_cur + 90) * D2R); if (fadec.FADEC.Eng1.egt == 1) { - me["EGT1-scale"].setColor(0.8078,0.8039,0.8078); - me["EGT1-scale2"].setColor(1,0,0); - me["EGT1"].show(); - me["EGT1-needle"].show(); - me["EGT1-scaletick"].show(); - me["EGT1-box"].show(); - me["EGT1-XX"].hide(); + obj["EGT1-scale"].setColor(0.8078,0.8039,0.8078); + obj["EGT1-scale2"].setColor(1,0,0); + obj["EGT1"].show(); + obj["EGT1-needle"].show(); + obj["EGT1-scaletick"].show(); + obj["EGT1-box"].show(); + obj["EGT1-XX"].hide(); } else { - me["EGT1-scale"].setColor(0.7333,0.3803,0); - me["EGT1-scale2"].setColor(0.7333,0.3803,0); - me["EGT1"].hide(); - me["EGT1-needle"].hide(); - me["EGT1-scaletick"].hide(); - me["EGT1-box"].hide(); - me["EGT1-XX"].show(); + obj["EGT1-scale"].setColor(0.7333,0.3803,0); + obj["EGT1-scale2"].setColor(0.7333,0.3803,0); + obj["EGT1"].hide(); + obj["EGT1-needle"].hide(); + obj["EGT1-scaletick"].hide(); + obj["EGT1-box"].hide(); + obj["EGT1-XX"].show(); } if (fadec.FADEC.Eng2.egt == 1) { - me["EGT2-scale"].setColor(0.8078,0.8039,0.8078); - me["EGT2-scale2"].setColor(1,0,0); - me["EGT2"].show(); - me["EGT2-needle"].show(); - me["EGT2-scaletick"].show(); - me["EGT2-box"].show(); - me["EGT2-XX"].hide(); + obj["EGT2-scale"].setColor(0.8078,0.8039,0.8078); + obj["EGT2-scale2"].setColor(1,0,0); + obj["EGT2"].show(); + obj["EGT2-needle"].show(); + obj["EGT2-scaletick"].show(); + obj["EGT2-box"].show(); + obj["EGT2-XX"].hide(); } else { - me["EGT2-scale"].setColor(0.7333,0.3803,0); - me["EGT2-scale2"].setColor(0.7333,0.3803,0); - me["EGT2"].hide(); - me["EGT2-needle"].hide(); - me["EGT2-scaletick"].hide(); - me["EGT2-box"].hide(); - me["EGT2-XX"].show(); + obj["EGT2-scale"].setColor(0.7333,0.3803,0); + obj["EGT2-scale2"].setColor(0.7333,0.3803,0); + obj["EGT2"].hide(); + obj["EGT2-needle"].hide(); + obj["EGT2-scaletick"].hide(); + obj["EGT2-box"].hide(); + obj["EGT2-XX"].show(); } # N1 - me["N11"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n1Actual[0].getValue() + 0.05))); - me["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n1Actual[0].getValue() + 0.05, 1)))); + obj["N11"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n1Actual[0].getValue() + 0.05))); + obj["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n1Actual[0].getValue() + 0.05, 1)))); - me["N12"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n1Actual[1].getValue() + 0.05))); - me["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n1Actual[1].getValue() + 0.05, 1)))); + obj["N12"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n1Actual[1].getValue() + 0.05))); + obj["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n1Actual[1].getValue() + 0.05, 1)))); - me["N11-needle"].setRotation((N1_1_cur + 90) * D2R); - me["N11-thr"].setRotation((N1_thr_1.getValue() + 90) * D2R); - me["N11-ylim"].setRotation((N1_lim_cur + 90) * D2R); + obj["N11-needle"].setRotation((N1_1_cur + 90) * D2R); + obj["N11-thr"].setRotation((N1_thr_1.getValue() + 90) * D2R); + obj["N11-ylim"].setRotation((N1_lim_cur + 90) * D2R); - me["N12-needle"].setRotation((N1_2_cur + 90) * D2R); - me["N12-thr"].setRotation((N1_thr_2.getValue() + 90) * D2R); - me["N12-ylim"].setRotation((N1_lim_cur + 90) * D2R); + obj["N12-needle"].setRotation((N1_2_cur + 90) * D2R); + obj["N12-thr"].setRotation((N1_thr_2.getValue() + 90) * D2R); + obj["N12-ylim"].setRotation((N1_lim_cur + 90) * D2R); if (fadec.FADEC.Eng1.n1 == 1) { - me["N11-scale"].setColor(0.8078,0.8039,0.8078); - me["N11-scale2"].setColor(1,0,0); - me["N11"].show(); - me["N11-decimal"].show(); - me["N11-decpnt"].show(); - me["N11-needle"].show(); - me["N11-scaletick"].show(); - me["N11-scalenum"].show(); - me["N11-XX"].hide(); + obj["N11-scale"].setColor(0.8078,0.8039,0.8078); + obj["N11-scale2"].setColor(1,0,0); + obj["N11"].show(); + obj["N11-decimal"].show(); + obj["N11-decpnt"].show(); + obj["N11-needle"].show(); + obj["N11-scaletick"].show(); + obj["N11-scalenum"].show(); + obj["N11-XX"].hide(); } else { - me["N11-scale"].setColor(0.7333,0.3803,0); - me["N11-scale2"].setColor(0.7333,0.3803,0); - me["N11"].hide(); - me["N11-decimal"].hide(); - me["N11-decpnt"].hide(); - me["N11-needle"].hide(); - me["N11-scaletick"].hide(); - me["N11-scalenum"].hide(); - me["N11-XX"].show(); + obj["N11-scale"].setColor(0.7333,0.3803,0); + obj["N11-scale2"].setColor(0.7333,0.3803,0); + obj["N11"].hide(); + obj["N11-decimal"].hide(); + obj["N11-decpnt"].hide(); + obj["N11-needle"].hide(); + obj["N11-scaletick"].hide(); + obj["N11-scalenum"].hide(); + obj["N11-XX"].show(); } if (fadec.FADEC.Eng2.n1 == 1) { - me["N12-scale"].setColor(0.8078,0.8039,0.8078); - me["N12-scale2"].setColor(1,0,0); - me["N12"].show(); - me["N12-decimal"].show(); - me["N12-decpnt"].show(); - me["N12-needle"].show(); - me["N12-scaletick"].show(); - me["N12-scalenum"].show(); - me["N12-XX"].hide(); + obj["N12-scale"].setColor(0.8078,0.8039,0.8078); + obj["N12-scale2"].setColor(1,0,0); + obj["N12"].show(); + obj["N12-decimal"].show(); + obj["N12-decpnt"].show(); + obj["N12-needle"].show(); + obj["N12-scaletick"].show(); + obj["N12-scalenum"].show(); + obj["N12-XX"].hide(); } else { - me["N12-scale"].setColor(0.7333,0.3803,0); - me["N12-scale2"].setColor(0.7333,0.3803,0); - me["N12"].hide(); - me["N12-decimal"].hide(); - me["N12-decpnt"].hide(); - me["N12-needle"].hide(); - me["N12-scaletick"].hide(); - me["N12-scalenum"].hide(); - me["N12-XX"].show(); + obj["N12-scale"].setColor(0.7333,0.3803,0); + obj["N12-scale2"].setColor(0.7333,0.3803,0); + obj["N12"].hide(); + obj["N12-decimal"].hide(); + obj["N12-decpnt"].hide(); + obj["N12-needle"].hide(); + obj["N12-scaletick"].hide(); + obj["N12-scalenum"].hide(); + obj["N12-XX"].show(); } if (fadec.FADEC.Eng1.n1 == 1 and fadec.Fadec.n1Mode[0].getValue()) { - me["N11-thr"].show(); - me["N11-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet + obj["N11-thr"].show(); + obj["N11-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet } else { - me["N11-thr"].hide(); - me["N11-ylim"].hide(); + obj["N11-thr"].hide(); + obj["N11-ylim"].hide(); } if (fadec.FADEC.Eng2.n1 == 1 and fadec.Fadec.n1Mode[1].getValue()) { - me["N12-thr"].show(); - me["N12-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet + obj["N12-thr"].show(); + obj["N12-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet } else { - me["N12-thr"].hide(); - me["N12-ylim"].hide(); + obj["N12-thr"].hide(); + obj["N12-ylim"].hide(); } # N2 - me["N21"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n2Actual[0].getValue() + 0.05))); - me["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n2Actual[0].getValue() + 0.05, 1)))); - me["N22"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n2Actual[1].getValue() + 0.05))); - me["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n2Actual[1].getValue() + 0.05, 1)))); + obj["N21"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n2Actual[0].getValue() + 0.05))); + obj["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n2Actual[0].getValue() + 0.05, 1)))); + obj["N22"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n2Actual[1].getValue() + 0.05))); + obj["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n2Actual[1].getValue() + 0.05, 1)))); if (fadec.FADEC.Eng1.n2 == 1) { - me["N21"].show(); - me["N21-decimal"].show(); - me["N21-decpnt"].show(); - me["N21-XX"].hide(); + obj["N21"].show(); + obj["N21-decimal"].show(); + obj["N21-decpnt"].show(); + obj["N21-XX"].hide(); } else { - me["N21"].hide(); - me["N21-decimal"].hide(); - me["N21-decpnt"].hide(); - me["N21-XX"].show(); + obj["N21"].hide(); + obj["N21-decimal"].hide(); + obj["N21-decpnt"].hide(); + obj["N21-XX"].show(); } if (fadec.FADEC.Eng2.n2 == 1) { - me["N22"].show(); - me["N22-decimal"].show(); - me["N22-decpnt"].show(); - me["N22-XX"].hide(); + obj["N22"].show(); + obj["N22-decimal"].show(); + obj["N22-decpnt"].show(); + obj["N22-XX"].hide(); } else { - me["N22"].hide(); - me["N22-decimal"].hide(); - me["N22-decpnt"].hide(); - me["N22-XX"].show(); + obj["N22"].hide(); + obj["N22-decimal"].hide(); + obj["N22-decpnt"].hide(); + obj["N22-XX"].show(); } # FF fuel1 = pts.Engines.Engine.fuelFlow[0].getValue(); fuel2 = pts.Engines.Engine.fuelFlow[1].getValue(); if (acconfig_weight_kgs.getValue()) { - me["FF1"].setText(sprintf("%s", math.round(fuel1 * LBS2KGS, 10))); - me["FF2"].setText(sprintf("%s", math.round(fuel2 * LBS2KGS, 10))); - me["FFlow1-weight-unit"].setText("KG/H"); - me["FFlow2-weight-unit"].setText("KG/H"); + obj["FF1"].setText(sprintf("%s", math.round(fuel1 * LBS2KGS, 10))); + obj["FF2"].setText(sprintf("%s", math.round(fuel2 * LBS2KGS, 10))); + obj["FFlow1-weight-unit"].setText("KG/H"); + obj["FFlow2-weight-unit"].setText("KG/H"); } else { - me["FF1"].setText(sprintf("%s", math.round(fuel1, 10))); - me["FF2"].setText(sprintf("%s", math.round(fuel2, 10))); - me["FFlow1-weight-unit"].setText("LBS/H"); - me["FFlow2-weight-unit"].setText("LBS/H"); + obj["FF1"].setText(sprintf("%s", math.round(fuel1, 10))); + obj["FF2"].setText(sprintf("%s", math.round(fuel2, 10))); + obj["FFlow1-weight-unit"].setText("LBS/H"); + obj["FFlow2-weight-unit"].setText("LBS/H"); } if (fadec.FADEC.Eng1.ff == 1) { - me["FF1"].show(); - me["FF1-XX"].hide(); + obj["FF1"].show(); + obj["FF1-XX"].hide(); } else { - me["FF1"].hide(); - me["FF1-XX"].show(); + obj["FF1"].hide(); + obj["FF1-XX"].show(); } if (fadec.FADEC.Eng2.ff == 1) { - me["FF2"].show(); - me["FF2-XX"].hide(); + obj["FF2"].show(); + obj["FF2-XX"].hide(); } else { - me["FF2"].hide(); - me["FF2-XX"].show(); + obj["FF2"].hide(); + obj["FF2-XX"].show(); } # EPR Limit thrLimit = thr_limit.getValue(); eprLimit = epr_limit.getValue(); - me["EPRLim-mode"].setText(sprintf("%s", thrLimit)); - me["EPRLim"].setText(sprintf("%1.0f", math.floor(eprLimit))); - me["EPRLim-decimal"].setText(sprintf("%03d", (eprLimit - int(eprLimit)) * 1000)); + obj["EPRLim-mode"].setText(sprintf("%s", thrLimit)); + obj["EPRLim"].setText(sprintf("%1.0f", math.floor(eprLimit))); + obj["EPRLim-decimal"].setText(sprintf("%03d", (eprLimit - int(eprLimit)) * 1000)); fadecPower1 = fadecpower_1.getValue(); fadecPower2 = fadecpower_2.getValue(); fadecPowerStart = fadecpowerup.getValue(); if (fadecPower1 or fadecPower2 or fadecPowerStart) { - me["EPRLim-mode"].show(); - me["EPRLim-XX"].hide(); - me["EPRLim-XX2"].hide(); + obj["EPRLim-mode"].show(); + obj["EPRLim-XX"].hide(); + obj["EPRLim-XX2"].hide(); } else { - me["EPRLim-mode"].hide(); - me["EPRLim-XX"].show(); - me["EPRLim-XX2"].show(); + obj["EPRLim-mode"].hide(); + obj["EPRLim-XX"].show(); + obj["EPRLim-XX2"].show(); } if ((fadecPower1 or fadecPower2 or fadecPowerStart) and thrLimit != "MREV") { - me["EPRLim"].show(); - me["EPRLim-decpnt"].show(); - me["EPRLim-decimal"].show(); + obj["EPRLim"].show(); + obj["EPRLim-decpnt"].show(); + obj["EPRLim-decimal"].show(); } else { - me["EPRLim"].hide(); - me["EPRLim-decpnt"].hide(); - me["EPRLim-decimal"].hide(); + obj["EPRLim"].hide(); + obj["EPRLim-decpnt"].hide(); + obj["EPRLim-decimal"].hide(); } me.updateBase(notification); @@ -984,11 +638,11 @@ var canvas_upperECAM_test = { update: func() { elapsedtime = pts.Sim.Time.elapsedSec.getValue(); if (du3_test_time.getValue() + 1 >= elapsedtime) { - me["Test_white"].show(); - me["Test_text"].hide(); + obj["Test_white"].show(); + obj["Test_text"].hide(); } else { - me["Test_white"].hide(); - me["Test_text"].show(); + obj["Test_white"].hide(); + obj["Test_text"].show(); } }, }; @@ -1003,57 +657,6 @@ var createListenerForLine = func(prop, node, key) { }, 0, 0); }; -var _init = 0; - - -var UpperECAMRecipientCFM = -{ - new: func(_ident, group) - { - var new_class = emesary.Recipient.new(_ident); - new_class.MainScreen = nil; - new_class.Receive = func(notification) - { - if (notification.NotificationType == "FrameNotification") - { - if (new_class.MainScreen == nil) - new_class.MainScreen = canvas_upperECAM_cfm_eis2.new(group, "Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg"); - upperECAM_cfm_eis2 = new_class.MainScreen; - if (!math.mod(notifications.frameNotification.FrameCount,2)){ - new_class.MainScreen.update(notification); - } - return emesary.Transmitter.ReceiptStatus_OK; - } - return emesary.Transmitter.ReceiptStatus_NotProcessed; - }; - return new_class; - }, -}; - -var UpperECAMRecipientIAE = -{ - new: func(_ident, group) - { - var new_class = emesary.Recipient.new(_ident); - new_class.MainScreen = nil; - new_class.Receive = func(notification) - { - if (notification.NotificationType == "FrameNotification") - { - if (new_class.MainScreen == nil) - new_class.MainScreen = canvas_upperECAM_iae_eis2.new(group, "Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/iae-eis2.svg"); - upperECAM_iae_eis2 = new_class.MainScreen; - if (!math.mod(notifications.frameNotification.FrameCount,2)){ - new_class.MainScreen.update(notification); - } - return emesary.Transmitter.ReceiptStatus_OK; - } - return emesary.Transmitter.ReceiptStatus_NotProcessed; - }; - return new_class; - }, -}; - setlistener("sim/signals/fdm-initialized", func { createListenerForLine("/ECAM/msg/linec1", ECAM_line1c, "ECAML1"); @@ -1099,13 +702,4 @@ var showUpperECAM = func { setlistener("/systems/electrical/bus/ac-ess", func() { canvas_upperECAM_base.updateDu3(); -}, 0, 0); - -var slatLockGoing = 0; -var slatLockTimer = maketimer(0.50, func { - if (!slatLockFlash.getBoolValue()) { - slatLockFlash.setBoolValue(1); - } else { - slatLockFlash.setBoolValue(0); - } -}); \ No newline at end of file +}, 0, 0); \ No newline at end of file diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas index 0fea646d..084a6b2b 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas @@ -1,3 +1,7 @@ +var flapsPos = nil; +var slatLockFlash = props.globals.initNode("/instrumentation/du/slat-lock-flash", 0, "BOOL"); +var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); + var canvas_upperECAM = { new: func(svg) { var obj = {parents: [canvas_upperECAM] }; @@ -35,17 +39,119 @@ var canvas_upperECAM = { } }; - obj.update_items = [ - props.UpdateManager.FromHashValue("fuelTotalLbs", 1, func(val) { - if (acconfig_weight_kgs.getValue()) - { - obj["FOB-LBS"].setText(sprintf("%s", math.round(val * LBS2KGS, 10))); - obj["FOB-weight-unit"].setText("KG"); + obj.update_items_fadec_powered_n1 = [ + props.UpdateManager.FromHashValue("N1_1", 0.0001, func(val) { + obj["N11-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("N1_2", 0.0001, func(val) { + obj["N12-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("N1_actual_1", 0.001, func(val) { + obj["N11"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("N1_actual_2", 0.001, func(val) { + obj["N12"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("N1_lim", 0.0001, func(val) { + obj["N11-ylim"].setRotation((val + 90) * D2R); + obj["N12-ylim"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("N1thr_1", 0.0001, func(val) { + obj["N11-thr"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("N1thr_2", 0.0001, func(val) { + obj["N12-thr"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("reverser_1", 0.0001, func(val) { + if (val < 0.01 and fadec.FADEC.Eng1.n1 == 1) { + obj["N11-thr"].show(); } else { - obj["FOB-LBS"].setText(sprintf("%s", math.round(val, 10))); - obj["FOB-weight-unit"].setText("LBS"); + obj["N11-thr"].hide(); + } + + if (val >= 0.01 and fadec.FADEC.Eng1.n1 == 1) { + obj["REV1"].show(); + obj["REV1-box"].show(); + } else { + obj["REV1"].hide(); + obj["REV1-box"].hide(); + } + + if (val >= 0.95) { + obj["REV2"].setColor(0.0509,0.7529,0.2941); + } else { + obj["REV2"].setColor(0.7333,0.3803,0); } }), + props.UpdateManager.FromHashValue("reverser_2", 0.0001, func(val) { + if (val < 0.01 and fadec.FADEC.Eng2.n1 == 1) { + obj["N12-thr"].show(); + } else { + obj["N12-thr"].hide(); + } + + if (val >= 0.01 and fadec.FADEC.Eng2.n1 == 1) { + obj["REV2"].show(); + obj["REV2-box"].show(); + } else { + obj["REV2"].hide(); + obj["REV2-box"].hide(); + } + + if (val >= 0.95) { + obj["REV1"].setColor(0.0509,0.7529,0.2941); + } else { + obj["REV1"].setColor(0.7333,0.3803,0); + } + }), + ]; + + obj.update_items_fadec_powered_n2 = [ + props.UpdateManager.FromHashValue("N2_actual_1", 0.001, func(val) { + obj["N21"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("N2_actual_2", 0.001, func(val) { + obj["N22"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + ]; + + obj.update_items_fadec_powered_egt = [ + props.UpdateManager.FromHashValue("egt_1", 0.5, func(val) { + obj["EGT1"].setText(sprintf("%s", math.round(val))); + }), + props.UpdateManager.FromHashValue("egt_1_needle", 0.01, func(val) { + obj["EGT1-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("egt_2", 0.5, func(val) { + obj["EGT2"].setText(sprintf("%s", math.round(val))); + }), + props.UpdateManager.FromHashValue("egt_2_needle", 0.01, func(val) { + obj["EGT2-needle"].setRotation((val + 90) * D2R); + }), + ]; + + obj.update_items_fadec_powered_ff = [ + props.UpdateManager.FromHashValue("fuelflow_1", 0.5, func(val) { + if (acconfig_weight_kgs.getValue()) { + obj["FF1"].setText(sprintf("%s", math.round(val * LBS2KGS, 10))); + } else { + obj["FF1"].setText(sprintf("%s", math.round(val, 10))); + } + }), + props.UpdateManager.FromHashValue("fuelflow_2", 0.5, func(val) { + if (acconfig_weight_kgs.getValue()) { + obj["FF2"].setText(sprintf("%s", math.round(val * LBS2KGS, 10))); + } else { + obj["FF2"].setText(sprintf("%s", math.round(val, 10))); + } + }), + ]; + + obj.update_items = [ props.UpdateManager.FromHashList(["AcEssBus", "DisplayBrightness"], 0.01, func(val) { if (val.DisplayBrightness > 0.01 and val.AcEssBus >= 110) { obj.group.setVisible(1); @@ -53,6 +159,76 @@ var canvas_upperECAM = { obj.group.setVisible(0); } }), + props.UpdateManager.FromHashValue("acconfigUnits", 1, func(val) { + if (val) { + obj["FOB-weight-unit"].setText("KG"); + obj["FFlow-weight-unit"].setText("KG/H"); + } else { + obj["FOB-weight-unit"].setText("LBS"); + obj["FFlow-weight-unit"].setText("LBS/H"); + } + }), + props.UpdateManager.FromHashValue("fuelTotalLbs", 1, func(val) { + if (acconfig_weight_kgs.getValue()) + { + obj["FOB-LBS"].setText(sprintf("%s", math.round(val * LBS2KGS, 10))); + } else { + obj["FOB-LBS"].setText(sprintf("%s", math.round(val, 10))); + } + }), + props.UpdateManager.FromHashList(["flapxOffset", "flapyOffset"], 0.01, func(val) { + obj["FlapIndicator"].setTranslation(val.flapxOffset,val.flapyOffset); + }), + props.UpdateManager.FromHashList(["slatxOffset", "slatyOffset"], 0.01, func(val) { + obj["SlatIndicator"].setTranslation(val.slatxOffset,val.slatyOffset); + }), + props.UpdateManager.FromHashList(["flapxOffsetTrans", "flapyOffsetTrans"], 0.01, func(val) { + obj["FlapLine"].setTranslation(val.flapxOffsetTrans,val.flapyOffsetTrans); + }), + props.UpdateManager.FromHashList(["slatxOffsetTrans", "slatyOffsetTrans"], 0.01, func(val) { + obj["SlatLine"].setTranslation(val.slatxOffsetTrans,val.slatyOffsetTrans); + }), + props.UpdateManager.FromHashValue("alphaFloor", 1, func(val) { + if (val) { + obj["aFloor"].show(); + } else { + obj["aFloor"].hide(); + } + }), + props.UpdateManager.FromHashValue("flapsPos", 1, func(val) { + flapsPos = val; + if (flapsPos == 1) { + obj["FlapTxt"].setText("1"); + } else if (flapsPos == 2) { + obj["FlapTxt"].setText("1+F"); + } else if (flapsPos == 3) { + obj["FlapTxt"].setText("2"); + } else if (flapsPos == 4) { + obj["FlapTxt"].setText("3"); + } else if (flapsPos == 5) { + obj["FlapTxt"].setText("FULL"); + } else { + obj["FlapTxt"].setText(" "); # More efficient then hide/show + } + + if (flapsPos > 0) { + obj["FlapDots"].show(); + } else { + obj["FlapDots"].hide(); + } + }), + props.UpdateManager.FromHashValue("thrustLimit", 1, func(val) { + if (val == "FLX") { + obj["FlxLimDegreesC"].show(); + obj["FlxLimTemp"].show(); + } else { + obj["FlxLimDegreesC"].hide(); + obj["FlxLimTemp"].hide(); + } + }), + props.UpdateManager.FromHashValue("flexTemp", 1, func(val) { + obj["FlxLimTemp"].setText(sprintf("%2.0d",val)); + }), ]; obj.page = obj.group; @@ -65,11 +241,214 @@ var canvas_upperECAM = { "REV1-box","REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8","ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; }, + getColorString: func(color) { + if (color == "w") { + return [0.8078,0.8039,0.8078]; + } else if (color == "m") { + return [0.6901,0.3333,0.7450]; + } else if (color == "c") { + return [0.0901,0.6039,0.7176]; + } else if (color == "g") { + return [0.0509,0.7529,0.2941]; + } else if (color == "a") { + return [0.7333,0.3803,0]; + } else if (color == "r") { + return [1,0,0]; + } else { + return [1,1,1]; + } + }, update: func(notification) { foreach(var update_item; me.update_items) { update_item.update(notification); } + + if (me.group.getVisible == 0) { + return; + } + + if (fadec.FADEC.Eng1.n1 == 1) { + me["N11-scale"].setColor(0.8078,0.8039,0.8078); + me["N11-scale2"].setColor(1,0,0); + me["N11"].show(); + me["N11-decimal"].show(); + me["N11-decpnt"].show(); + me["N11-needle"].show(); + me["N11-ylim"].show(); + me["N11-scaletick"].show(); + me["N11-scalenum"].show(); + me["N11-box"].show(); + me["N11-XX"].hide(); + me["N11-XX2"].hide(); + me["N11-XX-box"].hide(); + } else { + me["N11-scale"].setColor(0.7333,0.3803,0); + me["N11-scale2"].setColor(0.7333,0.3803,0); + me["N11"].hide(); + me["N11-decimal"].hide(); + me["N11-decpnt"].hide(); + me["N11-needle"].hide(); + me["N11-ylim"].hide(); + me["N11-scaletick"].hide(); + me["N11-scalenum"].hide(); + me["N11-box"].hide(); + me["N11-XX"].show(); + me["N11-XX2"].show(); + me["N11-XX-box"].show(); + } + + if (fadec.FADEC.Eng2.n1 == 1) { + me["N12-scale"].setColor(0.8078,0.8039,0.8078); + me["N12-scale2"].setColor(1,0,0); + me["N12"].show(); + me["N12-decimal"].show(); + me["N12-decpnt"].show(); + me["N12-needle"].show(); + me["N12-ylim"].show(); + me["N12-scaletick"].show(); + me["N12-scalenum"].show(); + me["N12-box"].show(); + me["N12-XX"].hide(); + me["N12-XX2"].hide(); + me["N12-XX-box"].hide(); + } else { + me["N12-scale"].setColor(0.7333,0.3803,0); + me["N12-scale2"].setColor(0.7333,0.3803,0); + me["N12"].hide(); + me["N12-decimal"].hide(); + me["N12-decpnt"].hide(); + me["N12-needle"].hide(); + me["N12-ylim"].hide(); + me["N12-scaletick"].hide(); + me["N12-scalenum"].hide(); + me["N12-box"].hide(); + me["N12-XX"].show(); + me["N12-XX2"].show(); + me["N12-XX-box"].show(); + } + + if (fadec.FADEC.Eng1.egt == 1) { + me["EGT1-scale"].setColor(0.8078,0.8039,0.8078); + me["EGT1-scale2"].setColor(1,0,0); + me["EGT1"].show(); + me["EGT1-needle"].show(); + me["EGT1-scaletick"].show(); + me["EGT1-box"].show(); + me["EGT1-XX"].hide(); + } else { + me["EGT1-scale"].setColor(0.7333,0.3803,0); + me["EGT1-scale2"].setColor(0.7333,0.3803,0); + me["EGT1"].hide(); + me["EGT1-needle"].hide(); + me["EGT1-scaletick"].hide(); + me["EGT1-box"].hide(); + me["EGT1-XX"].show(); + } + + if (fadec.FADEC.Eng2.egt == 1) { + me["EGT2-scale"].setColor(0.8078,0.8039,0.8078); + me["EGT2-scale2"].setColor(1,0,0); + me["EGT2"].show(); + me["EGT2-needle"].show(); + me["EGT2-scaletick"].show(); + me["EGT2-box"].show(); + me["EGT2-XX"].hide(); + } else { + me["EGT2-scale"].setColor(0.7333,0.3803,0); + me["EGT2-scale2"].setColor(0.7333,0.3803,0); + me["EGT2"].hide(); + me["EGT2-needle"].hide(); + me["EGT2-scaletick"].hide(); + me["EGT2-box"].hide(); + me["EGT2-XX"].show(); + } + + if (fadec.FADEC.Eng1.n2 == 1) { + me["N21"].show(); + me["N21-decimal"].show(); + me["N21-decpnt"].show(); + me["N21-XX"].hide(); + } else { + me["N21"].hide(); + me["N21-decimal"].hide(); + me["N21-decpnt"].hide(); + me["N21-XX"].show(); + } + + if (fadec.FADEC.Eng2.n2 == 1) { + me["N22"].show(); + me["N22-decimal"].show(); + me["N22-decpnt"].show(); + me["N22-XX"].hide(); + } else { + me["N22"].hide(); + me["N22-decimal"].hide(); + me["N22-decpnt"].hide(); + me["N22-XX"].show(); + } + + if (fadec.FADEC.Eng1.ff == 1) { + me["FF1"].show(); + me["FF1-XX"].hide(); + } else { + me["FF1"].hide(); + me["FF1-XX"].show(); + } + + if (fadec.FADEC.Eng2.ff == 1) { + me["FF2"].show(); + me["FF2-XX"].hide(); + } else { + me["FF2"].hide(); + me["FF2-XX"].show(); + } + + if (pts.Fdm.JSBsim.Fcs.slatLocked.getValue()) { + if (slatLockGoing == 0) { + slatLockGoing = 1; + } + if (slatLockGoing == 1) { + slatLockTimer.start(); + if (slatLockFlash.getValue()) { + me["SlatAlphaLock"].show(); + } else { + me["SlatAlphaLock"].hide(); + } + } + } else { + slatLockTimer.stop(); + slatLockGoing = 0; + me["SlatAlphaLock"].hide(); + } + + if (fadec.FADEC.Eng1.n1 or fadec.FADEC.Eng2.n1) { + foreach(var update_item; me.update_items_fadec_powered_n1) + { + update_item.update(notification); + } + } + + if (fadec.FADEC.Eng1.n2 or fadec.FADEC.Eng2.n2) { + foreach(var update_item; me.update_items_fadec_powered_n2) + { + update_item.update(notification); + } + } + + if (fadec.FADEC.Eng1.egt or fadec.FADEC.Eng2.egt) { + foreach(var update_item; me.update_items_fadec_powered_egt) + { + update_item.update(notification); + } + } + + if (fadec.FADEC.Eng1.ff or fadec.FADEC.Eng2.ff) { + foreach(var update_item; me.update_items_fadec_powered_ff) + { + update_item.update(notification); + } + } }, }; @@ -102,6 +481,50 @@ input = { fuelTotalLbs: "/consumables/fuel/total-fuel-lbs", AcEssBus: "/systems/electrical/bus/ac-ess", DisplayBrightness: "/controls/lighting/DU/du3", + acconfigUnits: "/systems/acconfig/options/weight-kgs", + + # N1 parameters + N1_1: "/ECAM/Upper/N1[0]", + N1_2: "/ECAM/Upper/N1[1]", + N1_actual_1: "/engines/engine[0]/n1-actual", + N1_actual_2: "/engines/engine[1]/n1-actual", + N1_lim: "/ECAM/Upper/N1ylim", + N1thr_1: "/ECAM/Upper/N1thr[0]", + N1thr_2: "/ECAM/Upper/N1thr[1]", + + # N2 parameters + N2_actual_1: "/engines/engine[0]/n2-actual", + N2_actual_2: "/engines/engine[1]/n2-actual", + + # Reverse thrust + reverser_1: "/engines/engine[0]/reverser-pos-norm", + reverser_2: "/engines/engine[1]/reverser-pos-norm", + + # EGT + egt_1: "/engines/engine[0]/egt-actual", + egt_2: "/engines/engine[1]/egt-actual", + egt_1_needle: "/ECAM/Upper/EGT[0]", + egt_2_needle: "/ECAM/Upper/EGT[1]", + + # fuel flow + fuelflow_1: "/engines/engine[0]/fuel-flow_actual", + fuelflow_2: "/engines/engine[1]/fuel-flow_actual", + + # flaps + flapsPos: "/controls/flight/flaps-pos", + flapxOffset: "/ECAM/Upper/FlapX", + flapyOffset: "/ECAM/Upper/FlapY", + slatxOffset: "/ECAM/Upper/SlatX", + slatyOffset: "/ECAM/Upper/SlatY", + flapxOffsetTrans: "/ECAM/Upper/FlapXtrans", + flapyOffsetTrans: "/ECAM/Upper/FlapYtrans", + slatxOffsetTrans: "/ECAM/Upper/SlatXtrans", + slatyOffsetTrans: "/ECAM/Upper/SlatYtrans", + + # fadec + alphaFloor: "/systems/thrust/alpha-floor", + thrustLimit: "/controls/engines/thrust-limit", + flexTemp: "/FMGC/internal/flex", }; foreach (var name; keys(input)) { @@ -110,4 +533,13 @@ foreach (var name; keys(input)) { setlistener("/sim/signals/fdm-initialized", func() { execLoop(); -}, 0, 0); \ No newline at end of file +}, 0, 0); + +var slatLockGoing = 0; +var slatLockTimer = maketimer(0.50, func { + if (!slatLockFlash.getBoolValue()) { + slatLockFlash.setBoolValue(1); + } else { + slatLockFlash.setBoolValue(0); + } +}); \ No newline at end of file diff --git a/Nasal/emesary/exec.nas b/Nasal/emesary/exec.nas index 7a39129b..dd6b7b54 100644 --- a/Nasal/emesary/exec.nas +++ b/Nasal/emesary/exec.nas @@ -49,18 +49,21 @@ var execLoop = func # 2: HUD targets, HUD trig, HUD text # 3: HUD targets, VSD, RDR # - if (notifications.frameNotification.frame_rate_worst < 5) { - frame_inc = 0.25;#3.3 - } elsif (notifications.frameNotification.frame_rate_worst < 10) { - frame_inc = 0.125;#6.6 - } elsif (notifications.frameNotification.frame_rate_worst < 15) { - frame_inc = 0.10;#8.3 - } elsif (notifications.frameNotification.frame_rate_worst < 20) { - frame_inc = 0.075;#12.5 - } elsif (notifications.frameNotification.frame_rate_worst < 25) { - frame_inc = 0.05;#14.3 + + if (notifications.frameNotification.frame_rate < 5) { + frame_inc = 0.25;#4 Hz + } elsif (notifications.frameNotification.frame_rate < 10) { + frame_inc = 0.125;#8 Hz + } elsif (notifications.frameNotification.frame_rate < 15) { + frame_inc = 0.10;#10 Hz + } elsif (notifications.frameNotification.frame_rate < 20) { + frame_inc = 0.075;#13.3 Hz + } elsif (notifications.frameNotification.frame_rate < 25) { + frame_inc = 0.05;#20 Hz + } elsif (notifications.frameNotification.frame_rate < 40) { + frame_inc = 0.0333;#30 Hz } else { - frame_inc = 0.05;#20.0 + frame_inc = 0.02;#50 Hz } if (frame_inc != cur_frame_inc) { From ca64787a27bd71054872838598cf0f70436dadf5 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 28 Oct 2020 01:06:12 +0000 Subject: [PATCH 07/33] Finish upper ECAM. Still bug with thrust limit. --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 84 ----------------- .../Instruments/Upper-ECAM/Upper-ECAM.new.nas | 90 +++++++++++++++++++ 2 files changed, 90 insertions(+), 84 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 2dbc217b..7e033f55 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -23,7 +23,6 @@ var du3_test_time = props.globals.initNode("/instrumentation/du/du3-test-time", var du3_test_amount = props.globals.initNode("/instrumentation/du/du3-test-amount", 0.0, "DOUBLE"); var du3_offtime = props.globals.initNode("/instrumentation/du/du3-off-time", 0.0, "DOUBLE"); # Fetch nodes: -var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); var eng_option = props.globals.getNode("/options/eng", 1); var du3_lgt = props.globals.getNode("/controls/lighting/DU/du3", 1); @@ -42,30 +41,6 @@ var flapXTranslate = props.globals.getNode("/ECAM/Upper/FlapXtrans", 1); var flapYTranslate = props.globals.getNode("/ECAM/Upper/FlapYtrans", 1); var slatXTranslate = props.globals.getNode("/ECAM/Upper/SlatXtrans", 1); var slatYTranslate = props.globals.getNode("/ECAM/Upper/SlatYtrans", 1); -var ECAM_line1 = props.globals.getNode("/ECAM/msg/line1", 1); -var ECAM_line2 = props.globals.getNode("/ECAM/msg/line2", 1); -var ECAM_line3 = props.globals.getNode("/ECAM/msg/line3", 1); -var ECAM_line4 = props.globals.getNode("/ECAM/msg/line4", 1); -var ECAM_line5 = props.globals.getNode("/ECAM/msg/line5", 1); -var ECAM_line6 = props.globals.getNode("/ECAM/msg/line6", 1); -var ECAM_line7 = props.globals.getNode("/ECAM/msg/line7", 1); -var ECAM_line8 = props.globals.getNode("/ECAM/msg/line8", 1); -var ECAM_line1c = props.globals.getNode("/ECAM/msg/linec1", 1); -var ECAM_line2c = props.globals.getNode("/ECAM/msg/linec2", 1); -var ECAM_line3c = props.globals.getNode("/ECAM/msg/linec3", 1); -var ECAM_line4c = props.globals.getNode("/ECAM/msg/linec4", 1); -var ECAM_line5c = props.globals.getNode("/ECAM/msg/linec5", 1); -var ECAM_line6c = props.globals.getNode("/ECAM/msg/linec6", 1); -var ECAM_line7c = props.globals.getNode("/ECAM/msg/linec7", 1); -var ECAM_line8c = props.globals.getNode("/ECAM/msg/linec8", 1); -var ECAM_line1r = props.globals.getNode("/ECAM/rightmsg/line1", 1); -var ECAM_line2r = props.globals.getNode("/ECAM/rightmsg/line2", 1); -var ECAM_line3r = props.globals.getNode("/ECAM/rightmsg/line3", 1); -var ECAM_line4r = props.globals.getNode("/ECAM/rightmsg/line4", 1); -var ECAM_line5r = props.globals.getNode("/ECAM/rightmsg/line5", 1); -var ECAM_line6r = props.globals.getNode("/ECAM/rightmsg/line6", 1); -var ECAM_line7r = props.globals.getNode("/ECAM/rightmsg/line7", 1); -var ECAM_line8r = props.globals.getNode("/ECAM/rightmsg/line8", 1); var ECAM_line1rc = props.globals.getNode("/ECAM/rightmsg/linec1", 1); var ECAM_line2rc = props.globals.getNode("/ECAM/rightmsg/linec2", 1); var ECAM_line3rc = props.globals.getNode("/ECAM/rightmsg/linec3", 1); @@ -199,23 +174,6 @@ var canvas_upperECAM_base = { # ECAM Messages - obj["ECAML1"].setText(sprintf("%s", ECAM_line1.getValue())); - obj["ECAML2"].setText(sprintf("%s", ECAM_line2.getValue())); - obj["ECAML3"].setText(sprintf("%s", ECAM_line3.getValue())); - obj["ECAML4"].setText(sprintf("%s", ECAM_line4.getValue())); - obj["ECAML5"].setText(sprintf("%s", ECAM_line5.getValue())); - obj["ECAML6"].setText(sprintf("%s", ECAM_line6.getValue())); - obj["ECAML7"].setText(sprintf("%s", ECAM_line7.getValue())); - obj["ECAML8"].setText(sprintf("%s", ECAM_line8.getValue())); - - obj["ECAMR1"].setText(sprintf("%s", ECAM_line1r.getValue())); - obj["ECAMR2"].setText(sprintf("%s", ECAM_line2r.getValue())); - obj["ECAMR3"].setText(sprintf("%s", ECAM_line3r.getValue())); - obj["ECAMR4"].setText(sprintf("%s", ECAM_line4r.getValue())); - obj["ECAMR5"].setText(sprintf("%s", ECAM_line5r.getValue())); - obj["ECAMR6"].setText(sprintf("%s", ECAM_line6r.getValue())); - obj["ECAMR7"].setText(sprintf("%s", ECAM_line7r.getValue())); - obj["ECAMR8"].setText(sprintf("%s", ECAM_line8r.getValue())); var canvas_upperECAM_cfm_eis2 = { new: func(canvas_group, file) { @@ -228,39 +186,13 @@ var canvas_upperECAM_cfm_eis2 = { update: func(notification) { - # N1 Limit - thrLimit = thr_limit.getValue(); - n1Limit = n1_limit.getValue(); - obj["N1Lim-mode"].setText(sprintf("%s", thrLimit)); - obj["N1Lim"].setText(sprintf("%s", math.floor(n1Limit + 0.05))); - obj["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(n1Limit + 0.05, 1)))); fadecPower1 = fadecpower_1.getValue(); fadecPower2 = fadecpower_2.getValue(); fadecPowerStart = fadecpowerup.getValue(); - if (fadecPower1 or fadecPower2 or fadecPowerStart) { - obj["N1Lim-mode"].show(); - obj["N1Lim-XX"].hide(); - obj["N1Lim-XX2"].hide(); - } else { - obj["N1Lim-mode"].hide(); - obj["N1Lim-XX"].show(); - obj["N1Lim-XX2"].show(); - } - if ((fadecPower1 or fadecPower2 or fadecPowerStart) and thrLimit != "MREV") { - obj["N1Lim"].show(); - obj["N1Lim-decpnt"].show(); - obj["N1Lim-decimal"].show(); - obj["N1Lim-percent"].show(); - } else { - obj["N1Lim"].hide(); - obj["N1Lim-decpnt"].hide(); - obj["N1Lim-decimal"].hide(); - obj["N1Lim-percent"].hide(); - } me.updateBase(notification); }, @@ -659,23 +591,7 @@ var createListenerForLine = func(prop, node, key) { setlistener("sim/signals/fdm-initialized", func { - createListenerForLine("/ECAM/msg/linec1", ECAM_line1c, "ECAML1"); - createListenerForLine("/ECAM/msg/linec2", ECAM_line2c, "ECAML2"); - createListenerForLine("/ECAM/msg/linec3", ECAM_line3c, "ECAML3"); - createListenerForLine("/ECAM/msg/linec4", ECAM_line4c, "ECAML4"); - createListenerForLine("/ECAM/msg/linec5", ECAM_line5c, "ECAML5"); - createListenerForLine("/ECAM/msg/linec6", ECAM_line6c, "ECAML6"); - createListenerForLine("/ECAM/msg/linec7", ECAM_line7c, "ECAML7"); - createListenerForLine("/ECAM/msg/linec8", ECAM_line8c, "ECAML8"); - createListenerForLine("/ECAM/rightmsg/linec1", ECAM_line1rc, "ECAMR1"); - createListenerForLine("/ECAM/rightmsg/linec2", ECAM_line2rc, "ECAMR2"); - createListenerForLine("/ECAM/rightmsg/linec3", ECAM_line3rc, "ECAMR3"); - createListenerForLine("/ECAM/rightmsg/linec4", ECAM_line4rc, "ECAMR4"); - createListenerForLine("/ECAM/rightmsg/linec5", ECAM_line5rc, "ECAMR5"); - createListenerForLine("/ECAM/rightmsg/linec6", ECAM_line6rc, "ECAMR6"); - createListenerForLine("/ECAM/rightmsg/linec7", ECAM_line7rc, "ECAMR7"); - createListenerForLine("/ECAM/rightmsg/linec8", ECAM_line8rc, "ECAMR8"); if (!_init) { diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas index 084a6b2b..660b4197 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas @@ -2,6 +2,23 @@ var flapsPos = nil; var slatLockFlash = props.globals.initNode("/instrumentation/du/slat-lock-flash", 0, "BOOL"); var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); +var ECAM_line1 = props.globals.getNode("/ECAM/msg/line1", 1); +var ECAM_line2 = props.globals.getNode("/ECAM/msg/line2", 1); +var ECAM_line3 = props.globals.getNode("/ECAM/msg/line3", 1); +var ECAM_line4 = props.globals.getNode("/ECAM/msg/line4", 1); +var ECAM_line5 = props.globals.getNode("/ECAM/msg/line5", 1); +var ECAM_line6 = props.globals.getNode("/ECAM/msg/line6", 1); +var ECAM_line7 = props.globals.getNode("/ECAM/msg/line7", 1); +var ECAM_line8 = props.globals.getNode("/ECAM/msg/line8", 1); +var ECAM_line1r = props.globals.getNode("/ECAM/rightmsg/line1", 1); +var ECAM_line2r = props.globals.getNode("/ECAM/rightmsg/line2", 1); +var ECAM_line3r = props.globals.getNode("/ECAM/rightmsg/line3", 1); +var ECAM_line4r = props.globals.getNode("/ECAM/rightmsg/line4", 1); +var ECAM_line5r = props.globals.getNode("/ECAM/rightmsg/line5", 1); +var ECAM_line6r = props.globals.getNode("/ECAM/rightmsg/line6", 1); +var ECAM_line7r = props.globals.getNode("/ECAM/rightmsg/line7", 1); +var ECAM_line8r = props.globals.getNode("/ECAM/rightmsg/line8", 1); + var canvas_upperECAM = { new: func(svg) { var obj = {parents: [canvas_upperECAM] }; @@ -225,12 +242,58 @@ var canvas_upperECAM = { obj["FlxLimDegreesC"].hide(); obj["FlxLimTemp"].hide(); } + obj["N1Lim-mode"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("n1Limit", 0.01, func(val) { + obj["N1Lim"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); }), props.UpdateManager.FromHashValue("flexTemp", 1, func(val) { obj["FlxLimTemp"].setText(sprintf("%2.0d",val)); }), + props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], 1, func(val) { + if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { + obj["N1Lim-mode"].show(); + obj["N1Lim-XX"].hide(); + obj["N1Lim-XX2"].hide(); + } else { + obj["N1Lim-mode"].hide(); + obj["N1Lim-XX"].show(); + obj["N1Lim-XX2"].show(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit != "MREV") { + obj["N1Lim"].show(); + obj["N1Lim-decpnt"].show(); + obj["N1Lim-decimal"].show(); + obj["N1Lim-percent"].show(); + } else { + obj["N1Lim"].hide(); + obj["N1Lim-decpnt"].hide(); + obj["N1Lim-decimal"].hide(); + obj["N1Lim-percent"].hide(); + } + }), ]; + obj.createListenerForLine("/ECAM/msg/linec1", ECAM_line1c, "ECAML1"); + obj.createListenerForLine("/ECAM/msg/linec2", ECAM_line2c, "ECAML2"); + obj.createListenerForLine("/ECAM/msg/linec3", ECAM_line3c, "ECAML3"); + obj.createListenerForLine("/ECAM/msg/linec4", ECAM_line4c, "ECAML4"); + obj.createListenerForLine("/ECAM/msg/linec5", ECAM_line5c, "ECAML5"); + obj.createListenerForLine("/ECAM/msg/linec6", ECAM_line6c, "ECAML6"); + obj.createListenerForLine("/ECAM/msg/linec7", ECAM_line7c, "ECAML7"); + obj.createListenerForLine("/ECAM/msg/linec8", ECAM_line8c, "ECAML8"); + + obj.createListenerForLine("/ECAM/rightmsg/linec1", ECAM_line1rc, "ECAMR1"); + obj.createListenerForLine("/ECAM/rightmsg/linec2", ECAM_line2rc, "ECAMR2"); + obj.createListenerForLine("/ECAM/rightmsg/linec3", ECAM_line3rc, "ECAMR3"); + obj.createListenerForLine("/ECAM/rightmsg/linec4", ECAM_line4rc, "ECAMR4"); + obj.createListenerForLine("/ECAM/rightmsg/linec5", ECAM_line5rc, "ECAMR5"); + obj.createListenerForLine("/ECAM/rightmsg/linec6", ECAM_line6rc, "ECAMR6"); + obj.createListenerForLine("/ECAM/rightmsg/linec7", ECAM_line7rc, "ECAMR7"); + obj.createListenerForLine("/ECAM/rightmsg/linec8", ECAM_line8rc, "ECAMR8"); + obj.page = obj.group; return obj; }, @@ -258,6 +321,11 @@ var canvas_upperECAM = { return [1,1,1]; } }, + createListenerForLine: func(prop, node, key) { + setlistener(prop, func() { + me[key].setColor(me.getColorString(node.getValue())); + }, 0, 0); + }; update: func(notification) { foreach(var update_item; me.update_items) { @@ -422,6 +490,24 @@ var canvas_upperECAM = { me["SlatAlphaLock"].hide(); } + obj["ECAML1"].setText(sprintf("%s", ECAM_line1.getValue())); + obj["ECAML2"].setText(sprintf("%s", ECAM_line2.getValue())); + obj["ECAML3"].setText(sprintf("%s", ECAM_line3.getValue())); + obj["ECAML4"].setText(sprintf("%s", ECAM_line4.getValue())); + obj["ECAML5"].setText(sprintf("%s", ECAM_line5.getValue())); + obj["ECAML6"].setText(sprintf("%s", ECAM_line6.getValue())); + obj["ECAML7"].setText(sprintf("%s", ECAM_line7.getValue())); + obj["ECAML8"].setText(sprintf("%s", ECAM_line8.getValue())); + + obj["ECAMR1"].setText(sprintf("%s", ECAM_line1r.getValue())); + obj["ECAMR2"].setText(sprintf("%s", ECAM_line2r.getValue())); + obj["ECAMR3"].setText(sprintf("%s", ECAM_line3r.getValue())); + obj["ECAMR4"].setText(sprintf("%s", ECAM_line4r.getValue())); + obj["ECAMR5"].setText(sprintf("%s", ECAM_line5r.getValue())); + obj["ECAMR6"].setText(sprintf("%s", ECAM_line6r.getValue())); + obj["ECAMR7"].setText(sprintf("%s", ECAM_line7r.getValue())); + obj["ECAMR8"].setText(sprintf("%s", ECAM_line8r.getValue())); + if (fadec.FADEC.Eng1.n1 or fadec.FADEC.Eng2.n1) { foreach(var update_item; me.update_items_fadec_powered_n1) { @@ -524,7 +610,11 @@ input = { # fadec alphaFloor: "/systems/thrust/alpha-floor", thrustLimit: "/controls/engines/thrust-limit", + n1Limit: "/controls/engines/n1-limit", flexTemp: "/FMGC/internal/flex", + fadecPower1: "/systems/fadec/power1", + fadecPower2: "/systems/fadec/power2", + fadecPowerStart: "/systems/fadec/powerup", }; foreach (var name; keys(input)) { From 29459ee55f2d38c170fa9aaa9e1c00c5232733df Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 28 Oct 2020 01:11:59 +0000 Subject: [PATCH 08/33] Fix typo, port ECAM --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 24 ++-- .../Instruments/Upper-ECAM/Upper-ECAM.new.nas | 110 +++++++++++++++--- 2 files changed, 107 insertions(+), 27 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 7e033f55..c67c36ee 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -41,14 +41,22 @@ var flapXTranslate = props.globals.getNode("/ECAM/Upper/FlapXtrans", 1); var flapYTranslate = props.globals.getNode("/ECAM/Upper/FlapYtrans", 1); var slatXTranslate = props.globals.getNode("/ECAM/Upper/SlatXtrans", 1); var slatYTranslate = props.globals.getNode("/ECAM/Upper/SlatYtrans", 1); -var ECAM_line1rc = props.globals.getNode("/ECAM/rightmsg/linec1", 1); -var ECAM_line2rc = props.globals.getNode("/ECAM/rightmsg/linec2", 1); -var ECAM_line3rc = props.globals.getNode("/ECAM/rightmsg/linec3", 1); -var ECAM_line4rc = props.globals.getNode("/ECAM/rightmsg/linec4", 1); -var ECAM_line5rc = props.globals.getNode("/ECAM/rightmsg/linec5", 1); -var ECAM_line6rc = props.globals.getNode("/ECAM/rightmsg/linec6", 1); -var ECAM_line7rc = props.globals.getNode("/ECAM/rightmsg/linec7", 1); -var ECAM_line8rc = props.globals.getNode("/ECAM/rightmsg/linec8", 1); +var ECAM_line1 = props.globals.getNode("/ECAM/msg/line1", 1); +var ECAM_line2 = props.globals.getNode("/ECAM/msg/line2", 1); +var ECAM_line3 = props.globals.getNode("/ECAM/msg/line3", 1); +var ECAM_line4 = props.globals.getNode("/ECAM/msg/line4", 1); +var ECAM_line5 = props.globals.getNode("/ECAM/msg/line5", 1); +var ECAM_line6 = props.globals.getNode("/ECAM/msg/line6", 1); +var ECAM_line7 = props.globals.getNode("/ECAM/msg/line7", 1); +var ECAM_line8 = props.globals.getNode("/ECAM/msg/line8", 1); +var ECAM_line1r = props.globals.getNode("/ECAM/rightmsg/line1", 1); +var ECAM_line2r = props.globals.getNode("/ECAM/rightmsg/line2", 1); +var ECAM_line3r = props.globals.getNode("/ECAM/rightmsg/line3", 1); +var ECAM_line4r = props.globals.getNode("/ECAM/rightmsg/line4", 1); +var ECAM_line5r = props.globals.getNode("/ECAM/rightmsg/line5", 1); +var ECAM_line6r = props.globals.getNode("/ECAM/rightmsg/line6", 1); +var ECAM_line7r = props.globals.getNode("/ECAM/rightmsg/line7", 1); +var ECAM_line8r = props.globals.getNode("/ECAM/rightmsg/line8", 1); var rate = props.globals.getNode("/systems/acconfig/options/uecam-rate", 1); # Temporary variables diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas index 660b4197..09652502 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas @@ -18,6 +18,22 @@ var ECAM_line5r = props.globals.getNode("/ECAM/rightmsg/line5", 1); var ECAM_line6r = props.globals.getNode("/ECAM/rightmsg/line6", 1); var ECAM_line7r = props.globals.getNode("/ECAM/rightmsg/line7", 1); var ECAM_line8r = props.globals.getNode("/ECAM/rightmsg/line8", 1); +var ECAM_line1c = props.globals.getNode("/ECAM/msg/linec1", 1); +var ECAM_line2c = props.globals.getNode("/ECAM/msg/linec2", 1); +var ECAM_line3c = props.globals.getNode("/ECAM/msg/linec3", 1); +var ECAM_line4c = props.globals.getNode("/ECAM/msg/linec4", 1); +var ECAM_line5c = props.globals.getNode("/ECAM/msg/linec5", 1); +var ECAM_line6c = props.globals.getNode("/ECAM/msg/linec6", 1); +var ECAM_line7c = props.globals.getNode("/ECAM/msg/linec7", 1); +var ECAM_line8c = props.globals.getNode("/ECAM/msg/linec8", 1); +var ECAM_line1rc = props.globals.getNode("/ECAM/rightmsg/linec1", 1); +var ECAM_line2rc = props.globals.getNode("/ECAM/rightmsg/linec2", 1); +var ECAM_line3rc = props.globals.getNode("/ECAM/rightmsg/linec3", 1); +var ECAM_line4rc = props.globals.getNode("/ECAM/rightmsg/linec4", 1); +var ECAM_line5rc = props.globals.getNode("/ECAM/rightmsg/linec5", 1); +var ECAM_line6rc = props.globals.getNode("/ECAM/rightmsg/linec6", 1); +var ECAM_line7rc = props.globals.getNode("/ECAM/rightmsg/linec7", 1); +var ECAM_line8rc = props.globals.getNode("/ECAM/rightmsg/linec8", 1); var canvas_upperECAM = { new: func(svg) { @@ -276,6 +292,57 @@ var canvas_upperECAM = { }), ]; + obj.ecam_update = [ + props.UpdateManager.FromHashValue("ecamMsg1", 1, func(val) { + obj["ECAML1"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg2", 1, func(val) { + obj["ECAML2"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg3", 1, func(val) { + obj["ECAML3"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg4", 1, func(val) { + obj["ECAML4"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg5", 1, func(val) { + obj["ECAML5"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg6", 1, func(val) { + obj["ECAML6"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg7", 1, func(val) { + obj["ECAML7"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg8", 1, func(val) { + obj["ECAML8"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg1R", 1, func(val) { + obj["ECAMR1"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg2R", 1, func(val) { + obj["ECAMR2"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg3R", 1, func(val) { + obj["ECAMR3"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg4R", 1, func(val) { + obj["ECAMR4"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg5R", 1, func(val) { + obj["ECAMR5"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg6R", 1, func(val) { + obj["ECAMR6"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg7R", 1, func(val) { + obj["ECAMR7"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg8R", 1, func(val) { + obj["ECAMR8"].setText(sprintf("%s", val)); + }), + ]; + obj.createListenerForLine("/ECAM/msg/linec1", ECAM_line1c, "ECAML1"); obj.createListenerForLine("/ECAM/msg/linec2", ECAM_line2c, "ECAML2"); obj.createListenerForLine("/ECAM/msg/linec3", ECAM_line3c, "ECAML3"); @@ -325,7 +392,7 @@ var canvas_upperECAM = { setlistener(prop, func() { me[key].setColor(me.getColorString(node.getValue())); }, 0, 0); - }; + }, update: func(notification) { foreach(var update_item; me.update_items) { @@ -490,24 +557,6 @@ var canvas_upperECAM = { me["SlatAlphaLock"].hide(); } - obj["ECAML1"].setText(sprintf("%s", ECAM_line1.getValue())); - obj["ECAML2"].setText(sprintf("%s", ECAM_line2.getValue())); - obj["ECAML3"].setText(sprintf("%s", ECAM_line3.getValue())); - obj["ECAML4"].setText(sprintf("%s", ECAM_line4.getValue())); - obj["ECAML5"].setText(sprintf("%s", ECAM_line5.getValue())); - obj["ECAML6"].setText(sprintf("%s", ECAM_line6.getValue())); - obj["ECAML7"].setText(sprintf("%s", ECAM_line7.getValue())); - obj["ECAML8"].setText(sprintf("%s", ECAM_line8.getValue())); - - obj["ECAMR1"].setText(sprintf("%s", ECAM_line1r.getValue())); - obj["ECAMR2"].setText(sprintf("%s", ECAM_line2r.getValue())); - obj["ECAMR3"].setText(sprintf("%s", ECAM_line3r.getValue())); - obj["ECAMR4"].setText(sprintf("%s", ECAM_line4r.getValue())); - obj["ECAMR5"].setText(sprintf("%s", ECAM_line5r.getValue())); - obj["ECAMR6"].setText(sprintf("%s", ECAM_line6r.getValue())); - obj["ECAMR7"].setText(sprintf("%s", ECAM_line7r.getValue())); - obj["ECAMR8"].setText(sprintf("%s", ECAM_line8r.getValue())); - if (fadec.FADEC.Eng1.n1 or fadec.FADEC.Eng2.n1) { foreach(var update_item; me.update_items_fadec_powered_n1) { @@ -535,6 +584,11 @@ var canvas_upperECAM = { update_item.update(notification); } } + + foreach (var update_item; me.ecam_update) + { + update_item.update(notification); + } }, }; @@ -615,6 +669,24 @@ input = { fadecPower1: "/systems/fadec/power1", fadecPower2: "/systems/fadec/power2", fadecPowerStart: "/systems/fadec/powerup", + + # ecam + ecamMsg1: "/ECAM/msg/line1", + ecamMsg2: "/ECAM/msg/line2", + ecamMsg3: "/ECAM/msg/line3", + ecamMsg4: "/ECAM/msg/line4", + ecamMsg5: "/ECAM/msg/line5", + ecamMsg6: "/ECAM/msg/line6", + ecamMsg7: "/ECAM/msg/line7", + ecamMsg8: "/ECAM/msg/line8", + ecamMsg1R: "/ECAM/rightmsg/line1", + ecamMsg2R: "/ECAM/rightmsg/line2", + ecamMsg3R: "/ECAM/rightmsg/line3", + ecamMsg4R: "/ECAM/rightmsg/line4", + ecamMsg5R: "/ECAM/rightmsg/line5", + ecamMsg6R: "/ECAM/rightmsg/line6", + ecamMsg7R: "/ECAM/rightmsg/line7", + ecamMsg8R: "/ECAM/rightmsg/line8", }; foreach (var name; keys(input)) { From def546d04fca878c5b08aa5e5411fd7e5f046c6b Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 28 Oct 2020 16:03:20 +0000 Subject: [PATCH 09/33] Updates and improvements to Emesary code. Fix bugs. Everything ported for CFM. All works. Add memoized update to ensure efficiency is maximum. --- A320-main.xml | 20 + Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 98 +-- .../Instruments/Upper-ECAM/Upper-ECAM.new.nas | 678 ++++++++++-------- Nasal/emesary/M_frame_notification.nas | 1 - Nasal/emesary/exec.nas | 2 - 5 files changed, 404 insertions(+), 395 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index b7ae2535..454963f5 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -622,6 +622,26 @@ 0 0 + + + + + + + + + + + + + + + + + + + + diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index c67c36ee..0872e295 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -98,22 +98,7 @@ var canvas_upperECAM_base = { # set font - obj["ECAML1"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML2"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML3"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML4"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML5"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML6"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML7"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML8"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR1"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR2"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR3"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR4"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR5"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR6"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR7"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR8"].setFont("LiberationMonoCustom.ttf"); + me.page = canvas_group; @@ -178,33 +163,6 @@ var canvas_upperECAM_base = { } } }, - updateBase: func(notification) { - - # ECAM Messages - - -var canvas_upperECAM_cfm_eis2 = { - new: func(canvas_group, file) { - var m = {parents: [canvas_upperECAM_cfm_eis2, canvas_upperECAM_base]}; - m.init(canvas_group, file); - m.updateAFloor(); - m.updateFlx(); - return m; - }, - - update: func(notification) { - - - - fadecPower1 = fadecpower_1.getValue(); - fadecPower2 = fadecpower_2.getValue(); - fadecPowerStart = fadecpowerup.getValue(); - - - - me.updateBase(notification); - }, -}; var canvas_upperECAM_iae_eis2 = { new: func(canvas_group, file) { @@ -573,57 +531,9 @@ var canvas_upperECAM_test = { return m; }, getKeys: func() { - return ["Test_white","Test_text"]; + return []; }, update: func() { - elapsedtime = pts.Sim.Time.elapsedSec.getValue(); - if (du3_test_time.getValue() + 1 >= elapsedtime) { - obj["Test_white"].show(); - obj["Test_text"].hide(); - } else { - obj["Test_white"].hide(); - obj["Test_text"].show(); - } - }, -}; - -var createListenerForLine = func(prop, node, key) { - setlistener(prop, func() { - if (eng_option.getValue() == "IAE") { - upperECAM_iae_eis2[key].setColor(upperECAM_iae_eis2.getColorString(node.getValue())); - } else { - upperECAM_cfm_eis2[key].setColor(upperECAM_cfm_eis2.getColorString(node.getValue())); - } - }, 0, 0); -}; - -setlistener("sim/signals/fdm-initialized", func { - - - - if (!_init) { - } - - upperECAM_update.start(); - if (rate.getValue() > 1) { - u_rateApply(); - } -}); - -var u_rateApply = func { - upperECAM_update.restart(0.05 * rate.getValue()); -} - -var upperECAM_update = maketimer(0.05, func { - canvas_upperECAM_base.update(); -}); - -var showUpperECAM = func { - var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); - dlg.setCanvas(upperECAM_display); -} - -setlistener("/systems/electrical/bus/ac-ess", func() { - canvas_upperECAM_base.updateDu3(); -}, 0, 0); \ No newline at end of file + }, +}; \ No newline at end of file diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas index 09652502..c75e78ed 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas @@ -2,22 +2,6 @@ var flapsPos = nil; var slatLockFlash = props.globals.initNode("/instrumentation/du/slat-lock-flash", 0, "BOOL"); var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); -var ECAM_line1 = props.globals.getNode("/ECAM/msg/line1", 1); -var ECAM_line2 = props.globals.getNode("/ECAM/msg/line2", 1); -var ECAM_line3 = props.globals.getNode("/ECAM/msg/line3", 1); -var ECAM_line4 = props.globals.getNode("/ECAM/msg/line4", 1); -var ECAM_line5 = props.globals.getNode("/ECAM/msg/line5", 1); -var ECAM_line6 = props.globals.getNode("/ECAM/msg/line6", 1); -var ECAM_line7 = props.globals.getNode("/ECAM/msg/line7", 1); -var ECAM_line8 = props.globals.getNode("/ECAM/msg/line8", 1); -var ECAM_line1r = props.globals.getNode("/ECAM/rightmsg/line1", 1); -var ECAM_line2r = props.globals.getNode("/ECAM/rightmsg/line2", 1); -var ECAM_line3r = props.globals.getNode("/ECAM/rightmsg/line3", 1); -var ECAM_line4r = props.globals.getNode("/ECAM/rightmsg/line4", 1); -var ECAM_line5r = props.globals.getNode("/ECAM/rightmsg/line5", 1); -var ECAM_line6r = props.globals.getNode("/ECAM/rightmsg/line6", 1); -var ECAM_line7r = props.globals.getNode("/ECAM/rightmsg/line7", 1); -var ECAM_line8r = props.globals.getNode("/ECAM/rightmsg/line8", 1); var ECAM_line1c = props.globals.getNode("/ECAM/msg/linec1", 1); var ECAM_line2c = props.globals.getNode("/ECAM/msg/linec2", 1); var ECAM_line3c = props.globals.getNode("/ECAM/msg/linec3", 1); @@ -47,12 +31,15 @@ var canvas_upperECAM = { obj.canvas.addPlacement({"node": "uecam.screen"}); obj.group = obj.canvas.createGroup(); + obj.test = obj.canvas.createGroup(); obj.font_mapper = func(family, weight) { return "LiberationFonts/LiberationSans-Regular.ttf"; }; canvas.parsesvg(obj.group, svg, {"font-mapper": obj.font_mapper} ); + canvas.parsesvg(obj.test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg", {"font-mapper": obj.font_mapper} ); + obj.test.setVisible(0); foreach(var key; obj.getKeys()) { obj[key] = obj.group.getElementById(key); @@ -72,126 +59,17 @@ var canvas_upperECAM = { } }; - obj.update_items_fadec_powered_n1 = [ - props.UpdateManager.FromHashValue("N1_1", 0.0001, func(val) { - obj["N11-needle"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("N1_2", 0.0001, func(val) { - obj["N12-needle"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("N1_actual_1", 0.001, func(val) { - obj["N11"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); - }), - props.UpdateManager.FromHashValue("N1_actual_2", 0.001, func(val) { - obj["N12"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); - }), - props.UpdateManager.FromHashValue("N1_lim", 0.0001, func(val) { - obj["N11-ylim"].setRotation((val + 90) * D2R); - obj["N12-ylim"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("N1thr_1", 0.0001, func(val) { - obj["N11-thr"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("N1thr_2", 0.0001, func(val) { - obj["N12-thr"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("reverser_1", 0.0001, func(val) { - if (val < 0.01 and fadec.FADEC.Eng1.n1 == 1) { - obj["N11-thr"].show(); - } else { - obj["N11-thr"].hide(); - } - - if (val >= 0.01 and fadec.FADEC.Eng1.n1 == 1) { - obj["REV1"].show(); - obj["REV1-box"].show(); - } else { - obj["REV1"].hide(); - obj["REV1-box"].hide(); - } - - if (val >= 0.95) { - obj["REV2"].setColor(0.0509,0.7529,0.2941); - } else { - obj["REV2"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashValue("reverser_2", 0.0001, func(val) { - if (val < 0.01 and fadec.FADEC.Eng2.n1 == 1) { - obj["N12-thr"].show(); - } else { - obj["N12-thr"].hide(); - } - - if (val >= 0.01 and fadec.FADEC.Eng2.n1 == 1) { - obj["REV2"].show(); - obj["REV2-box"].show(); - } else { - obj["REV2"].hide(); - obj["REV2-box"].hide(); - } - - if (val >= 0.95) { - obj["REV1"].setColor(0.0509,0.7529,0.2941); - } else { - obj["REV1"].setColor(0.7333,0.3803,0); - } - }), - ]; + obj.units = acconfig_weight_kgs.getValue(); - obj.update_items_fadec_powered_n2 = [ - props.UpdateManager.FromHashValue("N2_actual_1", 0.001, func(val) { - obj["N21"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); - }), - props.UpdateManager.FromHashValue("N2_actual_2", 0.001, func(val) { - obj["N22"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); - }), - ]; - - obj.update_items_fadec_powered_egt = [ - props.UpdateManager.FromHashValue("egt_1", 0.5, func(val) { - obj["EGT1"].setText(sprintf("%s", math.round(val))); - }), - props.UpdateManager.FromHashValue("egt_1_needle", 0.01, func(val) { - obj["EGT1-needle"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("egt_2", 0.5, func(val) { - obj["EGT2"].setText(sprintf("%s", math.round(val))); - }), - props.UpdateManager.FromHashValue("egt_2_needle", 0.01, func(val) { - obj["EGT2-needle"].setRotation((val + 90) * D2R); - }), - ]; - - obj.update_items_fadec_powered_ff = [ - props.UpdateManager.FromHashValue("fuelflow_1", 0.5, func(val) { - if (acconfig_weight_kgs.getValue()) { - obj["FF1"].setText(sprintf("%s", math.round(val * LBS2KGS, 10))); - } else { - obj["FF1"].setText(sprintf("%s", math.round(val, 10))); - } - }), - props.UpdateManager.FromHashValue("fuelflow_2", 0.5, func(val) { - if (acconfig_weight_kgs.getValue()) { - obj["FF2"].setText(sprintf("%s", math.round(val * LBS2KGS, 10))); - } else { - obj["FF2"].setText(sprintf("%s", math.round(val, 10))); - } - }), - ]; + obj.powerItem = props.UpdateManager.FromHashList(["AcEssBus", "DisplayBrightness"], 0.01, func(val) { + if (val.DisplayBrightness > 0.01 and val.AcEssBus >= 110) { + obj.group.setVisible(1); + } else { + obj.group.setVisible(0); + } + }); obj.update_items = [ - props.UpdateManager.FromHashList(["AcEssBus", "DisplayBrightness"], 0.01, func(val) { - if (val.DisplayBrightness > 0.01 and val.AcEssBus >= 110) { - obj.group.setVisible(1); - } else { - obj.group.setVisible(0); - } - }), props.UpdateManager.FromHashValue("acconfigUnits", 1, func(val) { if (val) { obj["FOB-weight-unit"].setText("KG"); @@ -200,13 +78,14 @@ var canvas_upperECAM = { obj["FOB-weight-unit"].setText("LBS"); obj["FFlow-weight-unit"].setText("LBS/H"); } + obj.units = val; }), - props.UpdateManager.FromHashValue("fuelTotalLbs", 1, func(val) { - if (acconfig_weight_kgs.getValue()) + props.UpdateManager.FromHashList(["fuelTotalLbs","acconfigUnits"], 1, func(val) { + if (obj.units) { - obj["FOB-LBS"].setText(sprintf("%s", math.round(val * LBS2KGS, 10))); + obj["FOB-LBS"].setText(sprintf("%s", math.round(val.fuelTotalLbs * LBS2KGS, 10))); } else { - obj["FOB-LBS"].setText(sprintf("%s", math.round(val, 10))); + obj["FOB-LBS"].setText(sprintf("%s", math.round(val.fuelTotalLbs, 10))); } }), props.UpdateManager.FromHashList(["flapxOffset", "flapyOffset"], 0.01, func(val) { @@ -250,14 +129,7 @@ var canvas_upperECAM = { obj["FlapDots"].hide(); } }), - props.UpdateManager.FromHashValue("thrustLimit", 1, func(val) { - if (val == "FLX") { - obj["FlxLimDegreesC"].show(); - obj["FlxLimTemp"].show(); - } else { - obj["FlxLimDegreesC"].hide(); - obj["FlxLimTemp"].hide(); - } + props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) { obj["N1Lim-mode"].setText(sprintf("%s", val)); }), props.UpdateManager.FromHashValue("n1Limit", 0.01, func(val) { @@ -267,7 +139,7 @@ var canvas_upperECAM = { props.UpdateManager.FromHashValue("flexTemp", 1, func(val) { obj["FlxLimTemp"].setText(sprintf("%2.0d",val)); }), - props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], 1, func(val) { + props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], nil, func(val) { if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { obj["N1Lim-mode"].show(); obj["N1Lim-XX"].hide(); @@ -289,56 +161,176 @@ var canvas_upperECAM = { obj["N1Lim-decimal"].hide(); obj["N1Lim-percent"].hide(); } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") { + obj["FlxLimDegreesC"].show(); + obj["FlxLimTemp"].show(); + } else { + obj["FlxLimDegreesC"].hide(); + obj["FlxLimTemp"].hide(); + } + }), + ]; + + obj.update_items_fadec_powered_n1 = [ + props.UpdateManager.FromHashValue("N1_1", 0.01, func(val) { + obj["N11-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("N1_2", 0.01, func(val) { + obj["N12-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("N1_actual_1", 0.025, func(val) { + obj["N11"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("N1_actual_2", 0.025, func(val) { + obj["N12"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("N1_lim", 0.01, func(val) { + obj["N11-ylim"].setRotation((val + 90) * D2R); + obj["N12-ylim"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("N1thr_1", 0.01, func(val) { + obj["N11-thr"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("N1thr_2", 0.01, func(val) { + obj["N12-thr"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("reverser_1", 0.005, func(val) { + if (val < 0.01 and fadec.FADEC.Eng1.n1 == 1) { + obj["N11-thr"].show(); + } else { + obj["N11-thr"].hide(); + } + + if (val >= 0.01 and fadec.FADEC.Eng1.n1 == 1) { + obj["REV1"].show(); + obj["REV1-box"].show(); + } else { + obj["REV1"].hide(); + obj["REV1-box"].hide(); + } + + if (val >= 0.95) { + obj["REV2"].setColor(0.0509,0.7529,0.2941); + } else { + obj["REV2"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("reverser_2", 0.005, func(val) { + if (val < 0.01 and fadec.FADEC.Eng2.n1 == 1) { + obj["N12-thr"].show(); + } else { + obj["N12-thr"].hide(); + } + + if (val >= 0.01 and fadec.FADEC.Eng2.n1 == 1) { + obj["REV2"].show(); + obj["REV2-box"].show(); + } else { + obj["REV2"].hide(); + obj["REV2-box"].hide(); + } + + if (val >= 0.95) { + obj["REV1"].setColor(0.0509,0.7529,0.2941); + } else { + obj["REV1"].setColor(0.7333,0.3803,0); + } + }), + ]; + + obj.update_items_fadec_powered_n2 = [ + props.UpdateManager.FromHashValue("N2_actual_1", 0.025, func(val) { + obj["N21"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("N2_actual_2", 0.025, func(val) { + obj["N22"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + ]; + + obj.update_items_fadec_powered_egt = [ + props.UpdateManager.FromHashValue("egt_1", 0.5, func(val) { + obj["EGT1"].setText(sprintf("%s", math.round(val))); + }), + props.UpdateManager.FromHashValue("egt_1_needle", 0.01, func(val) { + obj["EGT1-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("egt_2", 0.5, func(val) { + obj["EGT2"].setText(sprintf("%s", math.round(val))); + }), + props.UpdateManager.FromHashValue("egt_2_needle", 0.01, func(val) { + obj["EGT2-needle"].setRotation((val + 90) * D2R); + }), + ]; + + obj.update_items_fadec_powered_ff = [ + props.UpdateManager.FromHashList(["fuelflow_1","acconfigUnits"], 1, func(val) { + if (obj.units) { + obj["FF1"].setText(sprintf("%s", math.round(val.fuelflow_1 * LBS2KGS, 10))); + } else { + obj["FF1"].setText(sprintf("%s", math.round(val.fuelflow_1, 10))); + } + }), + props.UpdateManager.FromHashList(["fuelflow_2","acconfigUnits"], 1, func(val) { + if (obj.units) { + obj["FF2"].setText(sprintf("%s", math.round(val.fuelflow_2 * LBS2KGS, 10))); + } else { + obj["FF2"].setText(sprintf("%s", math.round(val.fuelflow_2, 10))); + } }), ]; obj.ecam_update = [ - props.UpdateManager.FromHashValue("ecamMsg1", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg1", nil, func(val) { obj["ECAML1"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg2", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg2", nil, func(val) { obj["ECAML2"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg3", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg3", nil, func(val) { obj["ECAML3"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg4", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg4", nil, func(val) { obj["ECAML4"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg5", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg5", nil, func(val) { obj["ECAML5"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg6", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg6", nil, func(val) { obj["ECAML6"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg7", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg7", nil, func(val) { obj["ECAML7"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg8", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg8", nil, func(val) { obj["ECAML8"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg1R", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg1R", nil, func(val) { obj["ECAMR1"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg2R", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg2R", nil, func(val) { obj["ECAMR2"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg3R", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg3R", nil, func(val) { obj["ECAMR3"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg4R", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg4R", nil, func(val) { obj["ECAMR4"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg5R", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg5R", nil, func(val) { obj["ECAMR5"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg6R", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg6R", nil, func(val) { obj["ECAMR6"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg7R", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg7R", nil, func(val) { obj["ECAMR7"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("ecamMsg8R", 1, func(val) { + props.UpdateManager.FromHashValue("ecamMsg8R", nil, func(val) { obj["ECAMR8"].setText(sprintf("%s", val)); }), ]; @@ -361,7 +353,31 @@ var canvas_upperECAM = { obj.createListenerForLine("/ECAM/rightmsg/linec7", ECAM_line7rc, "ECAMR7"); obj.createListenerForLine("/ECAM/rightmsg/linec8", ECAM_line8rc, "ECAMR8"); + obj["ECAML1"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML2"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML3"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML4"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML5"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML6"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML7"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML8"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR1"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR2"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR3"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR4"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR5"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR6"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR7"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR8"].setFont("LiberationMonoCustom.ttf"); + obj.page = obj.group; + + # cache + obj._cachedN1 = [nil, nil]; + obj._cachedN2 = [nil, nil]; + obj._cachedEGT = [nil, nil]; + obj._cachedFF = [nil, nil]; + return obj; }, getKeys: func() { @@ -369,7 +385,7 @@ var canvas_upperECAM = { "EGT1-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal","N12-box","N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N12-XX2","N12-XX-box","EGT2-needle","EGT2", "EGT2-scale","EGT2-box","EGT2-scale2","EGT2-scaletick","EGT2-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","N1Lim-mode","N1Lim","N1Lim-decpnt","N1Lim-decimal","N1Lim-percent","N1Lim-XX","N1Lim-XX2","REV1", "REV1-box","REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8","ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", - "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; + "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp","Test_white","Test_text"]; }, getColorString: func(color) { if (color == "w") { @@ -394,149 +410,43 @@ var canvas_upperECAM = { }, 0, 0); }, update: func(notification) { - foreach(var update_item; me.update_items) - { - update_item.update(notification); - } + me.powerItem.update(notification); if (me.group.getVisible == 0) { return; } - if (fadec.FADEC.Eng1.n1 == 1) { - me["N11-scale"].setColor(0.8078,0.8039,0.8078); - me["N11-scale2"].setColor(1,0,0); - me["N11"].show(); - me["N11-decimal"].show(); - me["N11-decpnt"].show(); - me["N11-needle"].show(); - me["N11-ylim"].show(); - me["N11-scaletick"].show(); - me["N11-scalenum"].show(); - me["N11-box"].show(); - me["N11-XX"].hide(); - me["N11-XX2"].hide(); - me["N11-XX-box"].hide(); - } else { - me["N11-scale"].setColor(0.7333,0.3803,0); - me["N11-scale2"].setColor(0.7333,0.3803,0); - me["N11"].hide(); - me["N11-decimal"].hide(); - me["N11-decpnt"].hide(); - me["N11-needle"].hide(); - me["N11-ylim"].hide(); - me["N11-scaletick"].hide(); - me["N11-scalenum"].hide(); - me["N11-box"].hide(); - me["N11-XX"].show(); - me["N11-XX2"].show(); - me["N11-XX-box"].show(); + foreach(var update_item; me.update_items) + { + update_item.update(notification); + } + + if (fadec.FADEC.Eng1.n1 != me._cachedN1[0]) { + me.updateN11(); + } + if (fadec.FADEC.Eng2.n1 != me._cachedN1[1]) { + me.updateN12(); } - if (fadec.FADEC.Eng2.n1 == 1) { - me["N12-scale"].setColor(0.8078,0.8039,0.8078); - me["N12-scale2"].setColor(1,0,0); - me["N12"].show(); - me["N12-decimal"].show(); - me["N12-decpnt"].show(); - me["N12-needle"].show(); - me["N12-ylim"].show(); - me["N12-scaletick"].show(); - me["N12-scalenum"].show(); - me["N12-box"].show(); - me["N12-XX"].hide(); - me["N12-XX2"].hide(); - me["N12-XX-box"].hide(); - } else { - me["N12-scale"].setColor(0.7333,0.3803,0); - me["N12-scale2"].setColor(0.7333,0.3803,0); - me["N12"].hide(); - me["N12-decimal"].hide(); - me["N12-decpnt"].hide(); - me["N12-needle"].hide(); - me["N12-ylim"].hide(); - me["N12-scaletick"].hide(); - me["N12-scalenum"].hide(); - me["N12-box"].hide(); - me["N12-XX"].show(); - me["N12-XX2"].show(); - me["N12-XX-box"].show(); + if (fadec.FADEC.Eng1.n2 != me._cachedN2[0]) { + me.updateN21(); + } + if (fadec.FADEC.Eng2.n2 != me._cachedN2[1]) { + me.updateN22(); } - if (fadec.FADEC.Eng1.egt == 1) { - me["EGT1-scale"].setColor(0.8078,0.8039,0.8078); - me["EGT1-scale2"].setColor(1,0,0); - me["EGT1"].show(); - me["EGT1-needle"].show(); - me["EGT1-scaletick"].show(); - me["EGT1-box"].show(); - me["EGT1-XX"].hide(); - } else { - me["EGT1-scale"].setColor(0.7333,0.3803,0); - me["EGT1-scale2"].setColor(0.7333,0.3803,0); - me["EGT1"].hide(); - me["EGT1-needle"].hide(); - me["EGT1-scaletick"].hide(); - me["EGT1-box"].hide(); - me["EGT1-XX"].show(); + if (fadec.FADEC.Eng1.egt != me._cachedEGT[0]) { + me.updateEGT1(); + } + if (fadec.FADEC.Eng2.egt != me._cachedEGT[1]) { + me.updateEGT2(); } - if (fadec.FADEC.Eng2.egt == 1) { - me["EGT2-scale"].setColor(0.8078,0.8039,0.8078); - me["EGT2-scale2"].setColor(1,0,0); - me["EGT2"].show(); - me["EGT2-needle"].show(); - me["EGT2-scaletick"].show(); - me["EGT2-box"].show(); - me["EGT2-XX"].hide(); - } else { - me["EGT2-scale"].setColor(0.7333,0.3803,0); - me["EGT2-scale2"].setColor(0.7333,0.3803,0); - me["EGT2"].hide(); - me["EGT2-needle"].hide(); - me["EGT2-scaletick"].hide(); - me["EGT2-box"].hide(); - me["EGT2-XX"].show(); + if (fadec.FADEC.Eng1.ff != me._cachedFF[0]) { + me.updateFF1(); } - - if (fadec.FADEC.Eng1.n2 == 1) { - me["N21"].show(); - me["N21-decimal"].show(); - me["N21-decpnt"].show(); - me["N21-XX"].hide(); - } else { - me["N21"].hide(); - me["N21-decimal"].hide(); - me["N21-decpnt"].hide(); - me["N21-XX"].show(); - } - - if (fadec.FADEC.Eng2.n2 == 1) { - me["N22"].show(); - me["N22-decimal"].show(); - me["N22-decpnt"].show(); - me["N22-XX"].hide(); - } else { - me["N22"].hide(); - me["N22-decimal"].hide(); - me["N22-decpnt"].hide(); - me["N22-XX"].show(); - } - - if (fadec.FADEC.Eng1.ff == 1) { - me["FF1"].show(); - me["FF1-XX"].hide(); - } else { - me["FF1"].hide(); - me["FF1-XX"].show(); - } - - if (fadec.FADEC.Eng2.ff == 1) { - me["FF2"].show(); - me["FF2-XX"].hide(); - } else { - me["FF2"].hide(); - me["FF2-XX"].show(); + if (fadec.FADEC.Eng2.ff != me._cachedFF[1]) { + me.updateFF2(); } if (pts.Fdm.JSBsim.Fcs.slatLocked.getValue()) { @@ -590,6 +500,169 @@ var canvas_upperECAM = { update_item.update(notification); } }, + + updateN11: func() { + me._cachedN1[0] = fadec.FADEC.Eng1.n1; + if (fadec.FADEC.Eng1.n1 == 1) { + me["N11-scale"].setColor(0.8078,0.8039,0.8078); + me["N11-scale2"].setColor(1,0,0); + me["N11"].show(); + me["N11-decimal"].show(); + me["N11-decpnt"].show(); + me["N11-needle"].show(); + me["N11-ylim"].show(); + me["N11-scaletick"].show(); + me["N11-scalenum"].show(); + me["N11-box"].show(); + me["N11-XX"].hide(); + me["N11-XX2"].hide(); + me["N11-XX-box"].hide(); + } else { + me["N11-scale"].setColor(0.7333,0.3803,0); + me["N11-scale2"].setColor(0.7333,0.3803,0); + me["N11"].hide(); + me["N11-decimal"].hide(); + me["N11-decpnt"].hide(); + me["N11-needle"].hide(); + me["N11-ylim"].hide(); + me["N11-scaletick"].hide(); + me["N11-scalenum"].hide(); + me["N11-box"].hide(); + me["N11-XX"].show(); + me["N11-XX2"].show(); + me["N11-XX-box"].show(); + } + }, + updateN12: func() { + me._cachedN1[1] = fadec.FADEC.Eng2.n1; + if (fadec.FADEC.Eng2.n1 == 1) { + me["N12-scale"].setColor(0.8078,0.8039,0.8078); + me["N12-scale2"].setColor(1,0,0); + me["N12"].show(); + me["N12-decimal"].show(); + me["N12-decpnt"].show(); + me["N12-needle"].show(); + me["N12-ylim"].show(); + me["N12-scaletick"].show(); + me["N12-scalenum"].show(); + me["N12-box"].show(); + me["N12-XX"].hide(); + me["N12-XX2"].hide(); + me["N12-XX-box"].hide(); + } else { + me["N12-scale"].setColor(0.7333,0.3803,0); + me["N12-scale2"].setColor(0.7333,0.3803,0); + me["N12"].hide(); + me["N12-decimal"].hide(); + me["N12-decpnt"].hide(); + me["N12-needle"].hide(); + me["N12-ylim"].hide(); + me["N12-scaletick"].hide(); + me["N12-scalenum"].hide(); + me["N12-box"].hide(); + me["N12-XX"].show(); + me["N12-XX2"].show(); + me["N12-XX-box"].show(); + } + }, + updateN21: func() { + me._cachedN2[0] = fadec.FADEC.Eng1.n2; + if (fadec.FADEC.Eng1.n2 == 1) { + me["N21"].show(); + me["N21-decimal"].show(); + me["N21-decpnt"].show(); + me["N21-XX"].hide(); + } else { + me["N21"].hide(); + me["N21-decimal"].hide(); + me["N21-decpnt"].hide(); + me["N21-XX"].show(); + } + }, + updateN22: func() { + me._cachedN2[1] = fadec.FADEC.Eng2.n2; + if (fadec.FADEC.Eng2.n2 == 1) { + me["N22"].show(); + me["N22-decimal"].show(); + me["N22-decpnt"].show(); + me["N22-XX"].hide(); + } else { + me["N22"].hide(); + me["N22-decimal"].hide(); + me["N22-decpnt"].hide(); + me["N22-XX"].show(); + } + }, + updateEGT1: func() { + me._cachedEGT[0] = fadec.FADEC.Eng1.egt; + if (fadec.FADEC.Eng1.egt == 1) { + me["EGT1-scale"].setColor(0.8078,0.8039,0.8078); + me["EGT1-scale2"].setColor(1,0,0); + me["EGT1"].show(); + me["EGT1-needle"].show(); + me["EGT1-scaletick"].show(); + me["EGT1-box"].show(); + me["EGT1-XX"].hide(); + } else { + me["EGT1-scale"].setColor(0.7333,0.3803,0); + me["EGT1-scale2"].setColor(0.7333,0.3803,0); + me["EGT1"].hide(); + me["EGT1-needle"].hide(); + me["EGT1-scaletick"].hide(); + me["EGT1-box"].hide(); + me["EGT1-XX"].show(); + } + }, + updateEGT2: func() { + me._cachedEGT[1] = fadec.FADEC.Eng2.egt; + if (fadec.FADEC.Eng2.egt == 1) { + me["EGT2-scale"].setColor(0.8078,0.8039,0.8078); + me["EGT2-scale2"].setColor(1,0,0); + me["EGT2"].show(); + me["EGT2-needle"].show(); + me["EGT2-scaletick"].show(); + me["EGT2-box"].show(); + me["EGT2-XX"].hide(); + } else { + me["EGT2-scale"].setColor(0.7333,0.3803,0); + me["EGT2-scale2"].setColor(0.7333,0.3803,0); + me["EGT2"].hide(); + me["EGT2-needle"].hide(); + me["EGT2-scaletick"].hide(); + me["EGT2-box"].hide(); + me["EGT2-XX"].show(); + } + }, + updateFF1: func() { + me._cachedFF[0] = fadec.FADEC.Eng1.ff; + if (fadec.FADEC.Eng1.ff == 1) { + me["FF1"].show(); + me["FF1-XX"].hide(); + } else { + me["FF1"].hide(); + me["FF1-XX"].show(); + } + }, + updateFF2: func() { + me._cachedFF[1] = fadec.FADEC.Eng2.ff; + if (fadec.FADEC.Eng2.ff == 1) { + me["FF2"].show(); + me["FF2-XX"].hide(); + } else { + me["FF2"].hide(); + me["FF2-XX"].show(); + } + }, + updateTest: func() { + elapsedtime = pts.Sim.Time.elapsedSec.getValue(); + if (du3_test_time.getValue() + 1 >= elapsedtime) { + obj["Test_white"].show(); + obj["Test_text"].hide(); + } else { + obj["Test_white"].hide(); + obj["Test_text"].show(); + } + }, }; var UpperECAMRecipient = @@ -603,7 +676,7 @@ var UpperECAMRecipient = if (notification.NotificationType == "FrameNotification") { if (new_class.MainScreen == nil) - new_class.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 Upper ECAM CFM"); + new_class.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 E/WD CFM"); if (!math.mod(notifications.frameNotification.FrameCount,2)){ new_class.MainScreen.update(notification); } @@ -615,7 +688,8 @@ var UpperECAMRecipient = }, }; -emesary.GlobalTransmitter.Register(UpperECAMRecipient.new("A320 Upper ECAM")); +var A320EWD = UpperECAMRecipient.new("A320 E/WD"); +emesary.GlobalTransmitter.Register(A320EWD); input = { fuelTotalLbs: "/consumables/fuel/total-fuel-lbs", @@ -666,8 +740,8 @@ input = { thrustLimit: "/controls/engines/thrust-limit", n1Limit: "/controls/engines/n1-limit", flexTemp: "/FMGC/internal/flex", - fadecPower1: "/systems/fadec/power1", - fadecPower2: "/systems/fadec/power2", + fadecPower1: "/systems/fadec/powered1", + fadecPower2: "/systems/fadec/powered2", fadecPowerStart: "/systems/fadec/powerup", # ecam @@ -693,6 +767,14 @@ foreach (var name; keys(input)) { emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Upper ECAM", name, input[name])); } +emesary.GlobalTransmitter.OverrunDetection(9); + + +var showUpperECAM = func { + var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); + dlg.setCanvas(A320EWD.MainScreen.canvas); +} + setlistener("/sim/signals/fdm-initialized", func() { execLoop(); }, 0, 0); diff --git a/Nasal/emesary/M_frame_notification.nas b/Nasal/emesary/M_frame_notification.nas index 713b75a6..95716a51 100644 --- a/Nasal/emesary/M_frame_notification.nas +++ b/Nasal/emesary/M_frame_notification.nas @@ -61,7 +61,6 @@ var FrameNotification = new_class.monitored[notification.variable] = root_node.getNode(notification.property,1); new_class.properties[notification.property] = notification.variable; - print("[INFO]: (",notification.module,") FrameNotification.",notification.variable, " = ",notification.property, " -> ", new_class.monitored[notification.variable].getPath() ); return emesary.Transmitter.ReceiptStatus_OK; } return emesary.Transmitter.ReceiptStatus_NotProcessed; diff --git a/Nasal/emesary/exec.nas b/Nasal/emesary/exec.nas index dd6b7b54..175a3c39 100644 --- a/Nasal/emesary/exec.nas +++ b/Nasal/emesary/exec.nas @@ -74,9 +74,7 @@ var execLoop = func # setup the properties to monitor for this system input = { -FrameRate : "/sim/frame-rate", frame_rate : "/sim/frame-rate", -frame_rate_worst : "/sim/frame-rate-worst", elapsed_seconds : "/sim/time/elapsed-sec", }; From 5d561b851c6ccc8b3800c403a920517ef8b8b0b0 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 28 Oct 2020 16:24:18 +0000 Subject: [PATCH 10/33] Add test page again --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 25 +--- .../Instruments/Upper-ECAM/Upper-ECAM.new.nas | 109 ++++++++++++++---- Nasal/emesary/exec.nas | 22 +--- 3 files changed, 91 insertions(+), 65 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 0872e295..634bb663 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -18,12 +18,7 @@ var EPR_thr_2 = props.globals.initNode("/ECAM/Upper/EPRthr[1]", 0); var EPR_lim = props.globals.initNode("/ECAM/Upper/EPRylim", 0, "DOUBLE"); var EGT_1 = props.globals.initNode("/ECAM/Upper/EGT[0]", 0, "DOUBLE"); var EGT_2 = props.globals.initNode("/ECAM/Upper/EGT[1]", 0, "DOUBLE"); -var du3_test = props.globals.initNode("/instrumentation/du/du3-test", 0, "BOOL"); -var du3_test_time = props.globals.initNode("/instrumentation/du/du3-test-time", 0.0, "DOUBLE"); -var du3_test_amount = props.globals.initNode("/instrumentation/du/du3-test-amount", 0.0, "DOUBLE"); -var du3_offtime = props.globals.initNode("/instrumentation/du/du3-off-time", 0.0, "DOUBLE"); # Fetch nodes: -var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); var eng_option = props.globals.getNode("/options/eng", 1); var du3_lgt = props.globals.getNode("/controls/lighting/DU/du3", 1); var flaps3_ovr = props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", 1); @@ -112,26 +107,8 @@ var canvas_upperECAM_base = { elapsedtime = pts.Sim.Time.elapsedSec.getValue(); if (systems.ELEC.Bus.acEss.getValue() >= 110) { - if (du3_offtime.getValue() + 3 < elapsedtime) { - if (pts.Gear.wow[0].getValue()) { - if (acconfig.getValue() != 1 and du3_test.getValue() != 1) { - du3_test.setValue(1); - du3_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du3_test_time.setValue(elapsedtime); - } else if (acconfig.getValue() and du3_test.getValue() != 1) { - du3_test.setValue(1); - du3_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du3_test_time.setValue(elapsedtime - 30); - } - } else { - du3_test.setValue(1); - du3_test_amount.setValue(0); - du3_test_time.setValue(-100); - } - } + } else { - du3_test.setValue(0); - du3_offtime.setValue(elapsedtime); } }, update: func() { diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas index c75e78ed..7905432d 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas @@ -1,6 +1,12 @@ var flapsPos = nil; +var elapsedtime = nil; var slatLockFlash = props.globals.initNode("/instrumentation/du/slat-lock-flash", 0, "BOOL"); var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); +var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); +var du3_test = props.globals.initNode("/instrumentation/du/du3-test", 0, "BOOL"); +var du3_test_time = props.globals.initNode("/instrumentation/du/du3-test-time", 0.0, "DOUBLE"); +var du3_test_amount = props.globals.initNode("/instrumentation/du/du3-test-amount", 0.0, "DOUBLE"); +var du3_offtime = props.globals.initNode("/instrumentation/du/du3-off-time", 0.0, "DOUBLE"); var ECAM_line1c = props.globals.getNode("/ECAM/msg/linec1", 1); var ECAM_line2c = props.globals.getNode("/ECAM/msg/linec2", 1); @@ -38,8 +44,6 @@ var canvas_upperECAM = { }; canvas.parsesvg(obj.group, svg, {"font-mapper": obj.font_mapper} ); - canvas.parsesvg(obj.test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg", {"font-mapper": obj.font_mapper} ); - obj.test.setVisible(0); foreach(var key; obj.getKeys()) { obj[key] = obj.group.getElementById(key); @@ -58,16 +62,43 @@ var canvas_upperECAM = { obj[key].set("clip-frame", canvas.Element.PARENT); } }; + canvas.parsesvg(obj.test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg", {"font-mapper": obj.font_mapper} ); + foreach(var key; obj.getKeysTest()) { + obj[key] = obj.test.getElementById(key); + + var clip_el = obj.test.getElementById(key ~ "_clip"); + if (clip_el != nil) { + clip_el.setVisible(0); + var tran_rect = clip_el.getTransformedBounds(); + + var clip_rect = sprintf("rect(%d,%d, %d,%d)", + tran_rect[1], + tran_rect[2], + tran_rect[3], + tran_rect[0]); + obj[key].set("clip", clip_rect); + obj[key].set("clip-frame", canvas.Element.PARENT); + } + }; obj.units = acconfig_weight_kgs.getValue(); - obj.powerItem = props.UpdateManager.FromHashList(["AcEssBus", "DisplayBrightness"], 0.01, func(val) { - if (val.DisplayBrightness > 0.01 and val.AcEssBus >= 110) { - obj.group.setVisible(1); - } else { - obj.group.setVisible(0); - } - }); + obj.power = [ + props.UpdateManager.FromHashList(["AcEssBus", "DisplayBrightness"], nil, func(val) { + if (val.DisplayBrightness > 0.01 and val.AcEssBus >= 110) { + if (du3_test_time.getValue() + du3_test_amount.getValue() >= pts.Sim.Time.elapsedSec.getValue()) { + obj.group.setVisible(0); + obj.test.setVisible(1); + } else { + obj.group.setVisible(1); + obj.test.setVisible(0); + } + } else { + obj.group.setVisible(0); + obj.test.setVisible(0); + } + }), + ]; obj.update_items = [ props.UpdateManager.FromHashValue("acconfigUnits", 1, func(val) { @@ -385,7 +416,10 @@ var canvas_upperECAM = { "EGT1-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal","N12-box","N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N12-XX2","N12-XX-box","EGT2-needle","EGT2", "EGT2-scale","EGT2-box","EGT2-scale2","EGT2-scaletick","EGT2-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","N1Lim-mode","N1Lim","N1Lim-decpnt","N1Lim-decimal","N1Lim-percent","N1Lim-XX","N1Lim-XX2","REV1", "REV1-box","REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8","ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", - "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp","Test_white","Test_text"]; + "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; + }, + getKeysTest: func() { + return ["Test_white","Test_text"]; }, getColorString: func(color) { if (color == "w") { @@ -410,9 +444,15 @@ var canvas_upperECAM = { }, 0, 0); }, update: func(notification) { - me.powerItem.update(notification); + foreach (var powerItem; me.power) { + powerItem.update(notification); + } - if (me.group.getVisible == 0) { + if (me.test.getVisible() == 1) { + me.updateTest(); + } + + if (me.group.getVisible() == 0) { return; } @@ -654,13 +694,36 @@ var canvas_upperECAM = { } }, updateTest: func() { - elapsedtime = pts.Sim.Time.elapsedSec.getValue(); - if (du3_test_time.getValue() + 1 >= elapsedtime) { - obj["Test_white"].show(); - obj["Test_text"].hide(); + if (du3_test_time.getValue() + 1 >= pts.Sim.Time.elapsedSec.getValue()) { + me["Test_white"].show(); + me["Test_text"].hide(); } else { - obj["Test_white"].hide(); - obj["Test_text"].show(); + me["Test_white"].hide(); + me["Test_text"].show(); + } + }, + powerTransient: func() { + if (systems.ELEC.Bus.acEss.getValue() >= 110) { + if (du3_offtime.getValue() + 3 < pts.Sim.Time.elapsedSec.getValue()) { + if (pts.Gear.wow[0].getValue()) { + if (!acconfig.getBoolValue() and !du3_test.getBoolValue()) { + du3_test.setValue(1); + du3_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du3_test_time.setValue(pts.Sim.Time.elapsedSec.getValue()); + } else if (acconfig.getBoolValue() and !du3_test.getBoolValue()) { + du3_test.setValue(1); + du3_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du3_test_time.setValue(pts.Sim.Time.elapsedSec.getValue() - 30); + } + } else { + du3_test.setValue(1); + du3_test_amount.setValue(0); + du3_test_time.setValue(-100); + } + } + } else { + du3_test.setValue(0); + du3_offtime.setValue(elapsedtime); } }, }; @@ -677,9 +740,9 @@ var UpperECAMRecipient = { if (new_class.MainScreen == nil) new_class.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 E/WD CFM"); - if (!math.mod(notifications.frameNotification.FrameCount,2)){ + #if (!math.mod(notifications.frameNotification.FrameCount,2)){ new_class.MainScreen.update(notification); - } + #} return emesary.Transmitter.ReceiptStatus_OK; } return emesary.Transmitter.ReceiptStatus_NotProcessed; @@ -767,8 +830,6 @@ foreach (var name; keys(input)) { emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Upper ECAM", name, input[name])); } -emesary.GlobalTransmitter.OverrunDetection(9); - var showUpperECAM = func { var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); @@ -779,6 +840,10 @@ setlistener("/sim/signals/fdm-initialized", func() { execLoop(); }, 0, 0); +setlistener("/systems/electrical/bus/ac-ess", func() { + A320EWD.MainScreen.powerTransient(); +}, 0, 0); + var slatLockGoing = 0; var slatLockTimer = maketimer(0.50, func { if (!slatLockFlash.getBoolValue()) { diff --git a/Nasal/emesary/exec.nas b/Nasal/emesary/exec.nas index 175a3c39..26cde2fb 100644 --- a/Nasal/emesary/exec.nas +++ b/Nasal/emesary/exec.nas @@ -17,16 +17,6 @@ # #---------------------------------------------------------------------------*/ - - -# to add properties to the FrameNotification simply send a FrameNotificationAddProperty -# to the global transmitter. This will be received by the frameNotifcation object and -# included in the update. -#emesary.GlobalTransmitter.NotifyAll(new FrameNotificationAddProperty("MODULE", "wow","gear/gear[0]/wow")); -#emesary.GlobalTransmitter.NotifyAll(new FrameNotificationAddProperty("MODULE", "engine_n2", "engines/engine[0]/n2")); -# - - # # real time exec loop. var frame_inc = 0; @@ -42,14 +32,7 @@ var execLoop = func # notifications.frameNotification.FrameCount = notifications.frameNotification.FrameCount + 1; - # - # framecount - # 0: HUD targets, Radar, RWR - # 1: HUD targets, RDR, VSD - # 2: HUD targets, HUD trig, HUD text - # 3: HUD targets, VSD, RDR - # - + if (notifications.frameNotification.frame_rate < 5) { frame_inc = 0.25;#4 Hz } elsif (notifications.frameNotification.frame_rate < 10) { @@ -80,4 +63,5 @@ elapsed_seconds : "/sim/time/elapsed-sec", foreach (var name; keys(input)) { emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("EXEC", name, input[name])); -} \ No newline at end of file +} +emesary.GlobalTransmitter.OverrunDetection(9); \ No newline at end of file From d550bf84fbf06167e55b69e2d363234746f12fda Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 28 Oct 2020 17:44:59 +0000 Subject: [PATCH 11/33] Fix power transients --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 188 ------------------ .../Instruments/Upper-ECAM/Upper-ECAM.new.nas | 61 ++---- Nasal/emesary/exec.nas | 6 +- 3 files changed, 24 insertions(+), 231 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 634bb663..d7d28b46 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -1,145 +1,3 @@ -# A3XX Upper ECAM Canvas - -# Copyright (c) 2020 Josh Davidson (Octal450) - -var upperECAM_cfm_eis2 = nil; -var upperECAM_iae_eis2 = nil; -var upperECAM_test = nil; -var upperECAM_display = nil; - -# Conversion factor pounds to kilogram -LBS2KGS = 0.4535924; - -# Create Nodes: -var EPR_1 = props.globals.initNode("/ECAM/Upper/EPR[0]", 0, "DOUBLE"); -var EPR_2 = props.globals.initNode("/ECAM/Upper/EPR[1]", 0, "DOUBLE"); -var EPR_thr_1 = props.globals.initNode("/ECAM/Upper/EPRthr[0]", 0); -var EPR_thr_2 = props.globals.initNode("/ECAM/Upper/EPRthr[1]", 0); -var EPR_lim = props.globals.initNode("/ECAM/Upper/EPRylim", 0, "DOUBLE"); -var EGT_1 = props.globals.initNode("/ECAM/Upper/EGT[0]", 0, "DOUBLE"); -var EGT_2 = props.globals.initNode("/ECAM/Upper/EGT[1]", 0, "DOUBLE"); -# Fetch nodes: -var eng_option = props.globals.getNode("/options/eng", 1); -var du3_lgt = props.globals.getNode("/controls/lighting/DU/du3", 1); -var flaps3_ovr = props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", 1); -var fadecpower_1 = props.globals.getNode("/systems/fadec/powered1", 1); -var fadecpower_2 = props.globals.getNode("/systems/fadec/powered2", 1); -var fadecpowerup = props.globals.getNode("/systems/fadec/powerup", 1); -var thr_limit = props.globals.getNode("/controls/engines/thrust-limit", 1); -var n1_limit = props.globals.getNode("/controls/engines/n1-limit", 1); -var epr_limit = props.globals.getNode("/controls/engines/epr-limit", 1); -var flapXOffset = props.globals.getNode("/ECAM/Upper/FlapX", 1); -var flapYOffset = props.globals.getNode("/ECAM/Upper/FlapY", 1); -var slatXOffset = props.globals.getNode("/ECAM/Upper/SlatX", 1); -var slatYOffset = props.globals.getNode("/ECAM/Upper/SlatY", 1); -var flapXTranslate = props.globals.getNode("/ECAM/Upper/FlapXtrans", 1); -var flapYTranslate = props.globals.getNode("/ECAM/Upper/FlapYtrans", 1); -var slatXTranslate = props.globals.getNode("/ECAM/Upper/SlatXtrans", 1); -var slatYTranslate = props.globals.getNode("/ECAM/Upper/SlatYtrans", 1); -var ECAM_line1 = props.globals.getNode("/ECAM/msg/line1", 1); -var ECAM_line2 = props.globals.getNode("/ECAM/msg/line2", 1); -var ECAM_line3 = props.globals.getNode("/ECAM/msg/line3", 1); -var ECAM_line4 = props.globals.getNode("/ECAM/msg/line4", 1); -var ECAM_line5 = props.globals.getNode("/ECAM/msg/line5", 1); -var ECAM_line6 = props.globals.getNode("/ECAM/msg/line6", 1); -var ECAM_line7 = props.globals.getNode("/ECAM/msg/line7", 1); -var ECAM_line8 = props.globals.getNode("/ECAM/msg/line8", 1); -var ECAM_line1r = props.globals.getNode("/ECAM/rightmsg/line1", 1); -var ECAM_line2r = props.globals.getNode("/ECAM/rightmsg/line2", 1); -var ECAM_line3r = props.globals.getNode("/ECAM/rightmsg/line3", 1); -var ECAM_line4r = props.globals.getNode("/ECAM/rightmsg/line4", 1); -var ECAM_line5r = props.globals.getNode("/ECAM/rightmsg/line5", 1); -var ECAM_line6r = props.globals.getNode("/ECAM/rightmsg/line6", 1); -var ECAM_line7r = props.globals.getNode("/ECAM/rightmsg/line7", 1); -var ECAM_line8r = props.globals.getNode("/ECAM/rightmsg/line8", 1); -var rate = props.globals.getNode("/systems/acconfig/options/uecam-rate", 1); - -# Temporary variables -var cur_eng_option = 0; -var elapsedtime = 0; -var EGT_1_cur = 0; -var EGT_2_cur = 0; -var eprLimit = 0; -var EPR_1_cur = 0; -var EPR_2_cur = 0; -var EPR_1_act = 0; -var EPR_2_act = 0; -var EPR_lim_cur = 0; -var EPR_thr_1_act = 0; -var EPR_thr_2_act = 0; -var flapsPos = 0; -var fuel1 = 0; -var fuel2 = 0; -var fadecPower1 = 0; -var fadecPower2 = 0; -var fadecPowerStart = 0; -var n1Limit = 0; -var N1_1_cur = 0; -var N1_2_cur = 0; -var N1_1_act = 0; -var N1_2_act = 0; -var N1_lim_cur = 0; -var n2cur_1 = 0; -var n2cur_2 = 0; -var rev_1_act = 0; -var rev_2_act = 0; -var rev_1_cur = 0; -var rev_2_cur = 0; -var thrLimit = 0; - -var canvas_upperECAM_base = { - init: func(canvas_group, file) { - - - - # set font - - - - me.page = canvas_group; - - return me; - }, - getKeys: func() { - return []; - }, - updateDu3: func() { - elapsedtime = pts.Sim.Time.elapsedSec.getValue(); - - if (systems.ELEC.Bus.acEss.getValue() >= 110) { - - } else { - } - }, - update: func() { - elapsedtime = pts.Sim.Time.elapsedSec.getValue(); - cur_eng_option = eng_option.getValue(); - if (1 == 0) { - if (systems.ELEC.Bus.acEss.getValue() >= 110 and du3_lgt.getValue() > 0.01) { - if (du3_test_time.getValue() + du3_test_amount.getValue() >= elapsedtime) { - upperECAM_cfm_eis2.page.hide(); - upperECAM_iae_eis2.page.hide(); - upperECAM_test.page.show(); - upperECAM_test.update(); - } else { - upperECAM_test.page.hide(); - if (cur_eng_option == "CFM") { - upperECAM_cfm_eis2.page.show(); - upperECAM_iae_eis2.page.hide(); - upperECAM_cfm_eis2.update(); - } else if (cur_eng_option == "IAE") { - upperECAM_cfm_eis2.page.hide(); - upperECAM_iae_eis2.page.show(); - upperECAM_iae_eis2.update(); - } - } - } else { - upperECAM_test.page.hide(); - upperECAM_cfm_eis2.page.hide(); - upperECAM_iae_eis2.page.hide(); - } - } - }, var canvas_upperECAM_iae_eis2 = { new: func(canvas_group, file) { @@ -468,49 +326,3 @@ var canvas_upperECAM_iae_eis2 = { me.updateBase(notification); }, }; - -var canvas_upperECAM_test = { - init: func(canvas_group, file) { - var font_mapper = func(family, weight) { - return "LiberationFonts/LiberationSans-Regular.ttf"; - }; - - canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); - - var svg_keys = me.getKeys(); - foreach(var key; svg_keys) { - me[key] = canvas_group.getElementById(key); - - var clip_el = canvas_group.getElementById(key ~ "_clip"); - if (clip_el != nil) { - clip_el.setVisible(0); - var tran_rect = clip_el.getTransformedBounds(); - - var clip_rect = sprintf("rect(%d,%d, %d,%d)", - tran_rect[1], # 0 ys - tran_rect[2], # 1 xe - tran_rect[3], # 2 ye - tran_rect[0]); #3 xs - # coordinates are top,right,bottom,left (ys, xe, ye, xs) ref: l621 of simgear/canvas/CanvasElement.cxx - me[key].set("clip", clip_rect); - me[key].set("clip-frame", canvas.Element.PARENT); - } - } - - me.page = canvas_group; - - return me; - }, - new: func(canvas_group, file) { - var m = {parents: [canvas_upperECAM_test]}; - m.init(canvas_group, file); - - return m; - }, - getKeys: func() { - return []; - }, - update: func() { - - }, -}; \ No newline at end of file diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas index 7905432d..127a9998 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas @@ -1,5 +1,6 @@ var flapsPos = nil; var elapsedtime = nil; +var LBS2KGS = 0.4535924; var slatLockFlash = props.globals.initNode("/instrumentation/du/slat-lock-flash", 0, "BOOL"); var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); @@ -7,6 +8,8 @@ var du3_test = props.globals.initNode("/instrumentation/du/du3-test", 0, "BOOL") var du3_test_time = props.globals.initNode("/instrumentation/du/du3-test-time", 0.0, "DOUBLE"); var du3_test_amount = props.globals.initNode("/instrumentation/du/du3-test-amount", 0.0, "DOUBLE"); var du3_offtime = props.globals.initNode("/instrumentation/du/du3-off-time", 0.0, "DOUBLE"); +var du3_lgt = props.globals.getNode("/controls/lighting/DU/du3"); +var eng_option = props.globals.getNode("/options/eng", 1); var ECAM_line1c = props.globals.getNode("/ECAM/msg/linec1", 1); var ECAM_line2c = props.globals.getNode("/ECAM/msg/linec2", 1); @@ -65,41 +68,10 @@ var canvas_upperECAM = { canvas.parsesvg(obj.test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg", {"font-mapper": obj.font_mapper} ); foreach(var key; obj.getKeysTest()) { obj[key] = obj.test.getElementById(key); - - var clip_el = obj.test.getElementById(key ~ "_clip"); - if (clip_el != nil) { - clip_el.setVisible(0); - var tran_rect = clip_el.getTransformedBounds(); - - var clip_rect = sprintf("rect(%d,%d, %d,%d)", - tran_rect[1], - tran_rect[2], - tran_rect[3], - tran_rect[0]); - obj[key].set("clip", clip_rect); - obj[key].set("clip-frame", canvas.Element.PARENT); - } }; obj.units = acconfig_weight_kgs.getValue(); - obj.power = [ - props.UpdateManager.FromHashList(["AcEssBus", "DisplayBrightness"], nil, func(val) { - if (val.DisplayBrightness > 0.01 and val.AcEssBus >= 110) { - if (du3_test_time.getValue() + du3_test_amount.getValue() >= pts.Sim.Time.elapsedSec.getValue()) { - obj.group.setVisible(0); - obj.test.setVisible(1); - } else { - obj.group.setVisible(1); - obj.test.setVisible(0); - } - } else { - obj.group.setVisible(0); - obj.test.setVisible(0); - } - }), - ]; - obj.update_items = [ props.UpdateManager.FromHashValue("acconfigUnits", 1, func(val) { if (val) { @@ -444,9 +416,7 @@ var canvas_upperECAM = { }, 0, 0); }, update: func(notification) { - foreach (var powerItem; me.power) { - powerItem.update(notification); - } + me.updatePower(); if (me.test.getVisible() == 1) { me.updateTest(); @@ -723,7 +693,21 @@ var canvas_upperECAM = { } } else { du3_test.setValue(0); - du3_offtime.setValue(elapsedtime); + du3_offtime.setValue(pts.Sim.Time.elapsedSec.getValue()); + } + }, + updatePower: func() { + if (du3_lgt.getValue() > 0.01 and systems.ELEC.Bus.acEss.getValue() >= 110) { + if (du3_test_time.getValue() + du3_test_amount.getValue() >= pts.Sim.Time.elapsedSec.getValue()) { + me.group.setVisible(0); + me.test.setVisible(1); + } else { + me.group.setVisible(1); + me.test.setVisible(0); + } + } else { + me.group.setVisible(0); + me.test.setVisible(0); } }, }; @@ -756,8 +740,6 @@ emesary.GlobalTransmitter.Register(A320EWD); input = { fuelTotalLbs: "/consumables/fuel/total-fuel-lbs", - AcEssBus: "/systems/electrical/bus/ac-ess", - DisplayBrightness: "/controls/lighting/DU/du3", acconfigUnits: "/systems/acconfig/options/weight-kgs", # N1 parameters @@ -830,16 +812,11 @@ foreach (var name; keys(input)) { emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Upper ECAM", name, input[name])); } - var showUpperECAM = func { var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); dlg.setCanvas(A320EWD.MainScreen.canvas); } -setlistener("/sim/signals/fdm-initialized", func() { - execLoop(); -}, 0, 0); - setlistener("/systems/electrical/bus/ac-ess", func() { A320EWD.MainScreen.powerTransient(); }, 0, 0); diff --git a/Nasal/emesary/exec.nas b/Nasal/emesary/exec.nas index 26cde2fb..885e2447 100644 --- a/Nasal/emesary/exec.nas +++ b/Nasal/emesary/exec.nas @@ -64,4 +64,8 @@ elapsed_seconds : "/sim/time/elapsed-sec", foreach (var name; keys(input)) { emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("EXEC", name, input[name])); } -emesary.GlobalTransmitter.OverrunDetection(9); \ No newline at end of file +emesary.GlobalTransmitter.OverrunDetection(9); + +setlistener("/sim/signals/fdm-initialized", func() { + execLoop(); +}, 0, 0); From 299ca83498b0d0cb39623cf6f50899d7984e6d92 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 28 Oct 2020 18:31:31 +0000 Subject: [PATCH 12/33] Make slat alpha lock more efficient - don't use properties; use variables and props.UpdateManager --- .../Instruments/Upper-ECAM/Upper-ECAM.new.nas | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas index 127a9998..d69f251c 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas @@ -1,7 +1,8 @@ var flapsPos = nil; var elapsedtime = nil; var LBS2KGS = 0.4535924; -var slatLockFlash = props.globals.initNode("/instrumentation/du/slat-lock-flash", 0, "BOOL"); +var slatLockGoing = 0; +var slatLockFlash = 0; var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); var du3_test = props.globals.initNode("/instrumentation/du/du3-test", 0, "BOOL"); @@ -173,6 +174,18 @@ var canvas_upperECAM = { obj["FlxLimTemp"].hide(); } }), + props.UpdateManager.FromHashValue("slatLocked", nil, func(val) { + if (val) { + if (slatLockGoing == 0) { + slatLockGoing = 1; + slatLockTimer.start(); + } + } else { + slatLockTimer.stop(); + slatLockGoing = 0; + slatLockFlash = 0; + } + }), ]; obj.update_items_fadec_powered_n1 = [ @@ -459,21 +472,9 @@ var canvas_upperECAM = { me.updateFF2(); } - if (pts.Fdm.JSBsim.Fcs.slatLocked.getValue()) { - if (slatLockGoing == 0) { - slatLockGoing = 1; - } - if (slatLockGoing == 1) { - slatLockTimer.start(); - if (slatLockFlash.getValue()) { - me["SlatAlphaLock"].show(); - } else { - me["SlatAlphaLock"].hide(); - } - } + if (slatLockFlash) { + me["SlatAlphaLock"].show(); } else { - slatLockTimer.stop(); - slatLockGoing = 0; me["SlatAlphaLock"].hide(); } @@ -741,6 +742,7 @@ emesary.GlobalTransmitter.Register(A320EWD); input = { fuelTotalLbs: "/consumables/fuel/total-fuel-lbs", acconfigUnits: "/systems/acconfig/options/weight-kgs", + slatLocked: "/fdm/jsbsim/fcs/slat-locked", # N1 parameters N1_1: "/ECAM/Upper/N1[0]", @@ -821,11 +823,10 @@ setlistener("/systems/electrical/bus/ac-ess", func() { A320EWD.MainScreen.powerTransient(); }, 0, 0); -var slatLockGoing = 0; var slatLockTimer = maketimer(0.50, func { - if (!slatLockFlash.getBoolValue()) { - slatLockFlash.setBoolValue(1); + if (!slatLockFlash) { + slatLockFlash = 1; } else { - slatLockFlash.setBoolValue(0); + slatLockFlash = 0; } }); \ No newline at end of file From 31849ad075b477c730d8124f98321d4741e2a33b Mon Sep 17 00:00:00 2001 From: fly Date: Thu, 29 Oct 2020 06:48:04 +1100 Subject: [PATCH 13/33] Added minimum rwy length Signed-off-by: fly --- A320-main.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/A320-main.xml b/A320-main.xml index 7a7818cb..20dc0816 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -5,7 +5,7 @@ - + 0 @@ -560,6 +560,11 @@ 2019.2.0 + + + 3000 + + From 68eb32ea278714d0766209d94472d3c4a0fecf1f Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 28 Oct 2020 22:54:56 +0000 Subject: [PATCH 14/33] Bugfix a couple of runtime errors --- A320-main.xml | 1 + Models/Instruments/IESI/IESI.nas | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index 454963f5..de235a07 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -1488,6 +1488,7 @@ + 0 14.7 14.7 diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index d5d8bcde..47563c50 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -30,6 +30,8 @@ var altimeter_mode = props.globals.getNode("/instrumentation/altimeter[0]/std", var qnh_hpa = props.globals.getNode("/instrumentation/altimeter/setting-hpa", 1); var qnh_inhg = props.globals.getNode("/instrumentation/altimeter/setting-inhg", 1); +var _showIESI = 0; +var _fast = 0; var _IESITime = 0; var canvas_IESI_base = { @@ -68,8 +70,8 @@ var canvas_IESI_base = { me.AI_horizon_trans = me["AI_horizon"].createTransform(); me.AI_horizon_rot = me["AI_horizon"].createTransform(); - me._showIESI = 0; - me._fast = 0; + _showIESI = 0; + _fast = 0; _IESITime = 0.0; me.page = canvas_group; @@ -86,22 +88,22 @@ var canvas_IESI_base = { # todo 20W power consumption if (iesi_reset.getValue() == 1) { if (iesi_init.getBoolValue() and _IESITime + 90 >= et.getValue()) { - me._fast = 1; + _fast = 1; } else { - me._fast = 0; + _fast = 0; } iesi_init.setBoolValue(0); } if (systems.ELEC.Bus.dcEss.getValue() >= 25 or (systems.ELEC.Bus.dcHot1.getValue() >= 25 and airspeed.getValue() >= 50 and cur_time >= 5)) { - me._showIESI = 1; + _showIESI = 1; IESI.update(); if (aconfig.getValue() != 1 and iesi_init.getValue() != 1) { iesi_init.setBoolValue(1); - if (me._fast) { + if (_fast) { _IESITime = cur_time - 80; - me._fast = 0; + _fast = 0; } else { _IESITime = cur_time; } @@ -110,11 +112,11 @@ var canvas_IESI_base = { _IESITime = cur_time - 87; } } else { - me._showIESI = 0; + _showIESI = 0; iesi_init.setBoolValue(0); } - if (me._showIESI and iesi_brt.getValue() > 0.01) { + if (_showIESI and iesi_brt.getValue() > 0.01) { IESI.page.show(); } else { IESI.page.hide(); From aaafb2d1b1497ac55eff5e15f7150625069a5dff Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 29 Oct 2020 00:50:20 +0000 Subject: [PATCH 15/33] WIP IAE --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 284 +----------- .../Instruments/Upper-ECAM/Upper-ECAM.new.nas | 426 ++++++++++++++---- 2 files changed, 342 insertions(+), 368 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index d7d28b46..db2dd039 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -7,14 +7,7 @@ var canvas_upperECAM_iae_eis2 = { m.updateFlx(); return m; }, - getKeys: func() { - return ["EPR1-needle","EPR1-thr","EPR1-ylim","EPR1","EPR1-decpnt","EPR1-decimal","EPR1-box","EPR1-scale","EPR1-scaletick","EPR1-scalenum","EPR1-XX","EPR1-XX2","EGT1-needle","EGT1","EGT1-scale","EGT1-box","EGT1-scale2","EGT1-scaletick","EGT1-XX", - "N11-needle","N11-thr","N11-ylim","N11","N11-decpnt","N11-decimal","N11-scale","N11-scale2","N11-scaletick","N11-scalenum","N11-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","EPR2-needle","EPR2-thr","EPR2-ylim","EPR2","EPR2-decpnt", - "EPR2-decimal","EPR2-box","EPR2-scale","EPR2-scaletick","EPR2-scalenum","EPR2-XX","EPR2-XX2","EGT2-needle","EGT2","EGT2-scale","EGT2-scale2","EGT2-box","EGT2-scaletick","EGT2-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal", - "N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","EPRLim-mode","EPRLim","EPRLim-decpnt","EPRLim-decimal","EPRLim-XX","EPRLim-XX2","REV1","REV1-box", - "REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8", "ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", - "FFlow1-weight-unit", "FFlow2-weight-unit", "FOB-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; - }, + update: func(notification) { N1_1_cur = N1_1.getValue(); N1_2_cur = N1_2.getValue(); @@ -48,281 +41,6 @@ var canvas_upperECAM_iae_eis2 = { obj["EPR2-thr"].setRotation((EPR_thr_2_act + 90) * D2R); obj["EPR2-ylim"].setRotation((EPR_lim_cur + 90) * D2R); - if (fadec.FADEC.Eng1.epr == 1) { - obj["EPR1-scale"].setColor(0.8078,0.8039,0.8078); - obj["EPR1"].show(); - obj["EPR1-decpnt"].show(); - obj["EPR1-decimal"].show(); - obj["EPR1-needle"].show(); - obj["EPR1-ylim"].show(); - obj["EPR1-scaletick"].show(); - obj["EPR1-scalenum"].show(); - obj["EPR1-box"].show(); - obj["EPR1-XX"].hide(); - obj["EPR1-XX2"].hide(); - } else { - obj["EPR1-scale"].setColor(0.7333,0.3803,0); - obj["EPR1"].hide(); - obj["EPR1-decpnt"].hide(); - obj["EPR1-decimal"].hide(); - obj["EPR1-needle"].hide(); - obj["EPR1-ylim"].hide(); - obj["EPR1-scaletick"].hide(); - obj["EPR1-scalenum"].hide(); - obj["EPR1-box"].hide(); - obj["EPR1-XX"].show(); - obj["EPR1-XX2"].show(); - } - - if (rev_1_act < 0.01 and fadec.FADEC.Eng1.epr == 1) { - obj["EPR1-thr"].show(); - } else { - obj["EPR1-thr"].hide(); - } - - if (fadec.FADEC.Eng2.epr == 1) { - obj["EPR2-scale"].setColor(0.8078,0.8039,0.8078); - obj["EPR2"].show(); - obj["EPR2-decpnt"].show(); - obj["EPR2-decimal"].show(); - obj["EPR2-needle"].show(); - obj["EPR2-ylim"].show(); - obj["EPR2-scaletick"].show(); - obj["EPR2-scalenum"].show(); - obj["EPR2-box"].show(); - obj["EPR2-XX"].hide(); - obj["EPR2-XX2"].hide(); - } else { - obj["EPR2-scale"].setColor(0.7333,0.3803,0); - obj["EPR2"].hide(); - obj["EPR2-decpnt"].hide(); - obj["EPR2-decimal"].hide(); - obj["EPR2-needle"].hide(); - obj["EPR2-ylim"].hide(); - obj["EPR2-scaletick"].hide(); - obj["EPR2-scalenum"].hide(); - obj["EPR2-box"].hide(); - obj["EPR2-XX"].show(); - obj["EPR2-XX2"].show(); - } - - if (rev_2_act < 0.01 and fadec.FADEC.Eng2.epr == 1) { - obj["EPR2-thr"].show(); - } else { - obj["EPR2-thr"].hide(); - } - - # EGT - obj["EGT1"].setText(sprintf("%s", math.round(pts.Engines.Engine.egtActual[0].getValue()))); - obj["EGT2"].setText(sprintf("%s", math.round(pts.Engines.Engine.egtActual[1].getValue()))); - - obj["EGT1-needle"].setRotation((EGT_1_cur + 90) * D2R); - obj["EGT2-needle"].setRotation((EGT_2_cur + 90) * D2R); - - if (fadec.FADEC.Eng1.egt == 1) { - obj["EGT1-scale"].setColor(0.8078,0.8039,0.8078); - obj["EGT1-scale2"].setColor(1,0,0); - obj["EGT1"].show(); - obj["EGT1-needle"].show(); - obj["EGT1-scaletick"].show(); - obj["EGT1-box"].show(); - obj["EGT1-XX"].hide(); - } else { - obj["EGT1-scale"].setColor(0.7333,0.3803,0); - obj["EGT1-scale2"].setColor(0.7333,0.3803,0); - obj["EGT1"].hide(); - obj["EGT1-needle"].hide(); - obj["EGT1-scaletick"].hide(); - obj["EGT1-box"].hide(); - obj["EGT1-XX"].show(); - } - - if (fadec.FADEC.Eng2.egt == 1) { - obj["EGT2-scale"].setColor(0.8078,0.8039,0.8078); - obj["EGT2-scale2"].setColor(1,0,0); - obj["EGT2"].show(); - obj["EGT2-needle"].show(); - obj["EGT2-scaletick"].show(); - obj["EGT2-box"].show(); - obj["EGT2-XX"].hide(); - } else { - obj["EGT2-scale"].setColor(0.7333,0.3803,0); - obj["EGT2-scale2"].setColor(0.7333,0.3803,0); - obj["EGT2"].hide(); - obj["EGT2-needle"].hide(); - obj["EGT2-scaletick"].hide(); - obj["EGT2-box"].hide(); - obj["EGT2-XX"].show(); - } - - # N1 - obj["N11"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n1Actual[0].getValue() + 0.05))); - obj["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n1Actual[0].getValue() + 0.05, 1)))); - - obj["N12"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n1Actual[1].getValue() + 0.05))); - obj["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n1Actual[1].getValue() + 0.05, 1)))); - - obj["N11-needle"].setRotation((N1_1_cur + 90) * D2R); - obj["N11-thr"].setRotation((N1_thr_1.getValue() + 90) * D2R); - obj["N11-ylim"].setRotation((N1_lim_cur + 90) * D2R); - - obj["N12-needle"].setRotation((N1_2_cur + 90) * D2R); - obj["N12-thr"].setRotation((N1_thr_2.getValue() + 90) * D2R); - obj["N12-ylim"].setRotation((N1_lim_cur + 90) * D2R); - - if (fadec.FADEC.Eng1.n1 == 1) { - obj["N11-scale"].setColor(0.8078,0.8039,0.8078); - obj["N11-scale2"].setColor(1,0,0); - obj["N11"].show(); - obj["N11-decimal"].show(); - obj["N11-decpnt"].show(); - obj["N11-needle"].show(); - obj["N11-scaletick"].show(); - obj["N11-scalenum"].show(); - obj["N11-XX"].hide(); - } else { - obj["N11-scale"].setColor(0.7333,0.3803,0); - obj["N11-scale2"].setColor(0.7333,0.3803,0); - obj["N11"].hide(); - obj["N11-decimal"].hide(); - obj["N11-decpnt"].hide(); - obj["N11-needle"].hide(); - obj["N11-scaletick"].hide(); - obj["N11-scalenum"].hide(); - obj["N11-XX"].show(); - } - - if (fadec.FADEC.Eng2.n1 == 1) { - obj["N12-scale"].setColor(0.8078,0.8039,0.8078); - obj["N12-scale2"].setColor(1,0,0); - obj["N12"].show(); - obj["N12-decimal"].show(); - obj["N12-decpnt"].show(); - obj["N12-needle"].show(); - obj["N12-scaletick"].show(); - obj["N12-scalenum"].show(); - obj["N12-XX"].hide(); - } else { - obj["N12-scale"].setColor(0.7333,0.3803,0); - obj["N12-scale2"].setColor(0.7333,0.3803,0); - obj["N12"].hide(); - obj["N12-decimal"].hide(); - obj["N12-decpnt"].hide(); - obj["N12-needle"].hide(); - obj["N12-scaletick"].hide(); - obj["N12-scalenum"].hide(); - obj["N12-XX"].show(); - } - - if (fadec.FADEC.Eng1.n1 == 1 and fadec.Fadec.n1Mode[0].getValue()) { - obj["N11-thr"].show(); - obj["N11-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet - } else { - obj["N11-thr"].hide(); - obj["N11-ylim"].hide(); - } - - if (fadec.FADEC.Eng2.n1 == 1 and fadec.Fadec.n1Mode[1].getValue()) { - obj["N12-thr"].show(); - obj["N12-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet - } else { - obj["N12-thr"].hide(); - obj["N12-ylim"].hide(); - } - - # N2 - obj["N21"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n2Actual[0].getValue() + 0.05))); - obj["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n2Actual[0].getValue() + 0.05, 1)))); - obj["N22"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n2Actual[1].getValue() + 0.05))); - obj["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n2Actual[1].getValue() + 0.05, 1)))); - - if (fadec.FADEC.Eng1.n2 == 1) { - obj["N21"].show(); - obj["N21-decimal"].show(); - obj["N21-decpnt"].show(); - obj["N21-XX"].hide(); - } else { - obj["N21"].hide(); - obj["N21-decimal"].hide(); - obj["N21-decpnt"].hide(); - obj["N21-XX"].show(); - } - - if (fadec.FADEC.Eng2.n2 == 1) { - obj["N22"].show(); - obj["N22-decimal"].show(); - obj["N22-decpnt"].show(); - obj["N22-XX"].hide(); - } else { - obj["N22"].hide(); - obj["N22-decimal"].hide(); - obj["N22-decpnt"].hide(); - obj["N22-XX"].show(); - } - - # FF - fuel1 = pts.Engines.Engine.fuelFlow[0].getValue(); - fuel2 = pts.Engines.Engine.fuelFlow[1].getValue(); - if (acconfig_weight_kgs.getValue()) { - obj["FF1"].setText(sprintf("%s", math.round(fuel1 * LBS2KGS, 10))); - obj["FF2"].setText(sprintf("%s", math.round(fuel2 * LBS2KGS, 10))); - obj["FFlow1-weight-unit"].setText("KG/H"); - obj["FFlow2-weight-unit"].setText("KG/H"); - } else { - obj["FF1"].setText(sprintf("%s", math.round(fuel1, 10))); - obj["FF2"].setText(sprintf("%s", math.round(fuel2, 10))); - obj["FFlow1-weight-unit"].setText("LBS/H"); - obj["FFlow2-weight-unit"].setText("LBS/H"); - } - - if (fadec.FADEC.Eng1.ff == 1) { - obj["FF1"].show(); - obj["FF1-XX"].hide(); - } else { - obj["FF1"].hide(); - obj["FF1-XX"].show(); - } - - if (fadec.FADEC.Eng2.ff == 1) { - obj["FF2"].show(); - obj["FF2-XX"].hide(); - } else { - obj["FF2"].hide(); - obj["FF2-XX"].show(); - } - - # EPR Limit - thrLimit = thr_limit.getValue(); - eprLimit = epr_limit.getValue(); - - obj["EPRLim-mode"].setText(sprintf("%s", thrLimit)); - obj["EPRLim"].setText(sprintf("%1.0f", math.floor(eprLimit))); - obj["EPRLim-decimal"].setText(sprintf("%03d", (eprLimit - int(eprLimit)) * 1000)); - - fadecPower1 = fadecpower_1.getValue(); - fadecPower2 = fadecpower_2.getValue(); - fadecPowerStart = fadecpowerup.getValue(); - - if (fadecPower1 or fadecPower2 or fadecPowerStart) { - obj["EPRLim-mode"].show(); - obj["EPRLim-XX"].hide(); - obj["EPRLim-XX2"].hide(); - } else { - obj["EPRLim-mode"].hide(); - obj["EPRLim-XX"].show(); - obj["EPRLim-XX2"].show(); - } - - if ((fadecPower1 or fadecPower2 or fadecPowerStart) and thrLimit != "MREV") { - obj["EPRLim"].show(); - obj["EPRLim-decpnt"].show(); - obj["EPRLim-decimal"].show(); - } else { - obj["EPRLim"].hide(); - obj["EPRLim-decpnt"].hide(); - obj["EPRLim-decimal"].hide(); - } - me.updateBase(notification); }, }; diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas index d69f251c..7bbd3a8e 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas @@ -30,7 +30,7 @@ var ECAM_line7rc = props.globals.getNode("/ECAM/rightmsg/linec7", 1); var ECAM_line8rc = props.globals.getNode("/ECAM/rightmsg/linec8", 1); var canvas_upperECAM = { - new: func(svg) { + new: func(svg, name, type) { var obj = {parents: [canvas_upperECAM] }; obj.canvas = canvas.new({ "name": "upperECAM", @@ -43,13 +43,15 @@ var canvas_upperECAM = { obj.group = obj.canvas.createGroup(); obj.test = obj.canvas.createGroup(); + obj.typeString = type; + obj.font_mapper = func(family, weight) { return "LiberationFonts/LiberationSans-Regular.ttf"; }; canvas.parsesvg(obj.group, svg, {"font-mapper": obj.font_mapper} ); - - foreach(var key; obj.getKeys()) { + obj.keysHash = (type == "IAE" ? obj.getKeysIAE() : obj.getKeysCFM()); + foreach(var key; obj.keysHash) { obj[key] = obj.group.getElementById(key); var clip_el = obj.group.getElementById(key ~ "_clip"); @@ -75,12 +77,24 @@ var canvas_upperECAM = { obj.update_items = [ props.UpdateManager.FromHashValue("acconfigUnits", 1, func(val) { - if (val) { - obj["FOB-weight-unit"].setText("KG"); - obj["FFlow-weight-unit"].setText("KG/H"); + if (obj.typeString == "IAE") { + if (val) { + obj["FOB-weight-unit"].setText("KG"); + obj["FFlow1-weight-unit"].setText("KG/H"); + obj["FFlow2-weight-unit"].setText("KG/H"); + } else { + obj["FOB-weight-unit"].setText("LBS"); + obj["FFlow1-weight-unit"].setText("LBS/H"); + obj["FFlow2-weight-unit"].setText("LBS/H"); + } } else { - obj["FOB-weight-unit"].setText("LBS"); - obj["FFlow-weight-unit"].setText("LBS/H"); + if (val) { + obj["FOB-weight-unit"].setText("KG"); + obj["FFlow-weight-unit"].setText("KG/H"); + } else { + obj["FOB-weight-unit"].setText("LBS"); + obj["FFlow-weight-unit"].setText("LBS/H"); + } } obj.units = val; }), @@ -133,47 +147,9 @@ var canvas_upperECAM = { obj["FlapDots"].hide(); } }), - props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) { - obj["N1Lim-mode"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("n1Limit", 0.01, func(val) { - obj["N1Lim"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); - }), props.UpdateManager.FromHashValue("flexTemp", 1, func(val) { obj["FlxLimTemp"].setText(sprintf("%2.0d",val)); }), - props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], nil, func(val) { - if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { - obj["N1Lim-mode"].show(); - obj["N1Lim-XX"].hide(); - obj["N1Lim-XX2"].hide(); - } else { - obj["N1Lim-mode"].hide(); - obj["N1Lim-XX"].show(); - obj["N1Lim-XX2"].show(); - } - - if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit != "MREV") { - obj["N1Lim"].show(); - obj["N1Lim-decpnt"].show(); - obj["N1Lim-decimal"].show(); - obj["N1Lim-percent"].show(); - } else { - obj["N1Lim"].hide(); - obj["N1Lim-decpnt"].hide(); - obj["N1Lim-decimal"].hide(); - obj["N1Lim-percent"].hide(); - } - - if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") { - obj["FlxLimDegreesC"].show(); - obj["FlxLimTemp"].show(); - } else { - obj["FlxLimDegreesC"].hide(); - obj["FlxLimTemp"].hide(); - } - }), props.UpdateManager.FromHashValue("slatLocked", nil, func(val) { if (val) { if (slatLockGoing == 0) { @@ -214,10 +190,18 @@ var canvas_upperECAM = { obj["N12-thr"].setRotation((val + 90) * D2R); }), props.UpdateManager.FromHashValue("reverser_1", 0.005, func(val) { - if (val < 0.01 and fadec.FADEC.Eng1.n1 == 1) { - obj["N11-thr"].show(); + if (obj.typeString == "IAE") { + if (val < 0.01 and fadec.FADEC.Eng1.epr == 1) { + obj["EPR1-thr"].show(); + } else { + obj["EPR1-thr"].hide(); + } } else { - obj["N11-thr"].hide(); + if (val < 0.01 and fadec.FADEC.Eng1.n1 == 1) { + obj["N11-thr"].show(); + } else { + obj["N11-thr"].hide(); + } } if (val >= 0.01 and fadec.FADEC.Eng1.n1 == 1) { @@ -235,10 +219,18 @@ var canvas_upperECAM = { } }), props.UpdateManager.FromHashValue("reverser_2", 0.005, func(val) { - if (val < 0.01 and fadec.FADEC.Eng2.n1 == 1) { - obj["N12-thr"].show(); + if (obj.typeString == "IAE") { + if (val < 0.01 and fadec.FADEC.Eng2.epr == 1) { + obj["EPR2-thr"].show(); + } else { + obj["EPR2-thr"].hide(); + } } else { - obj["N12-thr"].hide(); + if (val < 0.01 and fadec.FADEC.Eng2.n1 == 1) { + obj["N12-thr"].show(); + } else { + obj["N12-thr"].hide(); + } } if (val >= 0.01 and fadec.FADEC.Eng2.n1 == 1) { @@ -257,6 +249,33 @@ var canvas_upperECAM = { }), ]; + obj.update_items_fadec_powered_epr = [ + props.UpdateManager.FromHashValue("EPR_1", 0.01, func(val) { + obj["EPR1-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("EPR_2", 0.01, func(val) { + obj["EPR2-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("EPR_actual_1", 0.0001, func(val) { + obj["EPR1"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["EPR1-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("EPR_actual_2", 0.0001, func(val) { + obj["EPR1"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["EPR2-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("EPR_lim", 0.005, func(val) { + obj["EPR1-ylim"].setRotation((val + 90) * D2R); + obj["EPR2-ylim"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("EPRthr_1", 0.005, func(val) { + obj["EPR1-thr"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("EPRthr_2", 0.005, func(val) { + obj["EPR2-thr"].setRotation((val + 90) * D2R); + }), + ]; + obj.update_items_fadec_powered_n2 = [ props.UpdateManager.FromHashValue("N2_actual_1", 0.025, func(val) { obj["N21"].setText(sprintf("%s", math.floor(val + 0.05))); @@ -268,6 +287,104 @@ var canvas_upperECAM = { }), ]; + obj.update_items_cfm_only = [ + props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) { + obj["N1Lim-mode"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("n1Limit", 0.01, func(val) { + obj["N1Lim"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], nil, func(val) { + if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { + obj["N1Lim-mode"].show(); + obj["N1Lim-XX"].hide(); + obj["N1Lim-XX2"].hide(); + } else { + obj["N1Lim-mode"].hide(); + obj["N1Lim-XX"].show(); + obj["N1Lim-XX2"].show(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit != "MREV") { + obj["N1Lim"].show(); + obj["N1Lim-decpnt"].show(); + obj["N1Lim-decimal"].show(); + obj["N1Lim-percent"].show(); + } else { + obj["N1Lim"].hide(); + obj["N1Lim-decpnt"].hide(); + obj["N1Lim-decimal"].hide(); + obj["N1Lim-percent"].hide(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") { + obj["FlxLimDegreesC"].show(); + obj["FlxLimTemp"].show(); + } else { + obj["FlxLimDegreesC"].hide(); + obj["FlxLimTemp"].hide(); + } + }), + ]; + + obj.update_items_iae_only = [ + props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) { + obj["EPRLim-mode"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("eprLimit", 0.01, func(val) { + obj["EPRLim"].setText(sprintf("%1.0f", math.floor(val))); + obj["EPRLim-decimal"].setText(sprintf("%03d", (val - int(val)) * 1000)); + }), + props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], nil, func(val) { + if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { + obj["EPRLim-mode"].show(); + obj["EPRLim-XX"].hide(); + obj["EPRLim-XX2"].hide(); + } else { + obj["EPRLim-mode"].hide(); + obj["EPRLim-XX"].show(); + obj["EPRLim-XX2"].show(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit != "MREV") { + obj["EPRLim"].show(); + obj["EPRLim-decpnt"].show(); + obj["EPRLim-decimal"].show(); + } else { + obj["EPRLim"].hide(); + obj["EPRLim-decpnt"].hide(); + obj["EPRLim-decimal"].hide(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") { + obj["FlxLimDegreesC"].show(); + obj["FlxLimTemp"].show(); + } else { + obj["FlxLimDegreesC"].hide(); + obj["FlxLimTemp"].hide(); + } + }), + props.UpdateManager.FromHashValue("N1_mode_1", nil, func(val) { + if (fadec.FADEC.Eng1.n1 == 1 and val) { + obj["N11-thr"].show(); + obj["N11-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet + } else { + obj["N11-thr"].hide(); + obj["N11-ylim"].hide(); + } + }), + props.UpdateManager.FromHashValue("N1_mode_2", nil, func(val) { + if (fadec.FADEC.Eng2.n1 == 1 and val) { + obj["N12-thr"].show(); + obj["N12-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet + } else { + obj["N12-thr"].hide(); + obj["N12-ylim"].hide(); + } + }), + ]; + obj.update_items_fadec_powered_egt = [ props.UpdateManager.FromHashValue("egt_1", 0.5, func(val) { obj["EGT1"].setText(sprintf("%s", math.round(val))); @@ -392,17 +509,26 @@ var canvas_upperECAM = { obj._cachedN1 = [nil, nil]; obj._cachedN2 = [nil, nil]; obj._cachedEGT = [nil, nil]; + obj._cachedEPR = [nil, nil]; obj._cachedFF = [nil, nil]; return obj; }, - getKeys: func() { + getKeysCFM: func() { return ["N11-needle","N11-thr","N11-ylim","N11","N11-decpnt","N11-decimal","N11-box","N11-scale","N11-scale2","N11-scaletick","N11-scalenum","N11-XX","N11-XX2","N11-XX-box","EGT1-needle","EGT1","EGT1-scale","EGT1-box","EGT1-scale2","EGT1-scaletick", "EGT1-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal","N12-box","N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N12-XX2","N12-XX-box","EGT2-needle","EGT2", "EGT2-scale","EGT2-box","EGT2-scale2","EGT2-scaletick","EGT2-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","N1Lim-mode","N1Lim","N1Lim-decpnt","N1Lim-decimal","N1Lim-percent","N1Lim-XX","N1Lim-XX2","REV1", "REV1-box","REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8","ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; }, + getKeysIAE: func() { + return ["EPR1-needle","EPR1-thr","EPR1-ylim","EPR1","EPR1-decpnt","EPR1-decimal","EPR1-box","EPR1-scale","EPR1-scaletick","EPR1-scalenum","EPR1-XX","EPR1-XX2","EGT1-needle","EGT1","EGT1-scale","EGT1-box","EGT1-scale2","EGT1-scaletick","EGT1-XX", + "N11-needle","N11-thr","N11-ylim","N11","N11-decpnt","N11-decimal","N11-scale","N11-scale2","N11-scaletick","N11-scalenum","N11-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","EPR2-needle","EPR2-thr","EPR2-ylim","EPR2","EPR2-decpnt", + "EPR2-decimal","EPR2-box","EPR2-scale","EPR2-scaletick","EPR2-scalenum","EPR2-XX","EPR2-XX2","EGT2-needle","EGT2","EGT2-scale","EGT2-scale2","EGT2-box","EGT2-scaletick","EGT2-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal", + "N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","EPRLim-mode","EPRLim","EPRLim-decpnt","EPRLim-decimal","EPRLim-XX","EPRLim-XX2","REV1","REV1-box", + "REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8", "ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", + "FFlow1-weight-unit", "FFlow2-weight-unit", "FOB-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; + }, getKeysTest: func() { return ["Test_white","Test_text"]; }, @@ -428,7 +554,7 @@ var canvas_upperECAM = { me[key].setColor(me.getColorString(node.getValue())); }, 0, 0); }, - update: func(notification) { + updateCommon: func(notification) { me.updatePower(); if (me.test.getVisible() == 1) { @@ -472,12 +598,6 @@ var canvas_upperECAM = { me.updateFF2(); } - if (slatLockFlash) { - me["SlatAlphaLock"].show(); - } else { - me["SlatAlphaLock"].hide(); - } - if (fadec.FADEC.Eng1.n1 or fadec.FADEC.Eng2.n1) { foreach(var update_item; me.update_items_fadec_powered_n1) { @@ -506,11 +626,51 @@ var canvas_upperECAM = { } } + if (slatLockFlash) { + me["SlatAlphaLock"].show(); + } else { + me["SlatAlphaLock"].hide(); + } + foreach (var update_item; me.ecam_update) { update_item.update(notification); } }, + updateCFM: func(notification) { + me.updateCommon(notification); + if (me.group.getVisible() == 0) { + return; + } + + foreach (var update_item; me.update_items_cfm_only) { + update_item.update(notification); + } + }, + updateIAE: func(notification) { + me.updateCommon(notification); + if (me.group.getVisible() == 0) { + return; + } + + foreach (var update_item; me.update_items_iae_only) { + update_item.update(notification); + } + + if (fadec.FADEC.Eng1.epr != me._cachedEPR[0]) { + me.updateEPR1(); + } + if (fadec.FADEC.Eng2.epr != me._cachedEPR[1]) { + me.updateEPR2(); + } + + if (fadec.FADEC.Eng1.epr or fadec.FADEC.Eng2.epr) { + foreach(var update_item; me.update_items_fadec_powered_epr) + { + update_item.update(notification); + } + } + }, updateN11: func() { me._cachedN1[0] = fadec.FADEC.Eng1.n1; @@ -521,13 +681,16 @@ var canvas_upperECAM = { me["N11-decimal"].show(); me["N11-decpnt"].show(); me["N11-needle"].show(); - me["N11-ylim"].show(); me["N11-scaletick"].show(); me["N11-scalenum"].show(); - me["N11-box"].show(); me["N11-XX"].hide(); - me["N11-XX2"].hide(); - me["N11-XX-box"].hide(); + + if (me.typeString == "CFM") { + me["N11-ylim"].show(); + me["N11-box"].show(); + me["N11-XX2"].hide(); + me["N11-XX-box"].hide(); + } } else { me["N11-scale"].setColor(0.7333,0.3803,0); me["N11-scale2"].setColor(0.7333,0.3803,0); @@ -535,13 +698,16 @@ var canvas_upperECAM = { me["N11-decimal"].hide(); me["N11-decpnt"].hide(); me["N11-needle"].hide(); - me["N11-ylim"].hide(); me["N11-scaletick"].hide(); me["N11-scalenum"].hide(); - me["N11-box"].hide(); me["N11-XX"].show(); - me["N11-XX2"].show(); - me["N11-XX-box"].show(); + + if (me.typeString == "CFM") { + me["N11-ylim"].hide(); + me["N11-box"].hide(); + me["N11-XX2"].show(); + me["N11-XX-box"].show(); + } } }, updateN12: func() { @@ -553,13 +719,16 @@ var canvas_upperECAM = { me["N12-decimal"].show(); me["N12-decpnt"].show(); me["N12-needle"].show(); - me["N12-ylim"].show(); me["N12-scaletick"].show(); me["N12-scalenum"].show(); - me["N12-box"].show(); me["N12-XX"].hide(); - me["N12-XX2"].hide(); - me["N12-XX-box"].hide(); + + if (me.typeString == "CFM") { + me["N12-ylim"].show(); + me["N12-box"].show(); + me["N12-XX2"].hide(); + me["N12-XX-box"].hide(); + } } else { me["N12-scale"].setColor(0.7333,0.3803,0); me["N12-scale2"].setColor(0.7333,0.3803,0); @@ -567,15 +736,19 @@ var canvas_upperECAM = { me["N12-decimal"].hide(); me["N12-decpnt"].hide(); me["N12-needle"].hide(); - me["N12-ylim"].hide(); me["N12-scaletick"].hide(); me["N12-scalenum"].hide(); - me["N12-box"].hide(); me["N12-XX"].show(); - me["N12-XX2"].show(); - me["N12-XX-box"].show(); + + if (me.typeString == "CFM") { + me["N12-ylim"].hide(); + me["N12-box"].hide(); + me["N12-XX2"].show(); + me["N12-XX-box"].show(); + } } }, + updateN21: func() { me._cachedN2[0] = fadec.FADEC.Eng1.n2; if (fadec.FADEC.Eng1.n2 == 1) { @@ -604,6 +777,7 @@ var canvas_upperECAM = { me["N22-XX"].show(); } }, + updateEGT1: func() { me._cachedEGT[0] = fadec.FADEC.Eng1.egt; if (fadec.FADEC.Eng1.egt == 1) { @@ -644,6 +818,63 @@ var canvas_upperECAM = { me["EGT2-XX"].show(); } }, + + updateEPR1: func() { + me._cachedEPR[0] = fadec.FADEC.Eng1.epr; + if (fadec.FADEC.Eng1.epr == 1) { + me["EPR1-scale"].setColor(0.8078,0.8039,0.8078); + me["EPR1"].show(); + me["EPR1-decpnt"].show(); + me["EPR1-decimal"].show(); + me["EPR1-needle"].show(); + me["EPR1-ylim"].show(); + me["EPR1-scaletick"].show(); + me["EPR1-scalenum"].show(); + me["EPR1-box"].show(); + me["EPR1-XX"].hide(); + me["EPR1-XX2"].hide(); + } else { + me["EPR1-scale"].setColor(0.7333,0.3803,0); + me["EPR1"].hide(); + me["EPR1-decpnt"].hide(); + me["EPR1-decimal"].hide(); + me["EPR1-needle"].hide(); + me["EPR1-ylim"].hide(); + me["EPR1-scaletick"].hide(); + me["EPR1-scalenum"].hide(); + me["EPR1-box"].hide(); + me["EPR1-XX"].show(); + me["EPR1-XX2"].show(); + } + }, + updateEPR2: func() { + me._cachedEPR[1] = fadec.FADEC.Eng2.epr; + if (fadec.FADEC.Eng2.epr == 1) { + me["EPR2-scale"].setColor(0.8078,0.8039,0.8078); + me["EPR2"].show(); + me["EPR2-decpnt"].show(); + me["EPR2-decimal"].show(); + me["EPR2-needle"].show(); + me["EPR2-ylim"].show(); + me["EPR2-scaletick"].show(); + me["EPR2-scalenum"].show(); + me["EPR2-box"].show(); + me["EPR2-XX"].hide(); + me["EPR2-XX2"].hide(); + } else { + me["EPR2-scale"].setColor(0.7333,0.3803,0); + me["EPR2"].hide(); + me["EPR2-decpnt"].hide(); + me["EPR2-decimal"].hide(); + me["EPR2-needle"].hide(); + me["EPR2-ylim"].hide(); + me["EPR2-scaletick"].hide(); + me["EPR2-scalenum"].hide(); + me["EPR2-box"].hide(); + me["EPR2-XX"].show(); + me["EPR2-XX2"].show(); + } + }, updateFF1: func() { me._cachedFF[0] = fadec.FADEC.Eng1.ff; if (fadec.FADEC.Eng1.ff == 1) { @@ -664,6 +895,7 @@ var canvas_upperECAM = { me["FF2-XX"].show(); } }, + updateTest: func() { if (du3_test_time.getValue() + 1 >= pts.Sim.Time.elapsedSec.getValue()) { me["Test_white"].show(); @@ -717,22 +949,34 @@ var UpperECAMRecipient = { new: func(_ident) { - var new_class = emesary.Recipient.new(_ident); - new_class.MainScreen = nil; - new_class.Receive = func(notification) + var EWDRecipient = emesary.Recipient.new(_ident); + EWDRecipient.MainScreen = nil; + EWDRecipient.type = eng_option.getValue() == "IAE" ? 1 : 0; + EWDRecipient.Receive = func(notification) { if (notification.NotificationType == "FrameNotification") { - if (new_class.MainScreen == nil) - new_class.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 E/WD CFM"); - #if (!math.mod(notifications.frameNotification.FrameCount,2)){ - new_class.MainScreen.update(notification); - #} + if (EWDRecipient.MainScreen == nil) { + if (EWDRecipient.type) { + EWDRecipient.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/iae-eis2.svg", "A320 E/WD IAE", "IAE"); + } else { + EWDRecipient.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 E/WD CFM", "CFM"); + } + } + + #if (!math.mod(notifications.frameNotification.FrameCount,2)){ + if (EWDRecipient.type) { + EWDRecipient.MainScreen.updateIAE(notification); + } else { + EWDRecipient.MainScreen.updateCFM(notification); + + } + #} return emesary.Transmitter.ReceiptStatus_OK; } return emesary.Transmitter.ReceiptStatus_NotProcessed; }; - return new_class; + return EWDRecipient; }, }; @@ -767,6 +1011,15 @@ input = { egt_1_needle: "/ECAM/Upper/EGT[0]", egt_2_needle: "/ECAM/Upper/EGT[1]", + # N1 parameters + EPR_1: "/ECAM/Upper/EPR[0]", + EPR_2: "/ECAM/Upper/EPR[1]", + EPR_actual_1: "/engines/engine[0]/epr-actual", + EPR_actual_2: "/engines/engine[1]/epr-actual", + EPR_lim: "/ECAM/Upper/EPRylim", + EPRthr_1: "/ECAM/Upper/EPRthr[0]", + EPRthr_2: "/ECAM/Upper/EPRthr[1]", + # fuel flow fuelflow_1: "/engines/engine[0]/fuel-flow_actual", fuelflow_2: "/engines/engine[1]/fuel-flow_actual", @@ -784,12 +1037,15 @@ input = { # fadec alphaFloor: "/systems/thrust/alpha-floor", + eprLimit: "/controls/engines/epr-limit", thrustLimit: "/controls/engines/thrust-limit", n1Limit: "/controls/engines/n1-limit", flexTemp: "/FMGC/internal/flex", fadecPower1: "/systems/fadec/powered1", fadecPower2: "/systems/fadec/powered2", fadecPowerStart: "/systems/fadec/powerup", + n1_mode_1: "/systems/fadec/n1mode1", + n1_mode_2: "/systems/fadec/n1mode2", # ecam ecamMsg1: "/ECAM/msg/line1", From ceb2abc25805c5fec333db23ca076b17a870f861 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 29 Oct 2020 01:10:35 +0000 Subject: [PATCH 16/33] IAE display finished --- Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas index 7bbd3a8e..9346b083 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas @@ -257,12 +257,12 @@ var canvas_upperECAM = { obj["EPR2-needle"].setRotation((val + 90) * D2R); }), props.UpdateManager.FromHashValue("EPR_actual_1", 0.0001, func(val) { - obj["EPR1"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["EPR1-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + obj["EPR1"].setText(sprintf("%1.0f", math.floor(val))); + obj["EPR1-decimal"].setText(sprintf("%03d", (val - int(val)) * 1000)); }), props.UpdateManager.FromHashValue("EPR_actual_2", 0.0001, func(val) { - obj["EPR1"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["EPR2-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + obj["EPR2"].setText(sprintf("%1.0f", math.floor(val))); + obj["EPR2-decimal"].setText(sprintf("%03d", (val - int(val)) * 1000)); }), props.UpdateManager.FromHashValue("EPR_lim", 0.005, func(val) { obj["EPR1-ylim"].setRotation((val + 90) * D2R); @@ -332,7 +332,7 @@ var canvas_upperECAM = { props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) { obj["EPRLim-mode"].setText(sprintf("%s", val)); }), - props.UpdateManager.FromHashValue("eprLimit", 0.01, func(val) { + props.UpdateManager.FromHashValue("eprLimit", 0.0005, func(val) { obj["EPRLim"].setText(sprintf("%1.0f", math.floor(val))); obj["EPRLim-decimal"].setText(sprintf("%03d", (val - int(val)) * 1000)); }), @@ -1044,8 +1044,8 @@ input = { fadecPower1: "/systems/fadec/powered1", fadecPower2: "/systems/fadec/powered2", fadecPowerStart: "/systems/fadec/powerup", - n1_mode_1: "/systems/fadec/n1mode1", - n1_mode_2: "/systems/fadec/n1mode2", + N1_mode_1: "/systems/fadec/n1mode1", + N1_mode_2: "/systems/fadec/n1mode2", # ecam ecamMsg1: "/ECAM/msg/line1", From 1d7ee06abb8fb8a796b3d45d47ae7cb113592371 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 29 Oct 2020 12:10:46 +0000 Subject: [PATCH 17/33] In N1 mode, hide the EPR TLA --- Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas index 9346b083..58ad8169 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas @@ -369,18 +369,22 @@ var canvas_upperECAM = { if (fadec.FADEC.Eng1.n1 == 1 and val) { obj["N11-thr"].show(); obj["N11-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet + obj["EPR1-thr"].hide(); } else { obj["N11-thr"].hide(); obj["N11-ylim"].hide(); + obj["EPR1-thr"].show(); } }), props.UpdateManager.FromHashValue("N1_mode_2", nil, func(val) { if (fadec.FADEC.Eng2.n1 == 1 and val) { obj["N12-thr"].show(); obj["N12-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet + obj["EPR2-thr"].hide(); } else { obj["N12-thr"].hide(); obj["N12-ylim"].hide(); + obj["EPR2-thr"].show(); } }), ]; From ef3bc019ae1eb71999e1d9957cd881f1c63eafa5 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 30 Oct 2020 21:14:14 +0000 Subject: [PATCH 18/33] Improve FADEC power on the E/WD display, so that you don't get out of sync; also make sure that the TLA indicator disappears when it should --- A320-main.xml | 3 +- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 1132 ++++++++++++++++- .../Instruments/Upper-ECAM/Upper-ECAM.new.nas | 1092 ---------------- Nasal/Systems/FADEC/fadec-cfm.nas | 16 +- Nasal/Systems/FADEC/fadec-iae.nas | 28 +- 5 files changed, 1117 insertions(+), 1154 deletions(-) delete mode 100644 Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas diff --git a/A320-main.xml b/A320-main.xml index 3baa083b..05eec927 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -4486,8 +4486,7 @@ Aircraft/A320-family/Nasal/emesary/exec.nas - - Aircraft/A320-family/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas + Aircraft/A320-family/Models/Instruments/Upper-ECAM/Upper-ECAM.nas Aircraft/A320-family/Models/Instruments/Lower-ECAM/Lower-ECAM.nas diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index db2dd039..d5a005c5 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -1,46 +1,1102 @@ +var flapsPos = nil; +var elapsedtime = nil; +var LBS2KGS = 0.4535924; +var slatLockGoing = 0; +var slatLockFlash = 0; +var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); +var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); +var du3_test = props.globals.initNode("/instrumentation/du/du3-test", 0, "BOOL"); +var du3_test_time = props.globals.initNode("/instrumentation/du/du3-test-time", 0.0, "DOUBLE"); +var du3_test_amount = props.globals.initNode("/instrumentation/du/du3-test-amount", 0.0, "DOUBLE"); +var du3_offtime = props.globals.initNode("/instrumentation/du/du3-off-time", 0.0, "DOUBLE"); +var du3_lgt = props.globals.getNode("/controls/lighting/DU/du3"); +var eng_option = props.globals.getNode("/options/eng", 1); -var canvas_upperECAM_iae_eis2 = { - new: func(canvas_group, file) { - var m = {parents: [canvas_upperECAM_iae_eis2, canvas_upperECAM_base]}; - m.init(canvas_group, file); - m.updateAFloor(); - m.updateFlx(); - return m; +var ECAM_line1c = props.globals.getNode("/ECAM/msg/linec1", 1); +var ECAM_line2c = props.globals.getNode("/ECAM/msg/linec2", 1); +var ECAM_line3c = props.globals.getNode("/ECAM/msg/linec3", 1); +var ECAM_line4c = props.globals.getNode("/ECAM/msg/linec4", 1); +var ECAM_line5c = props.globals.getNode("/ECAM/msg/linec5", 1); +var ECAM_line6c = props.globals.getNode("/ECAM/msg/linec6", 1); +var ECAM_line7c = props.globals.getNode("/ECAM/msg/linec7", 1); +var ECAM_line8c = props.globals.getNode("/ECAM/msg/linec8", 1); +var ECAM_line1rc = props.globals.getNode("/ECAM/rightmsg/linec1", 1); +var ECAM_line2rc = props.globals.getNode("/ECAM/rightmsg/linec2", 1); +var ECAM_line3rc = props.globals.getNode("/ECAM/rightmsg/linec3", 1); +var ECAM_line4rc = props.globals.getNode("/ECAM/rightmsg/linec4", 1); +var ECAM_line5rc = props.globals.getNode("/ECAM/rightmsg/linec5", 1); +var ECAM_line6rc = props.globals.getNode("/ECAM/rightmsg/linec6", 1); +var ECAM_line7rc = props.globals.getNode("/ECAM/rightmsg/linec7", 1); +var ECAM_line8rc = props.globals.getNode("/ECAM/rightmsg/linec8", 1); + +var canvas_upperECAM = { + new: func(svg, name, type) { + var obj = {parents: [canvas_upperECAM] }; + obj.canvas = canvas.new({ + "name": "upperECAM", + "size": [1024, 1024], + "view": [1024, 1024], + "mipmapping": 1, + }); + + obj.canvas.addPlacement({"node": "uecam.screen"}); + obj.group = obj.canvas.createGroup(); + obj.test = obj.canvas.createGroup(); + + obj.typeString = type; + + obj.font_mapper = func(family, weight) { + return "LiberationFonts/LiberationSans-Regular.ttf"; + }; + + canvas.parsesvg(obj.group, svg, {"font-mapper": obj.font_mapper} ); + obj.keysHash = (type == "IAE" ? obj.getKeysIAE() : obj.getKeysCFM()); + foreach(var key; obj.keysHash) { + obj[key] = obj.group.getElementById(key); + + var clip_el = obj.group.getElementById(key ~ "_clip"); + if (clip_el != nil) { + clip_el.setVisible(0); + var tran_rect = clip_el.getTransformedBounds(); + + var clip_rect = sprintf("rect(%d,%d, %d,%d)", + tran_rect[1], + tran_rect[2], + tran_rect[3], + tran_rect[0]); + obj[key].set("clip", clip_rect); + obj[key].set("clip-frame", canvas.Element.PARENT); + } + }; + canvas.parsesvg(obj.test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg", {"font-mapper": obj.font_mapper} ); + foreach(var key; obj.getKeysTest()) { + obj[key] = obj.test.getElementById(key); + }; + + obj.units = acconfig_weight_kgs.getValue(); + + obj.update_items = [ + props.UpdateManager.FromHashValue("acconfigUnits", 1, func(val) { + if (obj.typeString == "IAE") { + if (val) { + obj["FOB-weight-unit"].setText("KG"); + obj["FFlow1-weight-unit"].setText("KG/H"); + obj["FFlow2-weight-unit"].setText("KG/H"); + } else { + obj["FOB-weight-unit"].setText("LBS"); + obj["FFlow1-weight-unit"].setText("LBS/H"); + obj["FFlow2-weight-unit"].setText("LBS/H"); + } + } else { + if (val) { + obj["FOB-weight-unit"].setText("KG"); + obj["FFlow-weight-unit"].setText("KG/H"); + } else { + obj["FOB-weight-unit"].setText("LBS"); + obj["FFlow-weight-unit"].setText("LBS/H"); + } + } + obj.units = val; + }), + props.UpdateManager.FromHashList(["fuelTotalLbs","acconfigUnits"], 1, func(val) { + if (obj.units) + { + obj["FOB-LBS"].setText(sprintf("%s", math.round(val.fuelTotalLbs * LBS2KGS, 10))); + } else { + obj["FOB-LBS"].setText(sprintf("%s", math.round(val.fuelTotalLbs, 10))); + } + }), + props.UpdateManager.FromHashList(["flapxOffset", "flapyOffset"], 0.01, func(val) { + obj["FlapIndicator"].setTranslation(val.flapxOffset,val.flapyOffset); + }), + props.UpdateManager.FromHashList(["slatxOffset", "slatyOffset"], 0.01, func(val) { + obj["SlatIndicator"].setTranslation(val.slatxOffset,val.slatyOffset); + }), + props.UpdateManager.FromHashList(["flapxOffsetTrans", "flapyOffsetTrans"], 0.01, func(val) { + obj["FlapLine"].setTranslation(val.flapxOffsetTrans,val.flapyOffsetTrans); + }), + props.UpdateManager.FromHashList(["slatxOffsetTrans", "slatyOffsetTrans"], 0.01, func(val) { + obj["SlatLine"].setTranslation(val.slatxOffsetTrans,val.slatyOffsetTrans); + }), + props.UpdateManager.FromHashValue("alphaFloor", 1, func(val) { + if (val) { + obj["aFloor"].show(); + } else { + obj["aFloor"].hide(); + } + }), + props.UpdateManager.FromHashValue("flapsPos", 1, func(val) { + flapsPos = val; + if (flapsPos == 1) { + obj["FlapTxt"].setText("1"); + } else if (flapsPos == 2) { + obj["FlapTxt"].setText("1+F"); + } else if (flapsPos == 3) { + obj["FlapTxt"].setText("2"); + } else if (flapsPos == 4) { + obj["FlapTxt"].setText("3"); + } else if (flapsPos == 5) { + obj["FlapTxt"].setText("FULL"); + } else { + obj["FlapTxt"].setText(" "); # More efficient then hide/show + } + + if (flapsPos > 0) { + obj["FlapDots"].show(); + } else { + obj["FlapDots"].hide(); + } + }), + props.UpdateManager.FromHashValue("flexTemp", 1, func(val) { + obj["FlxLimTemp"].setText(sprintf("%2.0d",val)); + }), + props.UpdateManager.FromHashValue("slatLocked", nil, func(val) { + if (val) { + if (slatLockGoing == 0) { + slatLockGoing = 1; + slatLockTimer.start(); + } + } else { + slatLockTimer.stop(); + slatLockGoing = 0; + slatLockFlash = 0; + } + }), + ]; + + obj.update_items_fadec_powered_n1 = [ + props.UpdateManager.FromHashValue("N1_1", 0.01, func(val) { + obj["N11-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("N1_2", 0.01, func(val) { + obj["N12-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("N1_actual_1", 0.025, func(val) { + obj["N11"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("N1_actual_2", 0.025, func(val) { + obj["N12"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("N1_lim", 0.01, func(val) { + obj["N11-ylim"].setRotation((val + 90) * D2R); + obj["N12-ylim"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("N1thr_1", 0.01, func(val) { + obj["N11-thr"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("N1thr_2", 0.01, func(val) { + obj["N12-thr"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashList(["reverser_1","eng1_n1","eng1_epr","N1_mode_1"], nil, func(val) { + obj.updateFadecN1Power1(val); + }), + props.UpdateManager.FromHashList(["reverser_2","eng2_n1","eng2_epr","N1_mode_2"], nil, func(val) { + obj.updateFadecN1Power2(val); + }), + ]; + + obj.update_items_fadec_powered_epr = [ + props.UpdateManager.FromHashValue("EPR_1", 0.01, func(val) { + obj["EPR1-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("EPR_2", 0.01, func(val) { + obj["EPR2-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("EPR_actual_1", 0.0001, func(val) { + obj["EPR1"].setText(sprintf("%1.0f", math.floor(val))); + obj["EPR1-decimal"].setText(sprintf("%03d", (val - int(val)) * 1000)); + }), + props.UpdateManager.FromHashValue("EPR_actual_2", 0.0001, func(val) { + obj["EPR2"].setText(sprintf("%1.0f", math.floor(val))); + obj["EPR2-decimal"].setText(sprintf("%03d", (val - int(val)) * 1000)); + }), + props.UpdateManager.FromHashValue("EPR_lim", 0.005, func(val) { + obj["EPR1-ylim"].setRotation((val + 90) * D2R); + obj["EPR2-ylim"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("EPRthr_1", 0.005, func(val) { + obj["EPR1-thr"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("EPRthr_2", 0.005, func(val) { + obj["EPR2-thr"].setRotation((val + 90) * D2R); + }), + ]; + + obj.update_items_fadec_powered_n2 = [ + props.UpdateManager.FromHashValue("N2_actual_1", 0.025, func(val) { + obj["N21"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("N2_actual_2", 0.025, func(val) { + obj["N22"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + ]; + + obj.update_items_cfm_only = [ + props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) { + obj["N1Lim-mode"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("n1Limit", 0.01, func(val) { + obj["N1Lim"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], nil, func(val) { + if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { + obj["N1Lim-mode"].show(); + obj["N1Lim-XX"].hide(); + obj["N1Lim-XX2"].hide(); + } else { + obj["N1Lim-mode"].hide(); + obj["N1Lim-XX"].show(); + obj["N1Lim-XX2"].show(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit != "MREV") { + obj["N1Lim"].show(); + obj["N1Lim-decpnt"].show(); + obj["N1Lim-decimal"].show(); + obj["N1Lim-percent"].show(); + } else { + obj["N1Lim"].hide(); + obj["N1Lim-decpnt"].hide(); + obj["N1Lim-decimal"].hide(); + obj["N1Lim-percent"].hide(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") { + obj["FlxLimDegreesC"].show(); + obj["FlxLimTemp"].show(); + } else { + obj["FlxLimDegreesC"].hide(); + obj["FlxLimTemp"].hide(); + } + }), + ]; + + obj.update_items_iae_only = [ + props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) { + obj["EPRLim-mode"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("eprLimit", 0.0005, func(val) { + obj["EPRLim"].setText(sprintf("%1.0f", math.floor(val))); + obj["EPRLim-decimal"].setText(sprintf("%03d", (val - int(val)) * 1000)); + }), + props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], nil, func(val) { + if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { + obj["EPRLim-mode"].show(); + obj["EPRLim-XX"].hide(); + obj["EPRLim-XX2"].hide(); + } else { + obj["EPRLim-mode"].hide(); + obj["EPRLim-XX"].show(); + obj["EPRLim-XX2"].show(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit != "MREV") { + obj["EPRLim"].show(); + obj["EPRLim-decpnt"].show(); + obj["EPRLim-decimal"].show(); + } else { + obj["EPRLim"].hide(); + obj["EPRLim-decpnt"].hide(); + obj["EPRLim-decimal"].hide(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") { + obj["FlxLimDegreesC"].show(); + obj["FlxLimTemp"].show(); + } else { + obj["FlxLimDegreesC"].hide(); + obj["FlxLimTemp"].hide(); + } + }), + props.UpdateManager.FromHashValue("N1_mode_1", nil, func(val) { + if (fadec.FADEC.Eng1.n1.getValue() == 1 and val) { + obj["N11-thr"].show(); + obj["N11-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet + } else { + obj["N11-thr"].hide(); + obj["N11-ylim"].hide(); + } + }), + props.UpdateManager.FromHashValue("N1_mode_2", nil, func(val) { + if (fadec.FADEC.Eng2.n1.getValue() == 1 and val) { + obj["N12-thr"].show(); + obj["N12-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet + } else { + obj["N12-thr"].hide(); + obj["N12-ylim"].hide(); + } + }), + ]; + + obj.update_items_fadec_powered_egt = [ + props.UpdateManager.FromHashValue("egt_1", 0.5, func(val) { + obj["EGT1"].setText(sprintf("%s", math.round(val))); + }), + props.UpdateManager.FromHashValue("egt_1_needle", 0.01, func(val) { + obj["EGT1-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("egt_2", 0.5, func(val) { + obj["EGT2"].setText(sprintf("%s", math.round(val))); + }), + props.UpdateManager.FromHashValue("egt_2_needle", 0.01, func(val) { + obj["EGT2-needle"].setRotation((val + 90) * D2R); + }), + ]; + + obj.update_items_fadec_powered_ff = [ + props.UpdateManager.FromHashList(["fuelflow_1","acconfigUnits"], 1, func(val) { + if (obj.units) { + obj["FF1"].setText(sprintf("%s", math.round(val.fuelflow_1 * LBS2KGS, 10))); + } else { + obj["FF1"].setText(sprintf("%s", math.round(val.fuelflow_1, 10))); + } + }), + props.UpdateManager.FromHashList(["fuelflow_2","acconfigUnits"], 1, func(val) { + if (obj.units) { + obj["FF2"].setText(sprintf("%s", math.round(val.fuelflow_2 * LBS2KGS, 10))); + } else { + obj["FF2"].setText(sprintf("%s", math.round(val.fuelflow_2, 10))); + } + }), + ]; + + obj.ecam_update = [ + props.UpdateManager.FromHashValue("ecamMsg1", nil, func(val) { + obj["ECAML1"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg2", nil, func(val) { + obj["ECAML2"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg3", nil, func(val) { + obj["ECAML3"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg4", nil, func(val) { + obj["ECAML4"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg5", nil, func(val) { + obj["ECAML5"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg6", nil, func(val) { + obj["ECAML6"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg7", nil, func(val) { + obj["ECAML7"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg8", nil, func(val) { + obj["ECAML8"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg1R", nil, func(val) { + obj["ECAMR1"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg2R", nil, func(val) { + obj["ECAMR2"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg3R", nil, func(val) { + obj["ECAMR3"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg4R", nil, func(val) { + obj["ECAMR4"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg5R", nil, func(val) { + obj["ECAMR5"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg6R", nil, func(val) { + obj["ECAMR6"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg7R", nil, func(val) { + obj["ECAMR7"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("ecamMsg8R", nil, func(val) { + obj["ECAMR8"].setText(sprintf("%s", val)); + }), + ]; + + obj.createListenerForLine("/ECAM/msg/linec1", ECAM_line1c, "ECAML1"); + obj.createListenerForLine("/ECAM/msg/linec2", ECAM_line2c, "ECAML2"); + obj.createListenerForLine("/ECAM/msg/linec3", ECAM_line3c, "ECAML3"); + obj.createListenerForLine("/ECAM/msg/linec4", ECAM_line4c, "ECAML4"); + obj.createListenerForLine("/ECAM/msg/linec5", ECAM_line5c, "ECAML5"); + obj.createListenerForLine("/ECAM/msg/linec6", ECAM_line6c, "ECAML6"); + obj.createListenerForLine("/ECAM/msg/linec7", ECAM_line7c, "ECAML7"); + obj.createListenerForLine("/ECAM/msg/linec8", ECAM_line8c, "ECAML8"); + + obj.createListenerForLine("/ECAM/rightmsg/linec1", ECAM_line1rc, "ECAMR1"); + obj.createListenerForLine("/ECAM/rightmsg/linec2", ECAM_line2rc, "ECAMR2"); + obj.createListenerForLine("/ECAM/rightmsg/linec3", ECAM_line3rc, "ECAMR3"); + obj.createListenerForLine("/ECAM/rightmsg/linec4", ECAM_line4rc, "ECAMR4"); + obj.createListenerForLine("/ECAM/rightmsg/linec5", ECAM_line5rc, "ECAMR5"); + obj.createListenerForLine("/ECAM/rightmsg/linec6", ECAM_line6rc, "ECAMR6"); + obj.createListenerForLine("/ECAM/rightmsg/linec7", ECAM_line7rc, "ECAMR7"); + obj.createListenerForLine("/ECAM/rightmsg/linec8", ECAM_line8rc, "ECAMR8"); + + obj["ECAML1"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML2"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML3"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML4"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML5"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML6"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML7"].setFont("LiberationMonoCustom.ttf"); + obj["ECAML8"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR1"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR2"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR3"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR4"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR5"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR6"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR7"].setFont("LiberationMonoCustom.ttf"); + obj["ECAMR8"].setFont("LiberationMonoCustom.ttf"); + + obj.page = obj.group; + + # cache + obj._cachedN1 = [nil, nil]; + obj._cachedN2 = [nil, nil]; + obj._cachedEGT = [nil, nil]; + obj._cachedEPR = [nil, nil]; + obj._cachedFF = [nil, nil]; + + obj.updateFadecN1Power1({reverser_1: 0, eng1_n1: 0, eng1_epr: 0, N1_mode_1: 0}); + obj.updateFadecN1Power2({reverser_2: 0, eng2_n1: 0, eng2_epr: 0, N1_mode_2: 0}); + + return obj; + }, + getKeysCFM: func() { + return ["N11-needle","N11-thr","N11-ylim","N11","N11-decpnt","N11-decimal","N11-box","N11-scale","N11-scale2","N11-scaletick","N11-scalenum","N11-XX","N11-XX2","N11-XX-box","EGT1-needle","EGT1","EGT1-scale","EGT1-box","EGT1-scale2","EGT1-scaletick", + "EGT1-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal","N12-box","N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N12-XX2","N12-XX-box","EGT2-needle","EGT2", + "EGT2-scale","EGT2-box","EGT2-scale2","EGT2-scaletick","EGT2-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","N1Lim-mode","N1Lim","N1Lim-decpnt","N1Lim-decimal","N1Lim-percent","N1Lim-XX","N1Lim-XX2","REV1", + "REV1-box","REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8","ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", + "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; + }, + getKeysIAE: func() { + return ["EPR1-needle","EPR1-thr","EPR1-ylim","EPR1","EPR1-decpnt","EPR1-decimal","EPR1-box","EPR1-scale","EPR1-scaletick","EPR1-scalenum","EPR1-XX","EPR1-XX2","EGT1-needle","EGT1","EGT1-scale","EGT1-box","EGT1-scale2","EGT1-scaletick","EGT1-XX", + "N11-needle","N11-thr","N11-ylim","N11","N11-decpnt","N11-decimal","N11-scale","N11-scale2","N11-scaletick","N11-scalenum","N11-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","EPR2-needle","EPR2-thr","EPR2-ylim","EPR2","EPR2-decpnt", + "EPR2-decimal","EPR2-box","EPR2-scale","EPR2-scaletick","EPR2-scalenum","EPR2-XX","EPR2-XX2","EGT2-needle","EGT2","EGT2-scale","EGT2-scale2","EGT2-box","EGT2-scaletick","EGT2-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal", + "N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","EPRLim-mode","EPRLim","EPRLim-decpnt","EPRLim-decimal","EPRLim-XX","EPRLim-XX2","REV1","REV1-box", + "REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8", "ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", + "FFlow1-weight-unit", "FFlow2-weight-unit", "FOB-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; + }, + getKeysTest: func() { + return ["Test_white","Test_text"]; + }, + getColorString: func(color) { + if (color == "w") { + return [0.8078,0.8039,0.8078]; + } else if (color == "m") { + return [0.6901,0.3333,0.7450]; + } else if (color == "c") { + return [0.0901,0.6039,0.7176]; + } else if (color == "g") { + return [0.0509,0.7529,0.2941]; + } else if (color == "a") { + return [0.7333,0.3803,0]; + } else if (color == "r") { + return [1,0,0]; + } else { + return [1,1,1]; + } + }, + createListenerForLine: func(prop, node, key) { + setlistener(prop, func() { + me[key].setColor(me.getColorString(node.getValue())); + }, 0, 0); + }, + updateCommon: func(notification) { + me.updatePower(); + + if (me.test.getVisible() == 1) { + me.updateTest(); + } + + if (me.group.getVisible() == 0) { + return; + } + + foreach(var update_item; me.update_items) + { + update_item.update(notification); + } + + if (notification.eng1_n1 != me._cachedN1[0]) { + me.updateN11(notification); + } + if (notification.eng2_n1 != me._cachedN1[1]) { + me.updateN12(notification); + } + + if (fadec.FADEC.Eng1.n2 != me._cachedN2[0]) { + me.updateN21(); + } + if (fadec.FADEC.Eng2.n2 != me._cachedN2[1]) { + me.updateN22(); + } + + if (fadec.FADEC.Eng1.egt != me._cachedEGT[0]) { + me.updateEGT1(); + } + if (fadec.FADEC.Eng2.egt != me._cachedEGT[1]) { + me.updateEGT2(); + } + + if (fadec.FADEC.Eng1.ff != me._cachedFF[0]) { + me.updateFF1(); + } + if (fadec.FADEC.Eng2.ff != me._cachedFF[1]) { + me.updateFF2(); + } + + if (notification.eng1_n1 or notification.eng2_n1) { + foreach(var update_item; me.update_items_fadec_powered_n1) + { + update_item.update(notification); + } + } + + if (fadec.FADEC.Eng1.n2 or fadec.FADEC.Eng2.n2) { + foreach(var update_item; me.update_items_fadec_powered_n2) + { + update_item.update(notification); + } + } + + if (fadec.FADEC.Eng1.egt or fadec.FADEC.Eng2.egt) { + foreach(var update_item; me.update_items_fadec_powered_egt) + { + update_item.update(notification); + } + } + + if (fadec.FADEC.Eng1.ff or fadec.FADEC.Eng2.ff) { + foreach(var update_item; me.update_items_fadec_powered_ff) + { + update_item.update(notification); + } + } + + if (slatLockFlash) { + me["SlatAlphaLock"].show(); + } else { + me["SlatAlphaLock"].hide(); + } + + foreach (var update_item; me.ecam_update) + { + update_item.update(notification); + } + }, + updateCFM: func(notification) { + me.updateCommon(notification); + if (me.group.getVisible() == 0) { + return; + } + + foreach (var update_item; me.update_items_cfm_only) { + update_item.update(notification); + } + }, + updateIAE: func(notification) { + me.updateCommon(notification); + if (me.group.getVisible() == 0) { + return; + } + + foreach (var update_item; me.update_items_iae_only) { + update_item.update(notification); + } + + if (notification.eng1_epr != me._cachedEPR[0]) { + me.updateEPR1(notification); + } + if (notification.eng2_epr != me._cachedEPR[1]) { + me.updateEPR2(notification); + } + + if (notification.eng1_epr or notification.eng2_epr) { + foreach(var update_item; me.update_items_fadec_powered_epr) + { + update_item.update(notification); + } + } }, - update: func(notification) { - N1_1_cur = N1_1.getValue(); - N1_2_cur = N1_2.getValue(); - N1_1_act = pts.Engines.Engine.n1Actual[0].getValue(); - N1_2_act = pts.Engines.Engine.n1Actual[1].getValue(); - N1_lim_cur = N1_lim.getValue(); - EPR_1_cur = EPR_1.getValue(); - EPR_2_cur = EPR_2.getValue(); - EPR_1_act = pts.Engines.Engine.eprActual[0].getValue(); - EPR_2_act = pts.Engines.Engine.eprActual[1].getValue(); - EPR_lim_cur = EPR_lim.getValue(); - EPR_thr_1_act = EPR_thr_1.getValue(); - EPR_thr_2_act = EPR_thr_2.getValue(); - rev_1_act = pts.Engines.Engine.reverser[0].getValue(); - rev_2_act = pts.Engines.Engine.reverser[1].getValue(); - EGT_1_cur = EGT_1.getValue(); - EGT_2_cur = EGT_2.getValue(); - n2cur_1 = pts.Engines.Engine.n2Actual[0].getValue(); - n2cur_2 = pts.Engines.Engine.n2Actual[1].getValue(); + updateN11: func(notification) { + me._cachedN1[0] = notification.eng1_n1; + if (me._cachedN1[0] == 1) { + me["N11-scale"].setColor(0.8078,0.8039,0.8078); + me["N11-scale2"].setColor(1,0,0); + me["N11"].show(); + me["N11-decimal"].show(); + me["N11-decpnt"].show(); + me["N11-needle"].show(); + me["N11-scaletick"].show(); + me["N11-scalenum"].show(); + me["N11-XX"].hide(); + + if (me.typeString == "CFM") { + me["N11-ylim"].show(); + me["N11-box"].show(); + me["N11-XX2"].hide(); + me["N11-XX-box"].hide(); + } + } else { + me["N11-scale"].setColor(0.7333,0.3803,0); + me["N11-scale2"].setColor(0.7333,0.3803,0); + me["N11"].hide(); + me["N11-decimal"].hide(); + me["N11-decpnt"].hide(); + me["N11-needle"].hide(); + me["N11-scaletick"].hide(); + me["N11-scalenum"].hide(); + me["N11-XX"].show(); + + if (me.typeString == "CFM") { + me["N11-ylim"].hide(); + me["N11-box"].hide(); + me["N11-XX2"].show(); + me["N11-XX-box"].show(); + } + } + }, + updateN12: func(notification) { + me._cachedN1[1] = notification.eng2_n1; + if (me._cachedN1[1] == 1) { + me["N12-scale"].setColor(0.8078,0.8039,0.8078); + me["N12-scale2"].setColor(1,0,0); + me["N12"].show(); + me["N12-decimal"].show(); + me["N12-decpnt"].show(); + me["N12-needle"].show(); + me["N12-scaletick"].show(); + me["N12-scalenum"].show(); + me["N12-XX"].hide(); + + if (me.typeString == "CFM") { + me["N12-ylim"].show(); + me["N12-box"].show(); + me["N12-XX2"].hide(); + me["N12-XX-box"].hide(); + } + } else { + me["N12-scale"].setColor(0.7333,0.3803,0); + me["N12-scale2"].setColor(0.7333,0.3803,0); + me["N12"].hide(); + me["N12-decimal"].hide(); + me["N12-decpnt"].hide(); + me["N12-needle"].hide(); + me["N12-scaletick"].hide(); + me["N12-scalenum"].hide(); + me["N12-XX"].show(); + + if (me.typeString == "CFM") { + me["N12-ylim"].hide(); + me["N12-box"].hide(); + me["N12-XX2"].show(); + me["N12-XX-box"].show(); + } + } + }, + + updateN21: func() { + me._cachedN2[0] = fadec.FADEC.Eng1.n2; + if (fadec.FADEC.Eng1.n2 == 1) { + me["N21"].show(); + me["N21-decimal"].show(); + me["N21-decpnt"].show(); + me["N21-XX"].hide(); + } else { + me["N21"].hide(); + me["N21-decimal"].hide(); + me["N21-decpnt"].hide(); + me["N21-XX"].show(); + } + }, + updateN22: func() { + me._cachedN2[1] = fadec.FADEC.Eng2.n2; + if (fadec.FADEC.Eng2.n2 == 1) { + me["N22"].show(); + me["N22-decimal"].show(); + me["N22-decpnt"].show(); + me["N22-XX"].hide(); + } else { + me["N22"].hide(); + me["N22-decimal"].hide(); + me["N22-decpnt"].hide(); + me["N22-XX"].show(); + } + }, + + updateEGT1: func() { + me._cachedEGT[0] = fadec.FADEC.Eng1.egt; + if (fadec.FADEC.Eng1.egt == 1) { + me["EGT1-scale"].setColor(0.8078,0.8039,0.8078); + me["EGT1-scale2"].setColor(1,0,0); + me["EGT1"].show(); + me["EGT1-needle"].show(); + me["EGT1-scaletick"].show(); + me["EGT1-box"].show(); + me["EGT1-XX"].hide(); + } else { + me["EGT1-scale"].setColor(0.7333,0.3803,0); + me["EGT1-scale2"].setColor(0.7333,0.3803,0); + me["EGT1"].hide(); + me["EGT1-needle"].hide(); + me["EGT1-scaletick"].hide(); + me["EGT1-box"].hide(); + me["EGT1-XX"].show(); + } + }, + updateEGT2: func() { + me._cachedEGT[1] = fadec.FADEC.Eng2.egt; + if (fadec.FADEC.Eng2.egt == 1) { + me["EGT2-scale"].setColor(0.8078,0.8039,0.8078); + me["EGT2-scale2"].setColor(1,0,0); + me["EGT2"].show(); + me["EGT2-needle"].show(); + me["EGT2-scaletick"].show(); + me["EGT2-box"].show(); + me["EGT2-XX"].hide(); + } else { + me["EGT2-scale"].setColor(0.7333,0.3803,0); + me["EGT2-scale2"].setColor(0.7333,0.3803,0); + me["EGT2"].hide(); + me["EGT2-needle"].hide(); + me["EGT2-scaletick"].hide(); + me["EGT2-box"].hide(); + me["EGT2-XX"].show(); + } + }, + + updateEPR1: func(notification) { + me._cachedEPR[0] = notification.eng1_epr; + if (me._cachedEPR[0] == 1) { + me["EPR1-scale"].setColor(0.8078,0.8039,0.8078); + me["EPR1"].show(); + me["EPR1-decpnt"].show(); + me["EPR1-decimal"].show(); + me["EPR1-needle"].show(); + me["EPR1-ylim"].show(); + me["EPR1-scaletick"].show(); + me["EPR1-scalenum"].show(); + me["EPR1-box"].show(); + me["EPR1-XX"].hide(); + me["EPR1-XX2"].hide(); + } else { + me["EPR1-scale"].setColor(0.7333,0.3803,0); + me["EPR1"].hide(); + me["EPR1-decpnt"].hide(); + me["EPR1-decimal"].hide(); + me["EPR1-needle"].hide(); + me["EPR1-ylim"].hide(); + me["EPR1-scaletick"].hide(); + me["EPR1-scalenum"].hide(); + me["EPR1-box"].hide(); + me["EPR1-XX"].show(); + me["EPR1-XX2"].show(); + } + }, + updateEPR2: func(notification) { + me._cachedEPR[1] = notification.eng2_epr; + if (me._cachedEPR[1] == 1) { + me["EPR2-scale"].setColor(0.8078,0.8039,0.8078); + me["EPR2"].show(); + me["EPR2-decpnt"].show(); + me["EPR2-decimal"].show(); + me["EPR2-needle"].show(); + me["EPR2-ylim"].show(); + me["EPR2-scaletick"].show(); + me["EPR2-scalenum"].show(); + me["EPR2-box"].show(); + me["EPR2-XX"].hide(); + me["EPR2-XX2"].hide(); + } else { + me["EPR2-scale"].setColor(0.7333,0.3803,0); + me["EPR2"].hide(); + me["EPR2-decpnt"].hide(); + me["EPR2-decimal"].hide(); + me["EPR2-needle"].hide(); + me["EPR2-ylim"].hide(); + me["EPR2-scaletick"].hide(); + me["EPR2-scalenum"].hide(); + me["EPR2-box"].hide(); + me["EPR2-XX"].show(); + me["EPR2-XX2"].show(); + } + }, + updateFF1: func() { + me._cachedFF[0] = fadec.FADEC.Eng1.ff; + if (fadec.FADEC.Eng1.ff == 1) { + me["FF1"].show(); + me["FF1-XX"].hide(); + } else { + me["FF1"].hide(); + me["FF1-XX"].show(); + } + }, + updateFF2: func() { + me._cachedFF[1] = fadec.FADEC.Eng2.ff; + if (fadec.FADEC.Eng2.ff == 1) { + me["FF2"].show(); + me["FF2-XX"].hide(); + } else { + me["FF2"].hide(); + me["FF2-XX"].show(); + } + }, + + updateFadecN1Power1: func(val) { + if (me.typeString == "IAE") { + if (val.reverser_1 < 0.01 and val.eng1_epr == 1 and val.N1_mode_1 != 1) { + me["EPR1-thr"].show(); + } else { + me["EPR1-thr"].hide(); + } + } else { + if (val.reverser_1 < 0.01 and val.eng1_n1 == 1) { + me["N11-thr"].show(); + } else { + me["N11-thr"].hide(); + } + } - # EPR - obj["EPR1"].setText(sprintf("%1.0f", math.floor(EPR_1_act))); - obj["EPR1-decimal"].setText(sprintf("%03d", (EPR_1_act - int(EPR_1_act)) * 1000)); - obj["EPR2"].setText(sprintf("%1.0f", math.floor(EPR_2_act))); - obj["EPR2-decimal"].setText(sprintf("%03d", (EPR_2_act - int(EPR_2_act)) * 1000)); + if (val.reverser_1 >= 0.01 and val.eng1_n1 == 1) { + me["REV1"].show(); + me["REV1-box"].show(); + } else { + me["REV1"].hide(); + me["REV1-box"].hide(); + } - obj["EPR1-needle"].setRotation((EPR_1_cur + 90) * D2R); - obj["EPR1-thr"].setRotation((EPR_thr_1_act + 90) * D2R); - obj["EPR1-ylim"].setRotation((EPR_lim_cur + 90) * D2R); - obj["EPR2-needle"].setRotation((EPR_2_cur + 90) * D2R); - obj["EPR2-thr"].setRotation((EPR_thr_2_act + 90) * D2R); - obj["EPR2-ylim"].setRotation((EPR_lim_cur + 90) * D2R); + if (val.reverser_1 >= 0.95) { + me["REV2"].setColor(0.0509,0.7529,0.2941); + } else { + me["REV2"].setColor(0.7333,0.3803,0); + } + }, + updateFadecN1Power2: func(val) { + if (me.typeString == "IAE") { + if (val.reverser_2 < 0.01 and val.eng2_epr == 1 and val.N1_mode_2 != 1) { + me["EPR2-thr"].show(); + } else { + me["EPR2-thr"].hide(); + } + } else { + if (val.reverser_2 < 0.01 and val.eng2_n1 == 1) { + me["N12-thr"].show(); + } else { + me["N12-thr"].hide(); + } + } - me.updateBase(notification); + if (val.reverser_2 >= 0.01 and val.eng2_n1 == 1) { + me["REV2"].show(); + me["REV2-box"].show(); + } else { + me["REV2"].hide(); + me["REV2-box"].hide(); + } + + if (val.reverser_2 >= 0.95) { + me["REV2"].setColor(0.0509,0.7529,0.2941); + } else { + me["REV2"].setColor(0.7333,0.3803,0); + } + }, + + updateTest: func() { + if (du3_test_time.getValue() + 1 >= pts.Sim.Time.elapsedSec.getValue()) { + me["Test_white"].show(); + me["Test_text"].hide(); + } else { + me["Test_white"].hide(); + me["Test_text"].show(); + } + }, + powerTransient: func() { + if (systems.ELEC.Bus.acEss.getValue() >= 110) { + if (du3_offtime.getValue() + 3 < pts.Sim.Time.elapsedSec.getValue()) { + if (pts.Gear.wow[0].getValue()) { + if (!acconfig.getBoolValue() and !du3_test.getBoolValue()) { + du3_test.setValue(1); + du3_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du3_test_time.setValue(pts.Sim.Time.elapsedSec.getValue()); + } else if (acconfig.getBoolValue() and !du3_test.getBoolValue()) { + du3_test.setValue(1); + du3_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du3_test_time.setValue(pts.Sim.Time.elapsedSec.getValue() - 30); + } + } else { + du3_test.setValue(1); + du3_test_amount.setValue(0); + du3_test_time.setValue(-100); + } + } + } else { + du3_test.setValue(0); + du3_offtime.setValue(pts.Sim.Time.elapsedSec.getValue()); + } + }, + updatePower: func() { + if (du3_lgt.getValue() > 0.01 and systems.ELEC.Bus.acEss.getValue() >= 110) { + if (du3_test_time.getValue() + du3_test_amount.getValue() >= pts.Sim.Time.elapsedSec.getValue()) { + me.group.setVisible(0); + me.test.setVisible(1); + } else { + me.group.setVisible(1); + me.test.setVisible(0); + } + } else { + me.group.setVisible(0); + me.test.setVisible(0); + } }, }; + +var UpperECAMRecipient = +{ + new: func(_ident) + { + var EWDRecipient = emesary.Recipient.new(_ident); + EWDRecipient.MainScreen = nil; + EWDRecipient.type = eng_option.getValue() == "IAE" ? 1 : 0; + EWDRecipient.Receive = func(notification) + { + if (notification.NotificationType == "FrameNotification") + { + if (EWDRecipient.MainScreen == nil) { + if (EWDRecipient.type) { + EWDRecipient.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/iae-eis2.svg", "A320 E/WD IAE", "IAE"); + } else { + EWDRecipient.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 E/WD CFM", "CFM"); + } + } + + #if (!math.mod(notifications.frameNotification.FrameCount,2)){ + if (EWDRecipient.type) { + EWDRecipient.MainScreen.updateIAE(notification); + } else { + EWDRecipient.MainScreen.updateCFM(notification); + + } + #} + return emesary.Transmitter.ReceiptStatus_OK; + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + return EWDRecipient; + }, +}; + +var A320EWD = UpperECAMRecipient.new("A320 E/WD"); +emesary.GlobalTransmitter.Register(A320EWD); + +input = { + fuelTotalLbs: "/consumables/fuel/total-fuel-lbs", + acconfigUnits: "/systems/acconfig/options/weight-kgs", + slatLocked: "/fdm/jsbsim/fcs/slat-locked", + + # N1 parameters + N1_1: "/ECAM/Upper/N1[0]", + N1_2: "/ECAM/Upper/N1[1]", + N1_actual_1: "/engines/engine[0]/n1-actual", + N1_actual_2: "/engines/engine[1]/n1-actual", + N1_lim: "/ECAM/Upper/N1ylim", + N1thr_1: "/ECAM/Upper/N1thr[0]", + N1thr_2: "/ECAM/Upper/N1thr[1]", + + # N2 parameters + N2_actual_1: "/engines/engine[0]/n2-actual", + N2_actual_2: "/engines/engine[1]/n2-actual", + + # Reverse thrust + reverser_1: "/engines/engine[0]/reverser-pos-norm", + reverser_2: "/engines/engine[1]/reverser-pos-norm", + + # EGT + egt_1: "/engines/engine[0]/egt-actual", + egt_2: "/engines/engine[1]/egt-actual", + egt_1_needle: "/ECAM/Upper/EGT[0]", + egt_2_needle: "/ECAM/Upper/EGT[1]", + + # N1 parameters + EPR_1: "/ECAM/Upper/EPR[0]", + EPR_2: "/ECAM/Upper/EPR[1]", + EPR_actual_1: "/engines/engine[0]/epr-actual", + EPR_actual_2: "/engines/engine[1]/epr-actual", + EPR_lim: "/ECAM/Upper/EPRylim", + EPRthr_1: "/ECAM/Upper/EPRthr[0]", + EPRthr_2: "/ECAM/Upper/EPRthr[1]", + + # fuel flow + fuelflow_1: "/engines/engine[0]/fuel-flow_actual", + fuelflow_2: "/engines/engine[1]/fuel-flow_actual", + + # flaps + flapsPos: "/controls/flight/flaps-pos", + flapxOffset: "/ECAM/Upper/FlapX", + flapyOffset: "/ECAM/Upper/FlapY", + slatxOffset: "/ECAM/Upper/SlatX", + slatyOffset: "/ECAM/Upper/SlatY", + flapxOffsetTrans: "/ECAM/Upper/FlapXtrans", + flapyOffsetTrans: "/ECAM/Upper/FlapYtrans", + slatxOffsetTrans: "/ECAM/Upper/SlatXtrans", + slatyOffsetTrans: "/ECAM/Upper/SlatYtrans", + + # fadec + alphaFloor: "/systems/thrust/alpha-floor", + eprLimit: "/controls/engines/epr-limit", + thrustLimit: "/controls/engines/thrust-limit", + n1Limit: "/controls/engines/n1-limit", + flexTemp: "/FMGC/internal/flex", + fadecPower1: "/systems/fadec/powered1", + fadecPower2: "/systems/fadec/powered2", + fadecPowerStart: "/systems/fadec/powerup", + N1_mode_1: "/systems/fadec/n1mode1", + N1_mode_2: "/systems/fadec/n1mode2", + eng1_epr: "/systems/fadec/eng1/epr", + eng2_epr: "/systems/fadec/eng2/epr", + eng1_n1: "/systems/fadec/eng1/n1", + eng2_n1: "/systems/fadec/eng2/n1", + + # ecam + ecamMsg1: "/ECAM/msg/line1", + ecamMsg2: "/ECAM/msg/line2", + ecamMsg3: "/ECAM/msg/line3", + ecamMsg4: "/ECAM/msg/line4", + ecamMsg5: "/ECAM/msg/line5", + ecamMsg6: "/ECAM/msg/line6", + ecamMsg7: "/ECAM/msg/line7", + ecamMsg8: "/ECAM/msg/line8", + ecamMsg1R: "/ECAM/rightmsg/line1", + ecamMsg2R: "/ECAM/rightmsg/line2", + ecamMsg3R: "/ECAM/rightmsg/line3", + ecamMsg4R: "/ECAM/rightmsg/line4", + ecamMsg5R: "/ECAM/rightmsg/line5", + ecamMsg6R: "/ECAM/rightmsg/line6", + ecamMsg7R: "/ECAM/rightmsg/line7", + ecamMsg8R: "/ECAM/rightmsg/line8", +}; + +foreach (var name; keys(input)) { + emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Upper ECAM", name, input[name])); +} + +var showUpperECAM = func { + var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); + dlg.setCanvas(A320EWD.MainScreen.canvas); +} + +setlistener("/systems/electrical/bus/ac-ess", func() { + A320EWD.MainScreen.powerTransient(); +}, 0, 0); + +var slatLockTimer = maketimer(0.50, func { + if (!slatLockFlash) { + slatLockFlash = 1; + } else { + slatLockFlash = 0; + } +}); \ No newline at end of file diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas deleted file mode 100644 index 58ad8169..00000000 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas +++ /dev/null @@ -1,1092 +0,0 @@ -var flapsPos = nil; -var elapsedtime = nil; -var LBS2KGS = 0.4535924; -var slatLockGoing = 0; -var slatLockFlash = 0; -var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); -var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); -var du3_test = props.globals.initNode("/instrumentation/du/du3-test", 0, "BOOL"); -var du3_test_time = props.globals.initNode("/instrumentation/du/du3-test-time", 0.0, "DOUBLE"); -var du3_test_amount = props.globals.initNode("/instrumentation/du/du3-test-amount", 0.0, "DOUBLE"); -var du3_offtime = props.globals.initNode("/instrumentation/du/du3-off-time", 0.0, "DOUBLE"); -var du3_lgt = props.globals.getNode("/controls/lighting/DU/du3"); -var eng_option = props.globals.getNode("/options/eng", 1); - -var ECAM_line1c = props.globals.getNode("/ECAM/msg/linec1", 1); -var ECAM_line2c = props.globals.getNode("/ECAM/msg/linec2", 1); -var ECAM_line3c = props.globals.getNode("/ECAM/msg/linec3", 1); -var ECAM_line4c = props.globals.getNode("/ECAM/msg/linec4", 1); -var ECAM_line5c = props.globals.getNode("/ECAM/msg/linec5", 1); -var ECAM_line6c = props.globals.getNode("/ECAM/msg/linec6", 1); -var ECAM_line7c = props.globals.getNode("/ECAM/msg/linec7", 1); -var ECAM_line8c = props.globals.getNode("/ECAM/msg/linec8", 1); -var ECAM_line1rc = props.globals.getNode("/ECAM/rightmsg/linec1", 1); -var ECAM_line2rc = props.globals.getNode("/ECAM/rightmsg/linec2", 1); -var ECAM_line3rc = props.globals.getNode("/ECAM/rightmsg/linec3", 1); -var ECAM_line4rc = props.globals.getNode("/ECAM/rightmsg/linec4", 1); -var ECAM_line5rc = props.globals.getNode("/ECAM/rightmsg/linec5", 1); -var ECAM_line6rc = props.globals.getNode("/ECAM/rightmsg/linec6", 1); -var ECAM_line7rc = props.globals.getNode("/ECAM/rightmsg/linec7", 1); -var ECAM_line8rc = props.globals.getNode("/ECAM/rightmsg/linec8", 1); - -var canvas_upperECAM = { - new: func(svg, name, type) { - var obj = {parents: [canvas_upperECAM] }; - obj.canvas = canvas.new({ - "name": "upperECAM", - "size": [1024, 1024], - "view": [1024, 1024], - "mipmapping": 1, - }); - - obj.canvas.addPlacement({"node": "uecam.screen"}); - obj.group = obj.canvas.createGroup(); - obj.test = obj.canvas.createGroup(); - - obj.typeString = type; - - obj.font_mapper = func(family, weight) { - return "LiberationFonts/LiberationSans-Regular.ttf"; - }; - - canvas.parsesvg(obj.group, svg, {"font-mapper": obj.font_mapper} ); - obj.keysHash = (type == "IAE" ? obj.getKeysIAE() : obj.getKeysCFM()); - foreach(var key; obj.keysHash) { - obj[key] = obj.group.getElementById(key); - - var clip_el = obj.group.getElementById(key ~ "_clip"); - if (clip_el != nil) { - clip_el.setVisible(0); - var tran_rect = clip_el.getTransformedBounds(); - - var clip_rect = sprintf("rect(%d,%d, %d,%d)", - tran_rect[1], - tran_rect[2], - tran_rect[3], - tran_rect[0]); - obj[key].set("clip", clip_rect); - obj[key].set("clip-frame", canvas.Element.PARENT); - } - }; - canvas.parsesvg(obj.test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg", {"font-mapper": obj.font_mapper} ); - foreach(var key; obj.getKeysTest()) { - obj[key] = obj.test.getElementById(key); - }; - - obj.units = acconfig_weight_kgs.getValue(); - - obj.update_items = [ - props.UpdateManager.FromHashValue("acconfigUnits", 1, func(val) { - if (obj.typeString == "IAE") { - if (val) { - obj["FOB-weight-unit"].setText("KG"); - obj["FFlow1-weight-unit"].setText("KG/H"); - obj["FFlow2-weight-unit"].setText("KG/H"); - } else { - obj["FOB-weight-unit"].setText("LBS"); - obj["FFlow1-weight-unit"].setText("LBS/H"); - obj["FFlow2-weight-unit"].setText("LBS/H"); - } - } else { - if (val) { - obj["FOB-weight-unit"].setText("KG"); - obj["FFlow-weight-unit"].setText("KG/H"); - } else { - obj["FOB-weight-unit"].setText("LBS"); - obj["FFlow-weight-unit"].setText("LBS/H"); - } - } - obj.units = val; - }), - props.UpdateManager.FromHashList(["fuelTotalLbs","acconfigUnits"], 1, func(val) { - if (obj.units) - { - obj["FOB-LBS"].setText(sprintf("%s", math.round(val.fuelTotalLbs * LBS2KGS, 10))); - } else { - obj["FOB-LBS"].setText(sprintf("%s", math.round(val.fuelTotalLbs, 10))); - } - }), - props.UpdateManager.FromHashList(["flapxOffset", "flapyOffset"], 0.01, func(val) { - obj["FlapIndicator"].setTranslation(val.flapxOffset,val.flapyOffset); - }), - props.UpdateManager.FromHashList(["slatxOffset", "slatyOffset"], 0.01, func(val) { - obj["SlatIndicator"].setTranslation(val.slatxOffset,val.slatyOffset); - }), - props.UpdateManager.FromHashList(["flapxOffsetTrans", "flapyOffsetTrans"], 0.01, func(val) { - obj["FlapLine"].setTranslation(val.flapxOffsetTrans,val.flapyOffsetTrans); - }), - props.UpdateManager.FromHashList(["slatxOffsetTrans", "slatyOffsetTrans"], 0.01, func(val) { - obj["SlatLine"].setTranslation(val.slatxOffsetTrans,val.slatyOffsetTrans); - }), - props.UpdateManager.FromHashValue("alphaFloor", 1, func(val) { - if (val) { - obj["aFloor"].show(); - } else { - obj["aFloor"].hide(); - } - }), - props.UpdateManager.FromHashValue("flapsPos", 1, func(val) { - flapsPos = val; - if (flapsPos == 1) { - obj["FlapTxt"].setText("1"); - } else if (flapsPos == 2) { - obj["FlapTxt"].setText("1+F"); - } else if (flapsPos == 3) { - obj["FlapTxt"].setText("2"); - } else if (flapsPos == 4) { - obj["FlapTxt"].setText("3"); - } else if (flapsPos == 5) { - obj["FlapTxt"].setText("FULL"); - } else { - obj["FlapTxt"].setText(" "); # More efficient then hide/show - } - - if (flapsPos > 0) { - obj["FlapDots"].show(); - } else { - obj["FlapDots"].hide(); - } - }), - props.UpdateManager.FromHashValue("flexTemp", 1, func(val) { - obj["FlxLimTemp"].setText(sprintf("%2.0d",val)); - }), - props.UpdateManager.FromHashValue("slatLocked", nil, func(val) { - if (val) { - if (slatLockGoing == 0) { - slatLockGoing = 1; - slatLockTimer.start(); - } - } else { - slatLockTimer.stop(); - slatLockGoing = 0; - slatLockFlash = 0; - } - }), - ]; - - obj.update_items_fadec_powered_n1 = [ - props.UpdateManager.FromHashValue("N1_1", 0.01, func(val) { - obj["N11-needle"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("N1_2", 0.01, func(val) { - obj["N12-needle"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("N1_actual_1", 0.025, func(val) { - obj["N11"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); - }), - props.UpdateManager.FromHashValue("N1_actual_2", 0.025, func(val) { - obj["N12"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); - }), - props.UpdateManager.FromHashValue("N1_lim", 0.01, func(val) { - obj["N11-ylim"].setRotation((val + 90) * D2R); - obj["N12-ylim"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("N1thr_1", 0.01, func(val) { - obj["N11-thr"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("N1thr_2", 0.01, func(val) { - obj["N12-thr"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("reverser_1", 0.005, func(val) { - if (obj.typeString == "IAE") { - if (val < 0.01 and fadec.FADEC.Eng1.epr == 1) { - obj["EPR1-thr"].show(); - } else { - obj["EPR1-thr"].hide(); - } - } else { - if (val < 0.01 and fadec.FADEC.Eng1.n1 == 1) { - obj["N11-thr"].show(); - } else { - obj["N11-thr"].hide(); - } - } - - if (val >= 0.01 and fadec.FADEC.Eng1.n1 == 1) { - obj["REV1"].show(); - obj["REV1-box"].show(); - } else { - obj["REV1"].hide(); - obj["REV1-box"].hide(); - } - - if (val >= 0.95) { - obj["REV2"].setColor(0.0509,0.7529,0.2941); - } else { - obj["REV2"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashValue("reverser_2", 0.005, func(val) { - if (obj.typeString == "IAE") { - if (val < 0.01 and fadec.FADEC.Eng2.epr == 1) { - obj["EPR2-thr"].show(); - } else { - obj["EPR2-thr"].hide(); - } - } else { - if (val < 0.01 and fadec.FADEC.Eng2.n1 == 1) { - obj["N12-thr"].show(); - } else { - obj["N12-thr"].hide(); - } - } - - if (val >= 0.01 and fadec.FADEC.Eng2.n1 == 1) { - obj["REV2"].show(); - obj["REV2-box"].show(); - } else { - obj["REV2"].hide(); - obj["REV2-box"].hide(); - } - - if (val >= 0.95) { - obj["REV1"].setColor(0.0509,0.7529,0.2941); - } else { - obj["REV1"].setColor(0.7333,0.3803,0); - } - }), - ]; - - obj.update_items_fadec_powered_epr = [ - props.UpdateManager.FromHashValue("EPR_1", 0.01, func(val) { - obj["EPR1-needle"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("EPR_2", 0.01, func(val) { - obj["EPR2-needle"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("EPR_actual_1", 0.0001, func(val) { - obj["EPR1"].setText(sprintf("%1.0f", math.floor(val))); - obj["EPR1-decimal"].setText(sprintf("%03d", (val - int(val)) * 1000)); - }), - props.UpdateManager.FromHashValue("EPR_actual_2", 0.0001, func(val) { - obj["EPR2"].setText(sprintf("%1.0f", math.floor(val))); - obj["EPR2-decimal"].setText(sprintf("%03d", (val - int(val)) * 1000)); - }), - props.UpdateManager.FromHashValue("EPR_lim", 0.005, func(val) { - obj["EPR1-ylim"].setRotation((val + 90) * D2R); - obj["EPR2-ylim"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("EPRthr_1", 0.005, func(val) { - obj["EPR1-thr"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("EPRthr_2", 0.005, func(val) { - obj["EPR2-thr"].setRotation((val + 90) * D2R); - }), - ]; - - obj.update_items_fadec_powered_n2 = [ - props.UpdateManager.FromHashValue("N2_actual_1", 0.025, func(val) { - obj["N21"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); - }), - props.UpdateManager.FromHashValue("N2_actual_2", 0.025, func(val) { - obj["N22"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); - }), - ]; - - obj.update_items_cfm_only = [ - props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) { - obj["N1Lim-mode"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("n1Limit", 0.01, func(val) { - obj["N1Lim"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); - }), - props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], nil, func(val) { - if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { - obj["N1Lim-mode"].show(); - obj["N1Lim-XX"].hide(); - obj["N1Lim-XX2"].hide(); - } else { - obj["N1Lim-mode"].hide(); - obj["N1Lim-XX"].show(); - obj["N1Lim-XX2"].show(); - } - - if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit != "MREV") { - obj["N1Lim"].show(); - obj["N1Lim-decpnt"].show(); - obj["N1Lim-decimal"].show(); - obj["N1Lim-percent"].show(); - } else { - obj["N1Lim"].hide(); - obj["N1Lim-decpnt"].hide(); - obj["N1Lim-decimal"].hide(); - obj["N1Lim-percent"].hide(); - } - - if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") { - obj["FlxLimDegreesC"].show(); - obj["FlxLimTemp"].show(); - } else { - obj["FlxLimDegreesC"].hide(); - obj["FlxLimTemp"].hide(); - } - }), - ]; - - obj.update_items_iae_only = [ - props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) { - obj["EPRLim-mode"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("eprLimit", 0.0005, func(val) { - obj["EPRLim"].setText(sprintf("%1.0f", math.floor(val))); - obj["EPRLim-decimal"].setText(sprintf("%03d", (val - int(val)) * 1000)); - }), - props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], nil, func(val) { - if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { - obj["EPRLim-mode"].show(); - obj["EPRLim-XX"].hide(); - obj["EPRLim-XX2"].hide(); - } else { - obj["EPRLim-mode"].hide(); - obj["EPRLim-XX"].show(); - obj["EPRLim-XX2"].show(); - } - - if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit != "MREV") { - obj["EPRLim"].show(); - obj["EPRLim-decpnt"].show(); - obj["EPRLim-decimal"].show(); - } else { - obj["EPRLim"].hide(); - obj["EPRLim-decpnt"].hide(); - obj["EPRLim-decimal"].hide(); - } - - if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") { - obj["FlxLimDegreesC"].show(); - obj["FlxLimTemp"].show(); - } else { - obj["FlxLimDegreesC"].hide(); - obj["FlxLimTemp"].hide(); - } - }), - props.UpdateManager.FromHashValue("N1_mode_1", nil, func(val) { - if (fadec.FADEC.Eng1.n1 == 1 and val) { - obj["N11-thr"].show(); - obj["N11-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet - obj["EPR1-thr"].hide(); - } else { - obj["N11-thr"].hide(); - obj["N11-ylim"].hide(); - obj["EPR1-thr"].show(); - } - }), - props.UpdateManager.FromHashValue("N1_mode_2", nil, func(val) { - if (fadec.FADEC.Eng2.n1 == 1 and val) { - obj["N12-thr"].show(); - obj["N12-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet - obj["EPR2-thr"].hide(); - } else { - obj["N12-thr"].hide(); - obj["N12-ylim"].hide(); - obj["EPR2-thr"].show(); - } - }), - ]; - - obj.update_items_fadec_powered_egt = [ - props.UpdateManager.FromHashValue("egt_1", 0.5, func(val) { - obj["EGT1"].setText(sprintf("%s", math.round(val))); - }), - props.UpdateManager.FromHashValue("egt_1_needle", 0.01, func(val) { - obj["EGT1-needle"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("egt_2", 0.5, func(val) { - obj["EGT2"].setText(sprintf("%s", math.round(val))); - }), - props.UpdateManager.FromHashValue("egt_2_needle", 0.01, func(val) { - obj["EGT2-needle"].setRotation((val + 90) * D2R); - }), - ]; - - obj.update_items_fadec_powered_ff = [ - props.UpdateManager.FromHashList(["fuelflow_1","acconfigUnits"], 1, func(val) { - if (obj.units) { - obj["FF1"].setText(sprintf("%s", math.round(val.fuelflow_1 * LBS2KGS, 10))); - } else { - obj["FF1"].setText(sprintf("%s", math.round(val.fuelflow_1, 10))); - } - }), - props.UpdateManager.FromHashList(["fuelflow_2","acconfigUnits"], 1, func(val) { - if (obj.units) { - obj["FF2"].setText(sprintf("%s", math.round(val.fuelflow_2 * LBS2KGS, 10))); - } else { - obj["FF2"].setText(sprintf("%s", math.round(val.fuelflow_2, 10))); - } - }), - ]; - - obj.ecam_update = [ - props.UpdateManager.FromHashValue("ecamMsg1", nil, func(val) { - obj["ECAML1"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg2", nil, func(val) { - obj["ECAML2"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg3", nil, func(val) { - obj["ECAML3"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg4", nil, func(val) { - obj["ECAML4"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg5", nil, func(val) { - obj["ECAML5"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg6", nil, func(val) { - obj["ECAML6"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg7", nil, func(val) { - obj["ECAML7"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg8", nil, func(val) { - obj["ECAML8"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg1R", nil, func(val) { - obj["ECAMR1"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg2R", nil, func(val) { - obj["ECAMR2"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg3R", nil, func(val) { - obj["ECAMR3"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg4R", nil, func(val) { - obj["ECAMR4"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg5R", nil, func(val) { - obj["ECAMR5"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg6R", nil, func(val) { - obj["ECAMR6"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg7R", nil, func(val) { - obj["ECAMR7"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("ecamMsg8R", nil, func(val) { - obj["ECAMR8"].setText(sprintf("%s", val)); - }), - ]; - - obj.createListenerForLine("/ECAM/msg/linec1", ECAM_line1c, "ECAML1"); - obj.createListenerForLine("/ECAM/msg/linec2", ECAM_line2c, "ECAML2"); - obj.createListenerForLine("/ECAM/msg/linec3", ECAM_line3c, "ECAML3"); - obj.createListenerForLine("/ECAM/msg/linec4", ECAM_line4c, "ECAML4"); - obj.createListenerForLine("/ECAM/msg/linec5", ECAM_line5c, "ECAML5"); - obj.createListenerForLine("/ECAM/msg/linec6", ECAM_line6c, "ECAML6"); - obj.createListenerForLine("/ECAM/msg/linec7", ECAM_line7c, "ECAML7"); - obj.createListenerForLine("/ECAM/msg/linec8", ECAM_line8c, "ECAML8"); - - obj.createListenerForLine("/ECAM/rightmsg/linec1", ECAM_line1rc, "ECAMR1"); - obj.createListenerForLine("/ECAM/rightmsg/linec2", ECAM_line2rc, "ECAMR2"); - obj.createListenerForLine("/ECAM/rightmsg/linec3", ECAM_line3rc, "ECAMR3"); - obj.createListenerForLine("/ECAM/rightmsg/linec4", ECAM_line4rc, "ECAMR4"); - obj.createListenerForLine("/ECAM/rightmsg/linec5", ECAM_line5rc, "ECAMR5"); - obj.createListenerForLine("/ECAM/rightmsg/linec6", ECAM_line6rc, "ECAMR6"); - obj.createListenerForLine("/ECAM/rightmsg/linec7", ECAM_line7rc, "ECAMR7"); - obj.createListenerForLine("/ECAM/rightmsg/linec8", ECAM_line8rc, "ECAMR8"); - - obj["ECAML1"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML2"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML3"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML4"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML5"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML6"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML7"].setFont("LiberationMonoCustom.ttf"); - obj["ECAML8"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR1"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR2"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR3"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR4"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR5"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR6"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR7"].setFont("LiberationMonoCustom.ttf"); - obj["ECAMR8"].setFont("LiberationMonoCustom.ttf"); - - obj.page = obj.group; - - # cache - obj._cachedN1 = [nil, nil]; - obj._cachedN2 = [nil, nil]; - obj._cachedEGT = [nil, nil]; - obj._cachedEPR = [nil, nil]; - obj._cachedFF = [nil, nil]; - - return obj; - }, - getKeysCFM: func() { - return ["N11-needle","N11-thr","N11-ylim","N11","N11-decpnt","N11-decimal","N11-box","N11-scale","N11-scale2","N11-scaletick","N11-scalenum","N11-XX","N11-XX2","N11-XX-box","EGT1-needle","EGT1","EGT1-scale","EGT1-box","EGT1-scale2","EGT1-scaletick", - "EGT1-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal","N12-box","N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N12-XX2","N12-XX-box","EGT2-needle","EGT2", - "EGT2-scale","EGT2-box","EGT2-scale2","EGT2-scaletick","EGT2-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","N1Lim-mode","N1Lim","N1Lim-decpnt","N1Lim-decimal","N1Lim-percent","N1Lim-XX","N1Lim-XX2","REV1", - "REV1-box","REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8","ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", - "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; - }, - getKeysIAE: func() { - return ["EPR1-needle","EPR1-thr","EPR1-ylim","EPR1","EPR1-decpnt","EPR1-decimal","EPR1-box","EPR1-scale","EPR1-scaletick","EPR1-scalenum","EPR1-XX","EPR1-XX2","EGT1-needle","EGT1","EGT1-scale","EGT1-box","EGT1-scale2","EGT1-scaletick","EGT1-XX", - "N11-needle","N11-thr","N11-ylim","N11","N11-decpnt","N11-decimal","N11-scale","N11-scale2","N11-scaletick","N11-scalenum","N11-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","EPR2-needle","EPR2-thr","EPR2-ylim","EPR2","EPR2-decpnt", - "EPR2-decimal","EPR2-box","EPR2-scale","EPR2-scaletick","EPR2-scalenum","EPR2-XX","EPR2-XX2","EGT2-needle","EGT2","EGT2-scale","EGT2-scale2","EGT2-box","EGT2-scaletick","EGT2-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal", - "N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","EPRLim-mode","EPRLim","EPRLim-decpnt","EPRLim-decimal","EPRLim-XX","EPRLim-XX2","REV1","REV1-box", - "REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8", "ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", - "FFlow1-weight-unit", "FFlow2-weight-unit", "FOB-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; - }, - getKeysTest: func() { - return ["Test_white","Test_text"]; - }, - getColorString: func(color) { - if (color == "w") { - return [0.8078,0.8039,0.8078]; - } else if (color == "m") { - return [0.6901,0.3333,0.7450]; - } else if (color == "c") { - return [0.0901,0.6039,0.7176]; - } else if (color == "g") { - return [0.0509,0.7529,0.2941]; - } else if (color == "a") { - return [0.7333,0.3803,0]; - } else if (color == "r") { - return [1,0,0]; - } else { - return [1,1,1]; - } - }, - createListenerForLine: func(prop, node, key) { - setlistener(prop, func() { - me[key].setColor(me.getColorString(node.getValue())); - }, 0, 0); - }, - updateCommon: func(notification) { - me.updatePower(); - - if (me.test.getVisible() == 1) { - me.updateTest(); - } - - if (me.group.getVisible() == 0) { - return; - } - - foreach(var update_item; me.update_items) - { - update_item.update(notification); - } - - if (fadec.FADEC.Eng1.n1 != me._cachedN1[0]) { - me.updateN11(); - } - if (fadec.FADEC.Eng2.n1 != me._cachedN1[1]) { - me.updateN12(); - } - - if (fadec.FADEC.Eng1.n2 != me._cachedN2[0]) { - me.updateN21(); - } - if (fadec.FADEC.Eng2.n2 != me._cachedN2[1]) { - me.updateN22(); - } - - if (fadec.FADEC.Eng1.egt != me._cachedEGT[0]) { - me.updateEGT1(); - } - if (fadec.FADEC.Eng2.egt != me._cachedEGT[1]) { - me.updateEGT2(); - } - - if (fadec.FADEC.Eng1.ff != me._cachedFF[0]) { - me.updateFF1(); - } - if (fadec.FADEC.Eng2.ff != me._cachedFF[1]) { - me.updateFF2(); - } - - if (fadec.FADEC.Eng1.n1 or fadec.FADEC.Eng2.n1) { - foreach(var update_item; me.update_items_fadec_powered_n1) - { - update_item.update(notification); - } - } - - if (fadec.FADEC.Eng1.n2 or fadec.FADEC.Eng2.n2) { - foreach(var update_item; me.update_items_fadec_powered_n2) - { - update_item.update(notification); - } - } - - if (fadec.FADEC.Eng1.egt or fadec.FADEC.Eng2.egt) { - foreach(var update_item; me.update_items_fadec_powered_egt) - { - update_item.update(notification); - } - } - - if (fadec.FADEC.Eng1.ff or fadec.FADEC.Eng2.ff) { - foreach(var update_item; me.update_items_fadec_powered_ff) - { - update_item.update(notification); - } - } - - if (slatLockFlash) { - me["SlatAlphaLock"].show(); - } else { - me["SlatAlphaLock"].hide(); - } - - foreach (var update_item; me.ecam_update) - { - update_item.update(notification); - } - }, - updateCFM: func(notification) { - me.updateCommon(notification); - if (me.group.getVisible() == 0) { - return; - } - - foreach (var update_item; me.update_items_cfm_only) { - update_item.update(notification); - } - }, - updateIAE: func(notification) { - me.updateCommon(notification); - if (me.group.getVisible() == 0) { - return; - } - - foreach (var update_item; me.update_items_iae_only) { - update_item.update(notification); - } - - if (fadec.FADEC.Eng1.epr != me._cachedEPR[0]) { - me.updateEPR1(); - } - if (fadec.FADEC.Eng2.epr != me._cachedEPR[1]) { - me.updateEPR2(); - } - - if (fadec.FADEC.Eng1.epr or fadec.FADEC.Eng2.epr) { - foreach(var update_item; me.update_items_fadec_powered_epr) - { - update_item.update(notification); - } - } - }, - - updateN11: func() { - me._cachedN1[0] = fadec.FADEC.Eng1.n1; - if (fadec.FADEC.Eng1.n1 == 1) { - me["N11-scale"].setColor(0.8078,0.8039,0.8078); - me["N11-scale2"].setColor(1,0,0); - me["N11"].show(); - me["N11-decimal"].show(); - me["N11-decpnt"].show(); - me["N11-needle"].show(); - me["N11-scaletick"].show(); - me["N11-scalenum"].show(); - me["N11-XX"].hide(); - - if (me.typeString == "CFM") { - me["N11-ylim"].show(); - me["N11-box"].show(); - me["N11-XX2"].hide(); - me["N11-XX-box"].hide(); - } - } else { - me["N11-scale"].setColor(0.7333,0.3803,0); - me["N11-scale2"].setColor(0.7333,0.3803,0); - me["N11"].hide(); - me["N11-decimal"].hide(); - me["N11-decpnt"].hide(); - me["N11-needle"].hide(); - me["N11-scaletick"].hide(); - me["N11-scalenum"].hide(); - me["N11-XX"].show(); - - if (me.typeString == "CFM") { - me["N11-ylim"].hide(); - me["N11-box"].hide(); - me["N11-XX2"].show(); - me["N11-XX-box"].show(); - } - } - }, - updateN12: func() { - me._cachedN1[1] = fadec.FADEC.Eng2.n1; - if (fadec.FADEC.Eng2.n1 == 1) { - me["N12-scale"].setColor(0.8078,0.8039,0.8078); - me["N12-scale2"].setColor(1,0,0); - me["N12"].show(); - me["N12-decimal"].show(); - me["N12-decpnt"].show(); - me["N12-needle"].show(); - me["N12-scaletick"].show(); - me["N12-scalenum"].show(); - me["N12-XX"].hide(); - - if (me.typeString == "CFM") { - me["N12-ylim"].show(); - me["N12-box"].show(); - me["N12-XX2"].hide(); - me["N12-XX-box"].hide(); - } - } else { - me["N12-scale"].setColor(0.7333,0.3803,0); - me["N12-scale2"].setColor(0.7333,0.3803,0); - me["N12"].hide(); - me["N12-decimal"].hide(); - me["N12-decpnt"].hide(); - me["N12-needle"].hide(); - me["N12-scaletick"].hide(); - me["N12-scalenum"].hide(); - me["N12-XX"].show(); - - if (me.typeString == "CFM") { - me["N12-ylim"].hide(); - me["N12-box"].hide(); - me["N12-XX2"].show(); - me["N12-XX-box"].show(); - } - } - }, - - updateN21: func() { - me._cachedN2[0] = fadec.FADEC.Eng1.n2; - if (fadec.FADEC.Eng1.n2 == 1) { - me["N21"].show(); - me["N21-decimal"].show(); - me["N21-decpnt"].show(); - me["N21-XX"].hide(); - } else { - me["N21"].hide(); - me["N21-decimal"].hide(); - me["N21-decpnt"].hide(); - me["N21-XX"].show(); - } - }, - updateN22: func() { - me._cachedN2[1] = fadec.FADEC.Eng2.n2; - if (fadec.FADEC.Eng2.n2 == 1) { - me["N22"].show(); - me["N22-decimal"].show(); - me["N22-decpnt"].show(); - me["N22-XX"].hide(); - } else { - me["N22"].hide(); - me["N22-decimal"].hide(); - me["N22-decpnt"].hide(); - me["N22-XX"].show(); - } - }, - - updateEGT1: func() { - me._cachedEGT[0] = fadec.FADEC.Eng1.egt; - if (fadec.FADEC.Eng1.egt == 1) { - me["EGT1-scale"].setColor(0.8078,0.8039,0.8078); - me["EGT1-scale2"].setColor(1,0,0); - me["EGT1"].show(); - me["EGT1-needle"].show(); - me["EGT1-scaletick"].show(); - me["EGT1-box"].show(); - me["EGT1-XX"].hide(); - } else { - me["EGT1-scale"].setColor(0.7333,0.3803,0); - me["EGT1-scale2"].setColor(0.7333,0.3803,0); - me["EGT1"].hide(); - me["EGT1-needle"].hide(); - me["EGT1-scaletick"].hide(); - me["EGT1-box"].hide(); - me["EGT1-XX"].show(); - } - }, - updateEGT2: func() { - me._cachedEGT[1] = fadec.FADEC.Eng2.egt; - if (fadec.FADEC.Eng2.egt == 1) { - me["EGT2-scale"].setColor(0.8078,0.8039,0.8078); - me["EGT2-scale2"].setColor(1,0,0); - me["EGT2"].show(); - me["EGT2-needle"].show(); - me["EGT2-scaletick"].show(); - me["EGT2-box"].show(); - me["EGT2-XX"].hide(); - } else { - me["EGT2-scale"].setColor(0.7333,0.3803,0); - me["EGT2-scale2"].setColor(0.7333,0.3803,0); - me["EGT2"].hide(); - me["EGT2-needle"].hide(); - me["EGT2-scaletick"].hide(); - me["EGT2-box"].hide(); - me["EGT2-XX"].show(); - } - }, - - updateEPR1: func() { - me._cachedEPR[0] = fadec.FADEC.Eng1.epr; - if (fadec.FADEC.Eng1.epr == 1) { - me["EPR1-scale"].setColor(0.8078,0.8039,0.8078); - me["EPR1"].show(); - me["EPR1-decpnt"].show(); - me["EPR1-decimal"].show(); - me["EPR1-needle"].show(); - me["EPR1-ylim"].show(); - me["EPR1-scaletick"].show(); - me["EPR1-scalenum"].show(); - me["EPR1-box"].show(); - me["EPR1-XX"].hide(); - me["EPR1-XX2"].hide(); - } else { - me["EPR1-scale"].setColor(0.7333,0.3803,0); - me["EPR1"].hide(); - me["EPR1-decpnt"].hide(); - me["EPR1-decimal"].hide(); - me["EPR1-needle"].hide(); - me["EPR1-ylim"].hide(); - me["EPR1-scaletick"].hide(); - me["EPR1-scalenum"].hide(); - me["EPR1-box"].hide(); - me["EPR1-XX"].show(); - me["EPR1-XX2"].show(); - } - }, - updateEPR2: func() { - me._cachedEPR[1] = fadec.FADEC.Eng2.epr; - if (fadec.FADEC.Eng2.epr == 1) { - me["EPR2-scale"].setColor(0.8078,0.8039,0.8078); - me["EPR2"].show(); - me["EPR2-decpnt"].show(); - me["EPR2-decimal"].show(); - me["EPR2-needle"].show(); - me["EPR2-ylim"].show(); - me["EPR2-scaletick"].show(); - me["EPR2-scalenum"].show(); - me["EPR2-box"].show(); - me["EPR2-XX"].hide(); - me["EPR2-XX2"].hide(); - } else { - me["EPR2-scale"].setColor(0.7333,0.3803,0); - me["EPR2"].hide(); - me["EPR2-decpnt"].hide(); - me["EPR2-decimal"].hide(); - me["EPR2-needle"].hide(); - me["EPR2-ylim"].hide(); - me["EPR2-scaletick"].hide(); - me["EPR2-scalenum"].hide(); - me["EPR2-box"].hide(); - me["EPR2-XX"].show(); - me["EPR2-XX2"].show(); - } - }, - updateFF1: func() { - me._cachedFF[0] = fadec.FADEC.Eng1.ff; - if (fadec.FADEC.Eng1.ff == 1) { - me["FF1"].show(); - me["FF1-XX"].hide(); - } else { - me["FF1"].hide(); - me["FF1-XX"].show(); - } - }, - updateFF2: func() { - me._cachedFF[1] = fadec.FADEC.Eng2.ff; - if (fadec.FADEC.Eng2.ff == 1) { - me["FF2"].show(); - me["FF2-XX"].hide(); - } else { - me["FF2"].hide(); - me["FF2-XX"].show(); - } - }, - - updateTest: func() { - if (du3_test_time.getValue() + 1 >= pts.Sim.Time.elapsedSec.getValue()) { - me["Test_white"].show(); - me["Test_text"].hide(); - } else { - me["Test_white"].hide(); - me["Test_text"].show(); - } - }, - powerTransient: func() { - if (systems.ELEC.Bus.acEss.getValue() >= 110) { - if (du3_offtime.getValue() + 3 < pts.Sim.Time.elapsedSec.getValue()) { - if (pts.Gear.wow[0].getValue()) { - if (!acconfig.getBoolValue() and !du3_test.getBoolValue()) { - du3_test.setValue(1); - du3_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du3_test_time.setValue(pts.Sim.Time.elapsedSec.getValue()); - } else if (acconfig.getBoolValue() and !du3_test.getBoolValue()) { - du3_test.setValue(1); - du3_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du3_test_time.setValue(pts.Sim.Time.elapsedSec.getValue() - 30); - } - } else { - du3_test.setValue(1); - du3_test_amount.setValue(0); - du3_test_time.setValue(-100); - } - } - } else { - du3_test.setValue(0); - du3_offtime.setValue(pts.Sim.Time.elapsedSec.getValue()); - } - }, - updatePower: func() { - if (du3_lgt.getValue() > 0.01 and systems.ELEC.Bus.acEss.getValue() >= 110) { - if (du3_test_time.getValue() + du3_test_amount.getValue() >= pts.Sim.Time.elapsedSec.getValue()) { - me.group.setVisible(0); - me.test.setVisible(1); - } else { - me.group.setVisible(1); - me.test.setVisible(0); - } - } else { - me.group.setVisible(0); - me.test.setVisible(0); - } - }, -}; - -var UpperECAMRecipient = -{ - new: func(_ident) - { - var EWDRecipient = emesary.Recipient.new(_ident); - EWDRecipient.MainScreen = nil; - EWDRecipient.type = eng_option.getValue() == "IAE" ? 1 : 0; - EWDRecipient.Receive = func(notification) - { - if (notification.NotificationType == "FrameNotification") - { - if (EWDRecipient.MainScreen == nil) { - if (EWDRecipient.type) { - EWDRecipient.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/iae-eis2.svg", "A320 E/WD IAE", "IAE"); - } else { - EWDRecipient.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 E/WD CFM", "CFM"); - } - } - - #if (!math.mod(notifications.frameNotification.FrameCount,2)){ - if (EWDRecipient.type) { - EWDRecipient.MainScreen.updateIAE(notification); - } else { - EWDRecipient.MainScreen.updateCFM(notification); - - } - #} - return emesary.Transmitter.ReceiptStatus_OK; - } - return emesary.Transmitter.ReceiptStatus_NotProcessed; - }; - return EWDRecipient; - }, -}; - -var A320EWD = UpperECAMRecipient.new("A320 E/WD"); -emesary.GlobalTransmitter.Register(A320EWD); - -input = { - fuelTotalLbs: "/consumables/fuel/total-fuel-lbs", - acconfigUnits: "/systems/acconfig/options/weight-kgs", - slatLocked: "/fdm/jsbsim/fcs/slat-locked", - - # N1 parameters - N1_1: "/ECAM/Upper/N1[0]", - N1_2: "/ECAM/Upper/N1[1]", - N1_actual_1: "/engines/engine[0]/n1-actual", - N1_actual_2: "/engines/engine[1]/n1-actual", - N1_lim: "/ECAM/Upper/N1ylim", - N1thr_1: "/ECAM/Upper/N1thr[0]", - N1thr_2: "/ECAM/Upper/N1thr[1]", - - # N2 parameters - N2_actual_1: "/engines/engine[0]/n2-actual", - N2_actual_2: "/engines/engine[1]/n2-actual", - - # Reverse thrust - reverser_1: "/engines/engine[0]/reverser-pos-norm", - reverser_2: "/engines/engine[1]/reverser-pos-norm", - - # EGT - egt_1: "/engines/engine[0]/egt-actual", - egt_2: "/engines/engine[1]/egt-actual", - egt_1_needle: "/ECAM/Upper/EGT[0]", - egt_2_needle: "/ECAM/Upper/EGT[1]", - - # N1 parameters - EPR_1: "/ECAM/Upper/EPR[0]", - EPR_2: "/ECAM/Upper/EPR[1]", - EPR_actual_1: "/engines/engine[0]/epr-actual", - EPR_actual_2: "/engines/engine[1]/epr-actual", - EPR_lim: "/ECAM/Upper/EPRylim", - EPRthr_1: "/ECAM/Upper/EPRthr[0]", - EPRthr_2: "/ECAM/Upper/EPRthr[1]", - - # fuel flow - fuelflow_1: "/engines/engine[0]/fuel-flow_actual", - fuelflow_2: "/engines/engine[1]/fuel-flow_actual", - - # flaps - flapsPos: "/controls/flight/flaps-pos", - flapxOffset: "/ECAM/Upper/FlapX", - flapyOffset: "/ECAM/Upper/FlapY", - slatxOffset: "/ECAM/Upper/SlatX", - slatyOffset: "/ECAM/Upper/SlatY", - flapxOffsetTrans: "/ECAM/Upper/FlapXtrans", - flapyOffsetTrans: "/ECAM/Upper/FlapYtrans", - slatxOffsetTrans: "/ECAM/Upper/SlatXtrans", - slatyOffsetTrans: "/ECAM/Upper/SlatYtrans", - - # fadec - alphaFloor: "/systems/thrust/alpha-floor", - eprLimit: "/controls/engines/epr-limit", - thrustLimit: "/controls/engines/thrust-limit", - n1Limit: "/controls/engines/n1-limit", - flexTemp: "/FMGC/internal/flex", - fadecPower1: "/systems/fadec/powered1", - fadecPower2: "/systems/fadec/powered2", - fadecPowerStart: "/systems/fadec/powerup", - N1_mode_1: "/systems/fadec/n1mode1", - N1_mode_2: "/systems/fadec/n1mode2", - - # ecam - ecamMsg1: "/ECAM/msg/line1", - ecamMsg2: "/ECAM/msg/line2", - ecamMsg3: "/ECAM/msg/line3", - ecamMsg4: "/ECAM/msg/line4", - ecamMsg5: "/ECAM/msg/line5", - ecamMsg6: "/ECAM/msg/line6", - ecamMsg7: "/ECAM/msg/line7", - ecamMsg8: "/ECAM/msg/line8", - ecamMsg1R: "/ECAM/rightmsg/line1", - ecamMsg2R: "/ECAM/rightmsg/line2", - ecamMsg3R: "/ECAM/rightmsg/line3", - ecamMsg4R: "/ECAM/rightmsg/line4", - ecamMsg5R: "/ECAM/rightmsg/line5", - ecamMsg6R: "/ECAM/rightmsg/line6", - ecamMsg7R: "/ECAM/rightmsg/line7", - ecamMsg8R: "/ECAM/rightmsg/line8", -}; - -foreach (var name; keys(input)) { - emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Upper ECAM", name, input[name])); -} - -var showUpperECAM = func { - var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); - dlg.setCanvas(A320EWD.MainScreen.canvas); -} - -setlistener("/systems/electrical/bus/ac-ess", func() { - A320EWD.MainScreen.powerTransient(); -}, 0, 0); - -var slatLockTimer = maketimer(0.50, func { - if (!slatLockFlash) { - slatLockFlash = 1; - } else { - slatLockFlash = 0; - } -}); \ No newline at end of file diff --git a/Nasal/Systems/FADEC/fadec-cfm.nas b/Nasal/Systems/FADEC/fadec-cfm.nas index 54bcea9b..fbce166d 100644 --- a/Nasal/Systems/FADEC/fadec-cfm.nas +++ b/Nasal/Systems/FADEC/fadec-cfm.nas @@ -28,9 +28,9 @@ var FADEC = { eng1Time: props.globals.initNode("/systems/fadec/eng1-master-time", -300, "DOUBLE"), eng1Off: props.globals.initNode("/systems/fadec/eng1-off-power", 0, "BOOL"), eng1Counting: 0, - epr: 0, + epr: props.globals.initNode("/systems/fadec/eng1/epr", 0, "BOOL"), egt: 0, - n1: 0, + n1: props.globals.initNode("/systems/fadec/eng1/n1", 0, "BOOL"), n2: 0, ff: 0, }, @@ -38,9 +38,9 @@ var FADEC = { eng2Time: props.globals.initNode("/systems/fadec/eng2-master-time", -300, "DOUBLE"), eng2Off: props.globals.initNode("/systems/fadec/eng2-off-power", 0, "BOOL"), eng2Counting: 0, - epr: 0, + epr: props.globals.initNode("/systems/fadec/eng2/epr", 0, "BOOL"), egt: 0, - n1: 0, + n1: props.globals.initNode("/systems/fadec/eng2/n1", 0, "BOOL"), n2: 0, ff: 0, }, @@ -147,24 +147,24 @@ var FADEC = { powerup = me.Power.powerup.getValue(); if (powered1 or powerup or me.Eng1.eng1Off.getValue()) { - me.Eng1.n1 = 1; + me.Eng1.n1.setValue(1); me.Eng1.n2 = 1; me.Eng1.egt = 1; me.Eng1.ff = 1; } else { - me.Eng1.n1 = 0; + me.Eng1.n1.setValue(0); me.Eng1.n2 = 0; me.Eng1.egt = 0; me.Eng1.ff = 0; } if (powered2 or powerup or me.Eng2.eng2Off.getValue()) { - me.Eng2.n1 = 1; + me.Eng2.n1.setValue(1); me.Eng2.n2 = 1; me.Eng2.egt = 1; me.Eng2.ff = 1; } else { - me.Eng2.n1 = 0; + me.Eng2.n1.setValue(0); me.Eng2.n2 = 0; me.Eng2.egt = 0; me.Eng2.ff = 0; diff --git a/Nasal/Systems/FADEC/fadec-iae.nas b/Nasal/Systems/FADEC/fadec-iae.nas index eeb04da8..9dd2c2f5 100644 --- a/Nasal/Systems/FADEC/fadec-iae.nas +++ b/Nasal/Systems/FADEC/fadec-iae.nas @@ -25,9 +25,9 @@ var FADEC = { eng1Time: props.globals.initNode("/systems/fadec/eng1-master-time", -300, "DOUBLE"), eng1Off: props.globals.initNode("/systems/fadec/eng1-off-power", 0, "BOOL"), eng1Counting: 0, - epr: 0, + epr: props.globals.initNode("/systems/fadec/eng1/epr", 0, "BOOL"), egt: 0, - n1: 0, + n1: props.globals.initNode("/systems/fadec/eng1/n1", 0, "BOOL"), n2: 0, ff: 0, }, @@ -35,9 +35,9 @@ var FADEC = { eng2Time: props.globals.initNode("/systems/fadec/eng2-master-time", -300, "DOUBLE"), eng2Off: props.globals.initNode("/systems/fadec/eng2-off-power", 0, "BOOL"), eng2Counting: 0, - epr: 0, + epr: props.globals.initNode("/systems/fadec/eng2/epr", 0, "BOOL"), egt: 0, - n1: 0, + n1: props.globals.initNode("/systems/fadec/eng2/n1", 0, "BOOL"), n2: 0, ff: 0, }, @@ -148,28 +148,28 @@ var FADEC = { if (powered1 or powerup or me.Eng1.eng1Off.getValue()) { if (me.Modes.n1Mode1.getValue() == 0) { - me.Eng1.epr = 1; + me.Eng1.epr.setValue(1); } else { - me.Eng1.epr = 0; + me.Eng1.epr.setValue(0); } me.Eng1.egt = 1; me.Eng1.ff = 1; } else { - me.Eng1.epr = 0; + me.Eng1.epr.setValue(0); me.Eng1.egt = 0; me.Eng1.ff = 0; } if (powered2 or powerup or me.Eng2.eng2Off.getValue()) { if (me.Modes.n1Mode2.getValue() == 0) { - me.Eng2.epr = 1; + me.Eng2.epr.setValue(1); } else { - me.Eng2.epr = 0; + me.Eng2.epr.setValue(0); } me.Eng2.egt = 1; me.Eng2.ff = 1; } else { - me.Eng2.epr = 0; + me.Eng2.epr.setValue(0); me.Eng2.egt = 0; me.Eng2.ff = 0; } @@ -180,15 +180,15 @@ var FADEC = { N22 = pts.Engines.Engine.n2Actual[1].getValue(); if (powered1 and N11 >= 3.5) { - me.Eng1.n1 = 1; + me.Eng1.n1.setValue(1); } else { - me.Eng1.n1 = 0; + me.Eng1.n1.setValue(0); } if (powered2 and N12 >= 3.5) { - me.Eng2.n1 = 1; + me.Eng2.n1.setValue(1); } else { - me.Eng2.n1 = 0; + me.Eng2.n1.setValue(0); } if (powered1 and N21 >= 3.5) { From 5adce22c68e725717c6439daa17b9e7ca3060f21 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 31 Oct 2020 21:47:46 +0000 Subject: [PATCH 19/33] Fix potential bug in QRH, fix bug in simbrief parser --- Nasal/FMGC/SimbriefParser.nas | 6 +++++- Nasal/QRH/QRH.nas | 6 +++--- Nasal/Systems/Comm/Notification.nas | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index f5f1cfe1..792df12e 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -80,8 +80,11 @@ var SimbriefParser = { if (departures != nil and size(departures) != 0 and destinations != nil and size(destinations) != 0) { fmgc.flightPlanController.flightplans[3].departure = departures[0]; fmgc.flightPlanController.flightplans[3].destination = destinations[0]; - fmgc.FMGCInternal.arrApt = destinationID; fmgc.FMGCInternal.depApt = departureID; + fmgc.FMGCInternal.arrApt = destinationID; + + atsu.ATISInstances[0].newStation(departureID); + atsu.ATISInstances[1].newStation(destinationID); fmgc.FMGCInternal.toFromSet = 1; fmgc.FMGCNodes.toFromSet.setValue(1); @@ -107,6 +110,7 @@ var SimbriefParser = { var alternates = findAirportsByICAO(alternateID); if (alternates != nil and size(alternates) != 0) { fmgc.FMGCInternal.altAirport = alternateID; + atsu.ATISInstances[2].newStation(alternateID); fmgc.FMGCInternal.altAirportSet = 1; } diff --git a/Nasal/QRH/QRH.nas b/Nasal/QRH/QRH.nas index 73fc21df..93a41692 100644 --- a/Nasal/QRH/QRH.nas +++ b/Nasal/QRH/QRH.nas @@ -37,7 +37,7 @@ var createCanvasQRH = func() { qrhCanvas.setLayout(myHBox); QRH = canvas.gui.widgets.Label.new(root, canvas.style, {} ) - .setImage("Aircraft/A320-family/Models/FlightDeck/QRH/" ~ QRHpageNo.getValue() ~ ".jpeg") + .setImage(resolvepath("Aircraft/A320-family/Models/FlightDeck/QRH/" ~ QRHpageNo.getValue() ~ ".jpeg")) .move(0,-25) .setSize(400,625); myHBox.addItem(QRH); @@ -78,11 +78,11 @@ var createCanvasQRH = func() { }); buttonPrev.listen("clicked", func { prevPage(); - QRH.setImage("Aircraft/A320-family/Models/FlightDeck/QRH/" ~ QRHpageNo.getValue() ~ ".jpeg"); + QRH.setImage(resolvepath("Aircraft/A320-family/Models/FlightDeck/QRH/" ~ QRHpageNo.getValue() ~ ".jpeg")); }); buttonNext.listen("clicked", func { nextPage(); - QRH.setImage("Aircraft/A320-family/Models/FlightDeck/QRH/" ~ QRHpageNo.getValue() ~ ".jpeg"); + QRH.setImage(resolvepath("Aircraft/A320-family/Models/FlightDeck/QRH/" ~ QRHpageNo.getValue() ~ ".jpeg")); }); diff --git a/Nasal/Systems/Comm/Notification.nas b/Nasal/Systems/Comm/Notification.nas index 339c6d74..c87f6305 100644 --- a/Nasal/Systems/Comm/Notification.nas +++ b/Nasal/Systems/Comm/Notification.nas @@ -330,7 +330,7 @@ var ATIS = { }, processATIS: func(r, i) { var raw = r.response; - if (r.response == "FBW_ERROR: D-ATIS not available at this airport") { + if (r.response == "FBW_ERROR: D-ATIS not available at this airport" or find("atis not avail",r.response) != -1) { me.received = 0; me.sent = 0; mcdu.mcdu_message(i,"NO D-ATIS AVAILABLE"); From 46a1c7411d209da6b351ce3e03d9c517532eaaa0 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 31 Oct 2020 23:59:18 +0000 Subject: [PATCH 20/33] New altitude alerter (should be more reliable, in JSBSim.) --- Nasal/ECAM/ECAM-controller.nas | 5 +- Nasal/ECAM/ECAM-logic.nas | 66 ++---------- Nasal/ECAM/ECAM-phases.nas | 4 +- Systems/a320-fwc.xml | 184 +++++++++++++++++++++++++++++++++ Systems/ecam-proprules.xml | 139 +++++++------------------ 5 files changed, 235 insertions(+), 163 deletions(-) diff --git a/Nasal/ECAM/ECAM-controller.nas b/Nasal/ECAM/ECAM-controller.nas index 263030fa..378b67b9 100644 --- a/Nasal/ECAM/ECAM-controller.nas +++ b/Nasal/ECAM/ECAM-controller.nas @@ -15,7 +15,7 @@ var overflow = props.globals.initNode("/ECAM/warnings/overflow", 0, "BOOL"); var dc_ess = props.globals.getNode("/systems/electrical/bus/dc-ess", 1); var lights = [props.globals.initNode("/ECAM/warnings/master-warning-light", 0, "BOOL"), props.globals.initNode("/ECAM/warnings/master-caution-light", 0, "BOOL")]; -var aural = [props.globals.initNode("/sim/sound/warnings/crc", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/chime", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/cricket", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/retard", 0, "BOOL")]; +var aural = [props.globals.initNode("/sim/sound/warnings/crc", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/chime", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/cricket", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/retard", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/cchord", 0, "BOOL")]; var warningFlash = props.globals.initNode("/ECAM/warnings/master-warning-flash", 0, "BOOL"); var lineIndex = 0; @@ -31,6 +31,9 @@ var storeFirstWarning = nil; var warningNodes = { Logic: { + altitudeAlert: props.globals.initNode("/ECAM/warnings/altitude-alert/c-chord"), + altitudeAlertSteady: props.globals.initNode("/ECAM/warnings/altitude-alert/altitude-alert-steady"), + altitudeAlertFlash: props.globals.initNode("/ECAM/warnings/altitude-alert/altitude-alert-flash"), crossbleedFault: props.globals.initNode("/ECAM/warnings/logic/crossbleed-fault"), crossbleedWai: props.globals.initNode("/ECAM/warnings/logic/crossbleed-wai"), bleed1LoTempUnsuc: props.globals.initNode("/ECAM/warnings/logic/bleed-1-lo-temp-unsucc"), diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 5f12161e..e1d11200 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -696,78 +696,24 @@ var messages_priority_3 = func { } # C-Chord - if ((pts.Instrumentation.Altimeter.std.getValue() and abs(fcu.altSet.getValue() - getprop("/systems/navigation/adr/output/baro-alt-1-capt")) < 200) or !pts.Instrumentation.Altimeter.std.getValue() and abs(fcu.altSet.getValue() - getprop("/systems/navigation/adr/output/baro-alt-corrected-1-capt")) < 200) { - alt200 = 1; - } else { - alt200 = 0; - } - - if ((pts.Instrumentation.Altimeter.std.getValue() and abs(fcu.altSet.getValue() - getprop("/systems/navigation/adr/output/baro-alt-1-capt")) < 750) or !pts.Instrumentation.Altimeter.std.getValue() and abs(fcu.altSet.getValue() - getprop("/systems/navigation/adr/output/baro-alt-corrected-1-capt")) < 750) { - alt750 = 1; - } else { - alt750 = 0; - } - - if (FWC.altChg.getValue() or pts.Gear.position[0].getValue() == 1 or (pts.Controls.Gear.gearDown.getValue() and pts.Fdm.JSBsim.Fcs.slatDeg.getValue() > 4) or fmgc.Output.vert.getValue() == 2) { - altAlertInhibit = 1; - } else { - altAlertInhibit = 0; - } - - if (alt750 and !alt200 and !altAlertInhibit) { - FWC.Monostable.altAlert2.setValue(1); - } else { - FWC.Monostable.altAlert2.setValue(0); - } - - if ((!fcu.ap1.getBoolValue() and !fcu.ap2.getBoolValue()) and FWC.Monostable.altAlert2.getValue()) { - FWC.Monostable.altAlert1.setValue(1); - } else { - FWC.Monostable.altAlert1.setValue(0); - } - - if (alt750 and alt200 and !altAlertInhibit) { - setprop("/ECAM/flipflop/alt-alert-2-rs-set", 1); - } else { - setprop("/ECAM/flipflop/alt-alert-2-rs-set", 0); - } - - if (getprop("/ECAM/flipflop/alt-alert-rs-reset") or (!alt750 and !alt200 and !altAlertInhibit)) { - setprop("/ECAM/flipflop/alt-alert-2-rs-reset", 1); - } else { - setprop("/ECAM/flipflop/alt-alert-2-rs-reset", 0); - } - - if (alt750 and !alt200 and !altAlertInhibit and getprop("/ECAM/flipflop/alt-alert-2-rs-output")) { - setprop("/ECAM/flipflop/alt-alert-3-rs-set", 1); - } else { - setprop("/ECAM/flipflop/alt-alert-3-rs-set", 0); - } - - if ((!alt750 and !alt200 and !altAlertInhibit and getprop("/ECAM/flipflop/alt-alert-rs-output")) or (!alt750 and !alt200 and !altAlertInhibit and getprop("/ECAM/flipflop/alt-alert-3-rs-output")) or getprop("/ECAM/flipflop/alt-alert-3-rs-set")) { - bigThree = 1; - } else { - bigThree = 0; - } - - if (FWC.Timer.gnd.getValue() != 1 and (FWC.Monostable.altAlert1Output.getValue() or bigThree)) { + if (warningNodes.Logic.altitudeAlert.getValue()) { if (!getprop("/sim/sound/warnings/cchord-inhibit")) { - setprop("/sim/sound/warnings/cchord", 1); + aural[4].setValue(1); } else { - setprop("/sim/sound/warnings/cchord", 0); + aural[4].setValue(0); } } else { - setprop("/sim/sound/warnings/cchord", 0); + aural[4].setValue(0); setprop("/sim/sound/warnings/cchord-inhibit", 0); } - if (FWC.Timer.gnd.getValue() != 1 and getprop("/ECAM/flipflop/alt-alert-3-rs-set") != 1 and alt750 and !alt200 and !altAlertInhibit) { + if (warningNodes.Logic.altitudeAlertSteady.getValue()) { altAlertSteady = 1; } else { altAlertSteady = 0; } - if (FWC.Timer.gnd.getValue() != 1 and bigThree) { + if (warningNodes.Logic.altitudeAlertFlash.getValue()) { altAlertFlash = 1; } else { altAlertFlash = 0; diff --git a/Nasal/ECAM/ECAM-phases.nas b/Nasal/ECAM/ECAM-phases.nas index 81a670ce..cdb0310e 100644 --- a/Nasal/ECAM/ECAM-phases.nas +++ b/Nasal/ECAM/ECAM-phases.nas @@ -65,12 +65,12 @@ var FWC = { eng1or2Output: props.globals.initNode("/ECAM/phases/timer/eng1or2-output", 0, "INT"), toInhibitOutput: props.globals.getNode("/ECAM/phases/timer/to-inhibit-output"), ldgInhibitOutput: props.globals.getNode("/ECAM/phases/timer/ldg-inhibit-output"), - gnd: props.globals.getNode("/ECAM/timer/ground-calc"), + gnd: props.globals.getNode("/ECAM/timer/ground-calc"), # ZGND gnd2Sec: props.globals.getNode("/ECAM/phases/monostable/gnd-output"), }, speed80: props.globals.initNode("/ECAM/phases/speed-gt-80", 0, "BOOL"), toPower: props.globals.initNode("/ECAM/phases/to-power-set", 0, "BOOL"), - altChg: props.globals.getNode("it-autoflight/input/alt-is-changing", 1), + altChg: props.globals.getNode("/it-autoflight/input/alt-is-changing", 1), }; var phaseLoop = func() { diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml index 579c39d5..67ca2c19 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -2378,4 +2378,188 @@ + + + + + + /it-autoflight/input/alt-is-changing eq 1 + + + /gear/gear[1]/position-norm ge 0.99 + /gear/gear[2]/position-norm ge 0.99 + + + /controls/gear/gear-down eq 1 + /fdm/jsbsim/fcs/slat-pos-deg ge 4 + + + /it-autoflight/output/lat eq 4 + /it-autoflight/output/vert eq 2 + /it-autoflight/output/vert eq 6 + + + + + + + + /instrumentation/altimeter[0]/std + + + /systems/navigation/adr/output/baro-alt-corrected-1-capt + /it-autoflight/input/alt + + + + + /systems/navigation/adr/output/baro-alt-1-capt + /it-autoflight/input/alt + + + + + + + + + + /ECAM/warnings/altitude-alert/altitude-difference le 200 + + + + + + + /ECAM/warnings/altitude-alert/altitude-difference le 750 + + + + + + + /ECAM/warnings/altitude-alert/altInhibit eq 0 + /ECAM/warnings/altitude-alert/alt200 eq 1 + /ECAM/warnings/altitude-alert/alt750 eq 1 + + + + + + + /ECAM/warnings/altitude-alert/altInhibit eq 0 + /ECAM/warnings/altitude-alert/alt200 eq 0 + /ECAM/warnings/altitude-alert/alt750 eq 1 + + + + + + + /ECAM/warnings/altitude-alert/altInhibit eq 0 + /ECAM/warnings/altitude-alert/alt200 eq 0 + /ECAM/warnings/altitude-alert/alt750 eq 0 + + + + + + + /ECAM/warnings/altitude-alert/big-3-1-off eq 1 + + + + + + + /ECAM/warnings/altitude-alert/big-3-all-off eq 1 + /ECAM/warnings/altitude-alert/flipflop-2-reset eq 1 + + + + + + + /ECAM/warnings/altitude-alert/big-3-2-off eq 1 + + + + + + + + /ECAM/warnings/altitude-alert/gear-downlocked-set eq 1 + /ECAM/warnings/altitude-alert/gear-downlocked-output eq 1 + + /ECAM/warnings/altitude-alert/alt-is-changing eq 1 + + + + + + + /ECAM/warnings/altitude-alert/big-3-2-off eq 1 + /ECAM/warnings/altitude-alert/flipflop-1 eq 1 + + + + + + + /ECAM/warnings/altitude-alert/big-3-all-off eq 1 + /ECAM/warnings/altitude-alert/flipflop-2 eq 1 + + + + + + + /ECAM/warnings/altitude-alert/flipflop-or-1 eq 1 + /ECAM/warnings/altitude-alert/flipflop-or-2 eq 1 + + + + + + + /it-autoflight/output/ap1 eq 0 + /it-autoflight/output/ap2 eq 0 + /ECAM/warnings/altitude-alert/big-3-2-off eq 1 + + + + + + + /ECAM/timer/ground-calc ne 1 + + + /ECAM/warnings/altitude-alert/monostable-autopilot eq 1 + /ECAM/warnings/altitude-alert/monostable-autopilot-output eq 1 + + /ECAM/warnings/altitude-alert/flipflop-or eq 1 + + + + + + + + /ECAM/timer/ground-calc ne 1 + /ECAM/warnings/altitude-alert/big-3-2-off eq 1 + /ECAM/warnings/altitude-alert/flipflop-or-1 eq 0 + + + + + + + + /ECAM/timer/ground-calc ne 1 + /ECAM/warnings/altitude-alert/flipflop-or eq 1 + + + + + diff --git a/Systems/ecam-proprules.xml b/Systems/ecam-proprules.xml index 167de57c..660862f6 100644 --- a/Systems/ecam-proprules.xml +++ b/Systems/ecam-proprules.xml @@ -239,44 +239,6 @@ ECAM/buttons/recall-status-normal-output - - SR - - ECAM/altitude-alert-monostable-set - - - ECAM/altitude-alert-monostable-intermediate-output - - ECAM/altitude-alert-monostable-flipflop-intermediate - - - - monostable - true - - - ECAM/altitude-alert-monostable-flipflop-intermediate - - ECAM/altitude-alert-monostable-intermediate-output - - - - gain - 1.0 - - - - ECAM/altitude-alert-monostable-flipflop-intermediate - ECAM/altitude-alert-monostable-intermediate-output - - - 1 - - ECAM/altitude-alert-monostable-output - - derivative it-autoflight/input/alt @@ -292,10 +254,12 @@ it-autoflight/input/alt-is-changing - ECAM/alt-is-changing + ECAM/warnings/altitude-alert/alt-is-changing + gain + 1 @@ -314,7 +278,7 @@ 0 - ECAM/gear-downlocked-set + ECAM/warnings/altitude-alert/gear-downlocked-set @@ -323,67 +287,9 @@ 1 - ECAM/gear-downlocked-set + ECAM/warnings/altitude-alert/gear-downlocked-set - ECAM/gear-downlocked-output - - - - - gain - 1.0 - - - - ECAM/gear-downlocked-output1 - ECAM/alt-is-changing1 - - - 1 - - - - - ECAM/gear-downlocked-output0 - ECAM/alt-is-changing0 - - - 0 - - ECAM/flipflop/alt-alert-rs-reset - - - - RS - - ECAM/flipflop/altitude-alert-rs-set - - - ECAM/flipflop/alt-alert-rs-reset - - ECAM/flipflop/alt-alert-rs-output - - - - RS - - ECAM/flipflop/alt-alert-2-rs-set - - - ECAM/flipflop/alt-alert-2-rs-reset - - ECAM/flipflop/alt-alert-2-rs-output - - - - RS - - ECAM/flipflop/alt-alert-3-rs-set - - - ECAM/flipflop/alt-alert-rs-reset - - ECAM/flipflop/alt-alert-3-rs-output + ECAM/warnings/altitude-alert/gear-downlocked-output @@ -1069,4 +975,37 @@ /ECAM/warnings/logic/green-yellow-press-on-monostable + + RS + + /ECAM/warnings/altitude-alert/flipflop-1-set + + + /ECAM/warnings/altitude-alert/flipflop-1-reset + + /ECAM/warnings/altitude-alert/flipflop-1 + + + + RS + + /ECAM/warnings/altitude-alert/flipflop-2-set + + + /ECAM/warnings/altitude-alert/flipflop-2-reset + + /ECAM/warnings/altitude-alert/flipflop-2 + + + + monostable + + + /ECAM/warnings/altitude-alert/monostable-autopilot + + /ECAM/warnings/altitude-alert/monostable-autopilot-output + + From ce8df0eb5e3f8a4f2a5c6eb63999092769af90a6 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 1 Nov 2020 21:03:48 +0000 Subject: [PATCH 21/33] Remove extra part on A320 PFD --- Models/Instruments/PFD/res/pfd.svg | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 6aaff09f..5be2191d 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -37,13 +37,13 @@ units="pt" inkscape:snap-global="false" showguides="true" - inkscape:current-layer="AI_group" + inkscape:current-layer="svg2" inkscape:window-maximized="1" inkscape:window-y="-8" inkscape:window-x="-8" - inkscape:cy="0.92547661" - inkscape:cx="575.94271" - inkscape:zoom="1.0773413" + inkscape:cy="259.23779" + inkscape:cx="201.84998" + inkscape:zoom="2.56" showgrid="true" id="namedview371" inkscape:window-height="705" @@ -5780,8 +5780,8 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path922" - d="M 13.167811,790.62913 H 154.46853" - style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.19995;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + d="M 13.167811,790.62913 H 121.24725" + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.19994998;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> Date: Sun, 1 Nov 2020 23:06:00 +0000 Subject: [PATCH 22/33] Bugfix reverser 1 display --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index d5a005c5..00bdfe9c 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -871,9 +871,9 @@ var canvas_upperECAM = { } if (val.reverser_1 >= 0.95) { - me["REV2"].setColor(0.0509,0.7529,0.2941); + me["REV1"].setColor(0.0509,0.7529,0.2941); } else { - me["REV2"].setColor(0.7333,0.3803,0); + me["REV1"].setColor(0.7333,0.3803,0); } }, updateFadecN1Power2: func(val) { From 469c7ad171940a2468d39ff0844bc8d7364f90e5 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 2 Nov 2020 17:51:31 +0000 Subject: [PATCH 23/33] Improve FWC phase switching, such that some weird behaviours are gone (like flickering from 4 to 6 to 5 on rotation) + its more efficient due to JSBSIM --- Nasal/ECAM/ECAM-logic.nas | 2 +- Nasal/ECAM/ECAM-phases.nas | 72 ++++-------------- Systems/a320-aircond.xml | 6 +- Systems/a320-fwc-phases.xml | 148 ++++++++++++++++++++++++++++++++++-- Systems/a320-fwc.xml | 15 +--- Systems/ecam-proprules.xml | 23 +++++- 6 files changed, 187 insertions(+), 79 deletions(-) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index e1d11200..fa2c5a26 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -2355,7 +2355,7 @@ var messages_memo = func { if ((phaseVarMemo2 == 1 or phaseVarMemo2 == 2) and toMemoLine1.active != 1 and ldgMemoLine1.active != 1 and (systems.ADIRS.ADIRunits[0].inAlign == 1 or systems.ADIRS.ADIRunits[1].inAlign == 1 or systems.ADIRS.ADIRunits[2].inAlign == 1)) { irs_in_align.active = 1; - if (getprop("/ECAM/phases/timer/eng1or2-output")) { + if (FWC.Timer.eng1or2Output.getValue()) { irs_in_align.colour = "a"; } else { irs_in_align.colour = "g"; diff --git a/Nasal/ECAM/ECAM-phases.nas b/Nasal/ECAM/ECAM-phases.nas index cdb0310e..baa5ca52 100644 --- a/Nasal/ECAM/ECAM-phases.nas +++ b/Nasal/ECAM/ECAM-phases.nas @@ -2,19 +2,14 @@ # Copyright (c) 2019 Jonathan Redpath (legoboyvdlp) -var twoEngOff = 0; var myPhase = nil; var eng = nil; var eng1epr = nil; var eng2epr = nil; var eng1n1 = nil; var eng2n1 = nil; -var eng1n2 = nil; -var eng2n2 = nil; -var eprlim = nil; var master1 = nil; var master2 = nil; -var n1lim = nil; var gear_agl_cur = nil; var FWC = { @@ -53,23 +48,27 @@ var FWC = { Logic: { gnd: props.globals.getNode("/ECAM/ground-calc-immediate"), IRSinAlign: props.globals.initNode("/ECAM/irs-in-align", 0, "BOOL"), + feet1500: props.globals.getNode("/ECAM/phases/phase-calculation/altitude-ge-1500"), + feet800: props.globals.getNode("/ECAM/phases/phase-calculation/altitude-ge-800"), }, Timer: { - eng1idle: props.globals.initNode("/ECAM/phases/timer/eng1idle", 0, "INT"), - eng2idle: props.globals.initNode("/ECAM/phases/timer/eng2idle", 0, "INT"), - eng1or2: props.globals.initNode("/ECAM/phases/timer/eng1or2", 0, "INT"), + eng1idle: props.globals.getNode("/ECAM/phases/timer/eng1idle"), + eng2idle: props.globals.getNode("/ECAM/phases/timer/eng2idle"), + eng1or2: props.globals.getNode("/ECAM/phases/phase-calculation/one-engine-running"), toInhibit: props.globals.initNode("/ECAM/phases/timer/to-inhibit", 0, "INT"), ldgInhibit: props.globals.initNode("/ECAM/phases/timer/ldg-inhibit", 0, "INT"), eng1idleOutput: props.globals.getNode("/ECAM/phases/timer/eng1idle-output"), eng2idleOutput: props.globals.getNode("/ECAM/phases/timer/eng2idle-output"), - eng1or2Output: props.globals.initNode("/ECAM/phases/timer/eng1or2-output", 0, "INT"), + eng1and2Off: props.globals.getNode("/ECAM/phases/phase-calculation/engines-1-2-not-running"), + eng1or2Output: props.globals.getNode("/ECAM/phases/phase-calculation/engine-1-or-2-running"), toInhibitOutput: props.globals.getNode("/ECAM/phases/timer/to-inhibit-output"), ldgInhibitOutput: props.globals.getNode("/ECAM/phases/timer/ldg-inhibit-output"), gnd: props.globals.getNode("/ECAM/timer/ground-calc"), # ZGND gnd2Sec: props.globals.getNode("/ECAM/phases/monostable/gnd-output"), + gnd2SecHalf: props.globals.getNode("/ECAM/phases/monostable/gnd-output-2"), # hack to prevent getting confused between phase 5 / 6 }, speed80: props.globals.initNode("/ECAM/phases/speed-gt-80", 0, "BOOL"), - toPower: props.globals.initNode("/ECAM/phases/to-power-set", 0, "BOOL"), + toPower: props.globals.getNode("/ECAM/phases/phase-calculation/takeoff-power"), altChg: props.globals.getNode("/it-autoflight/input/alt-is-changing", 1), }; @@ -82,53 +81,12 @@ var phaseLoop = func() { eng2epr = pts.Engines.Engine.eprActual[1].getValue(); eng1n1 = pts.Engines.Engine.n1Actual[0].getValue(); eng2n1 = pts.Engines.Engine.n1Actual[1].getValue(); - eng1n2 = pts.Engines.Engine.n2Actual[0].getValue(); - eng2n2 = pts.Engines.Engine.n2Actual[1].getValue(); master1 = pts.Controls.Engines.Engine.cutoffSw[0].getBoolValue(); master2 = pts.Controls.Engines.Engine.cutoffSw[1].getBoolValue(); FWC.Flipflop.recallReset.setValue(0); # Various things - if (eng1n2 >= 59.4 and !master1) { - FWC.Timer.eng1idle.setValue(1); - } else { - FWC.Timer.eng1idle.setValue(0); - } - - if (eng2n2 >= 59.4 and !master2) { - FWC.Timer.eng2idle.setValue(1); - } else { - FWC.Timer.eng2idle.setValue(0); - } - - if (eng1n2 >= 59.4 or eng2n2 >= 59.4) { - FWC.Timer.eng1or2.setValue(1); - } else { - FWC.Timer.eng1or2.setValue(0); - } - - if ((FWC.Timer.eng1idleOutput.getBoolValue() == 0 or master1) and (FWC.Timer.eng2idleOutput.getBoolValue() == 0 or master2)) { - twoEngOff = 1; - } else { - twoEngOff = 0; - } - - if (eng == "IAE") { - eprlim = getprop("/controls/engines/epr-limit"); - if ((!pts.Controls.Engines.Engine.reverser[0].getBoolValue() and !pts.Controls.Engines.Engine.reverser[1].getBoolValue()) and (((pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.78 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.779) and fadec.Thrust.limFlex.getBoolValue()) or (pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.99 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.99))) { - FWC.toPower.setBoolValue(1); - } else { - FWC.toPower.setBoolValue(0); - } - } else { - n1lim = getprop("/controls/engines/n1-limit"); - if ((!pts.Controls.Engines.Engine.reverser[0].getBoolValue() and !pts.Controls.Engines.Engine.reverser[1].getBoolValue()) and (((pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.78 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.779) and fadec.Thrust.limFlex.getBoolValue()) or (pts.Controls.Engines.Engine.throttle[0].getValue() >= 0.99 or pts.Controls.Engines.Engine.throttle[1].getValue() >= 0.99))) { - FWC.toPower.setBoolValue(1); - } else { - FWC.toPower.setBoolValue(0); - } - } if (myPhase == 9) { FWC.Monostable.phase9.setBoolValue(1); @@ -149,7 +107,7 @@ var phaseLoop = func() { FWC.Flipflop.phase10Reset.setBoolValue(0); } - if ((FWC.Logic.gnd.getBoolValue() and twoEngOff and myPhase == 9) and FWC.Flipflop.phase10Output.getBoolValue()) { + if ((FWC.Logic.gnd.getBoolValue() and FWC.Timer.eng1and2Off.getValue() and myPhase == 9) and FWC.Flipflop.phase10Output.getBoolValue()) { FWC.Monostable.phase1.setBoolValue(1); # true for 300 sec then false } else { FWC.Monostable.phase1.setBoolValue(0); @@ -171,21 +129,21 @@ var phaseLoop = func() { gear_agl_cur = pts.Position.gearAglFt.getValue(); # Phase 5 monostable - if (FWC.toPower.getBoolValue() and (gear_agl_cur <= 1500 and !FWC.Logic.gnd.getBoolValue() and FWC.Timer.gnd2Sec.getValue() != 1)) { + if (FWC.toPower.getBoolValue() and (!FWC.Logic.feet1500.getBoolValue() and !FWC.Logic.gnd.getBoolValue() and FWC.Timer.gnd2Sec.getValue() != 1)) { FWC.Monostable.phase5.setBoolValue(1); } else { FWC.Monostable.phase5.setBoolValue(0); } # Phase 7 monostable - if (!FWC.toPower.getBoolValue() and gear_agl_cur <= 1500 and gear_agl_cur <= 800 and !FWC.Logic.gnd.getBoolValue() and FWC.Timer.gnd2Sec.getValue() != 1) { + if (!FWC.toPower.getBoolValue() and !FWC.Logic.feet1500.getBoolValue() and !FWC.Logic.feet800.getBoolValue() and !FWC.Logic.gnd.getBoolValue() and FWC.Timer.gnd2Sec.getValue() != 1) { FWC.Monostable.phase7.setBoolValue(1); } else { FWC.Monostable.phase7.setBoolValue(0); } # Actual Phases - if ((!FWC.Logic.gnd.getBoolValue() and FWC.Timer.gnd2Sec.getValue() != 1 and twoEngOff and myPhase != 9) and !FWC.Monostable.phase1Output.getBoolValue()) { + if ((!FWC.Logic.gnd.getBoolValue() and FWC.Timer.gnd2Sec.getValue() != 1 and FWC.Timer.eng1and2Off.getValue() and myPhase != 9) and !FWC.Monostable.phase1Output.getBoolValue()) { setPhase(1); } @@ -205,7 +163,7 @@ var phaseLoop = func() { setPhase(5); } - if (!FWC.Logic.gnd.getValue() and FWC.Timer.gnd2Sec.getValue() != 1 and !(FWC.Monostable.phase5.getBoolValue() and FWC.Monostable.phase5Output.getBoolValue()) and !(FWC.Monostable.phase7.getBoolValue() and FWC.Monostable.phase7Output.getBoolValue())) { + if (!FWC.Logic.gnd.getValue() and FWC.Timer.gnd2SecHalf.getValue() != 1 and (!FWC.Monostable.phase5.getBoolValue() or !FWC.Monostable.phase5Output.getBoolValue()) and (!FWC.Monostable.phase7.getBoolValue() or !FWC.Monostable.phase7Output.getBoolValue())) { setPhase(6); } @@ -221,7 +179,7 @@ var phaseLoop = func() { setPhase(9); } - if ((FWC.Logic.gnd.getBoolValue() and twoEngOff and myPhase == 9) and FWC.Monostable.phase1Output.getBoolValue()) { + if ((FWC.Logic.gnd.getBoolValue() and FWC.Timer.eng1and2Off.getValue() and myPhase == 9) and FWC.Monostable.phase1Output.getBoolValue()) { setPhase(10); } diff --git a/Systems/a320-aircond.xml b/Systems/a320-aircond.xml index 0f74d621..4c481df9 100644 --- a/Systems/a320-aircond.xml +++ b/Systems/a320-aircond.xml @@ -466,7 +466,7 @@ /gear/gear[1]/wow eq 1 /systems/air-conditioning/landing-switch eq 1 /velocities/airspeed-kt lt 70 - /ECAM/phases/to-power-set ne 1 + /ECAM/phases/phase-calculation/takeoff-power ne 1 @@ -474,7 +474,7 @@ /gear/gear[1]/wow eq 1 - /ECAM/phases/to-power-set eq 1 + /ECAM/phases/phase-calculation/takeoff-power eq 1 /gear/gear[1]/wow eq 1 @@ -507,7 +507,7 @@ /gear/gear[1]/wow eq 1 - /ECAM/phases/to-power-set eq 1 + /ECAM/phases/phase-calculation/takeoff-power eq 1 /gear/gear[1]/wow eq 1 diff --git a/Systems/a320-fwc-phases.xml b/Systems/a320-fwc-phases.xml index dceae541..f2e78d6a 100644 --- a/Systems/a320-fwc-phases.xml +++ b/Systems/a320-fwc-phases.xml @@ -12,6 +12,19 @@ 120 1 + + + /ECAM/phases/phase-calculation/one-engine-running + 120 + 0.03333333333 + + + + /ECAM/phases/monostable/phase-1-300 + 0.00333333333 + 120 + + @@ -80,12 +93,6 @@ - - /ECAM/phases/monostable/phase-1-300 - 0.00333333333 - 120 - - @@ -93,6 +100,135 @@ /ECAM/phases/monostable/phase-1-300 eq 1 + + + + + /position/gear-agl-ft ge 1500 + + + + + + + /ECAM/phases/phase-calculation/altitude-ge-1500 eq 1 + + + + + + + /position/gear-agl-ft lt 800 + + + + + + + + + + /engines/engine[0]/n2 ge 59.4 + /controls/engines/engine[0]/cutoff-switch eq 0 + + + + + + + /engines/engine[1]/n2 ge 59.4 + /controls/engines/engine[1]/cutoff-switch eq 0 + + + + + + + + /ECAM/phases/timer/eng1idle-output eq 0 + /controls/engines/engine[0]/cutoff-switch eq 1 + + + /ECAM/timer/ground-calc eq 1 + /ECAM/phases/timer/eng1idle eq 0 + + + + + + + + + /ECAM/phases/timer/eng2idle-output eq 0 + /controls/engines/engine[1]/cutoff-switch eq 1 + + + /ECAM/timer/ground-calc eq 1 + /ECAM/phases/timer/eng2idle eq 0 + + + + + + + + /ECAM/phases/phase-calculation/engine-1-off eq 1 + /ECAM/phases/phase-calculation/engine-2-off eq 1 + + + + + + + /engines/engine[0]/state eq 3 + /engines/engine[1]/state eq 3 + + + + + + + + + /controls/engines/engine[0]/throttle ge 0.779 + /systems/thrust/lim-flex eq 1 + + + /controls/engines/engine[0]/throttle ge 0.99 + /systems/thrust/lim-flex eq 0 + + + + + /controls/engines/engine[1]/throttle ge 0.779 + /systems/thrust/lim-flex eq 1 + + + /controls/engines/engine[1]/throttle ge 0.99 + /systems/thrust/lim-flex eq 0 + + + + + + + /ECAM/phases/phase-calculation/takeoff-power-logic + 120 + 0.01666666666 + + + + + + /ECAM/phases/phase-calculation/takeoff-power-logic eq 1 + + /ECAM/phases/phase-calculation/takeoff-power-timer ne 0 + /ECAM/phases/phase-calculation/altitude-ge-1500 eq 0 + /controls/engines/engine[0]/throttle ge 0.599 + /controls/engines/engine[1]/throttle ge 0.599 + + + diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml index 67ca2c19..d3467929 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -20,13 +20,6 @@ 0.033 - - Timer for the ECAM system - /ECAM/phases/timer/eng1or2 - 120 - 0.033 - - Timer for the ECAM system /ECAM/phases/timer/to-inhibit @@ -1804,7 +1797,7 @@ /controls/engines/engine[0]/throttle-lever ge 0.13333333333 - /ECAM/phases/to-power-set eq 0 + /ECAM/phases/phase-calculation/takeoff-power eq 0 @@ -1857,7 +1850,7 @@ /controls/engines/engine[1]/throttle-lever ge 0.13333333333 - /ECAM/phases/to-power-set eq 0 + /ECAM/phases/phase-calculation/takeoff-power eq 0 @@ -2062,7 +2055,7 @@ /instrumentation/radar-altimeter[0]/radar-altitude-ft lt 750 /instrumentation/radar-altimeter[1]/radar-altitude-ft lt 750 - /ECAM/phases/to-power-set eq 0 + /ECAM/phases/phase-calculation/takeoff-power eq 0 fcs/slat-pos-deg gt 16 fcs/flap-pos-deg gt 18 @@ -2098,7 +2091,7 @@ /instrumentation/radar-altimeter[0]/radar-altitude-ft lt 750 /instrumentation/radar-altimeter[1]/radar-altitude-ft lt 750 - /ECAM/phases/to-power-set eq 0 + /ECAM/phases/phase-calculation/takeoff-power eq 0 /gear/gear[0]/position-norm ne 1 /gear/gear[1]/position-norm ne 1 diff --git a/Systems/ecam-proprules.xml b/Systems/ecam-proprules.xml index 660862f6..ac9e1af3 100644 --- a/Systems/ecam-proprules.xml +++ b/Systems/ecam-proprules.xml @@ -203,6 +203,17 @@ ECAM/phases/monostable/gnd-output + + monostable + + + /ECAM/ground-calc-immediate + + ECAM/phases/monostable/gnd-output-2 + + monostable - ECAM/phases/to-power-set + ECAM/phases/phase-calculation/takeoff-power ECAM/phases/monostable/to-power-set-output @@ -1008,4 +1019,14 @@ /ECAM/warnings/altitude-alert/monostable-autopilot-output + + RS + + /ECAM/phases/phase-calculation/altitude-flipflop-set + + + /ECAM/phases/phase-calculation/altitude-flipflop-reset + + /ECAM/phases/phase-calculation/altitude-ge-800 + From 48d5a2526016bf40b9186b5d053e3ae8b9f2d5ef Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 2 Nov 2020 20:37:43 +0000 Subject: [PATCH 24/33] Map not aligned, somewhat working --- .../ND/canvas/framework/navdisplay.nas | 4 +- Models/Instruments/ND/canvas/style.nas | 81 ++++++++++++++++--- 2 files changed, 71 insertions(+), 14 deletions(-) diff --git a/Models/Instruments/ND/canvas/framework/navdisplay.nas b/Models/Instruments/ND/canvas/framework/navdisplay.nas index 3f90cf80..6115d8a4 100644 --- a/Models/Instruments/ND/canvas/framework/navdisplay.nas +++ b/Models/Instruments/ND/canvas/framework/navdisplay.nas @@ -433,7 +433,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec me.symbols.selHdgLine2.setRotation(hdgBugRot); } - var staPtrVis = !me.in_mode("toggle_display_mode", ["PLAN"]); + var staPtrVis = (!me.in_mode("toggle_display_mode", ["PLAN"]) and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))); if((me.in_mode("toggle_display_mode", ["MAP"]) and me.get_switch("toggle_display_type") == "CRT") or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD")) { @@ -459,7 +459,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec var adf1hdg = getprop("/instrumentation/adf[1]/indicated-bearing-deg"); if(!me.get_switch("toggle_centered")) { - if(me.in_mode("toggle_display_mode", ["PLAN"])) + if(me.in_mode("toggle_display_mode", ["PLAN"]) or (systems.ADIRS.ADIRunits[0].aligned != 1 and (systems.ADIRS.ADIRunits[2].aligned != 1 or att_switch.getValue() == 0))) me.symbols.trkInd.hide(); else me.symbols.trkInd.show(); diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index 26b2437a..66b21de3 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -7,6 +7,8 @@ var ALWAYS = func 1; var NOTHING = func nil; +var att_switch = props.globals.getNode("/controls/switching/ATTHDG", 1); + canvas.NDStyles["Airbus"] = { font_mapper: func(family, weight) { if( family == "Liberation Sans" and weight == "normal" ) @@ -517,7 +519,7 @@ canvas.NDStyles["Airbus"] = { missed_constraint_color: [1,0.57,0.14] }, predicate: func(nd, layer) { - var visible= (nd.in_mode("toggle_display_mode", ["MAP","PLAN"])); + var visible= (nd.in_mode("toggle_display_mode", ["MAP","PLAN"]) and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))); layer.group.setVisible( visible ); if (visible) { layer.toggle_cstr = nd.get_switch("toggle_cstr"); @@ -593,7 +595,7 @@ canvas.NDStyles["Airbus"] = { always_update: 1, update_on:["toggle_display_mode"], predicate: func(nd, layer) { - var visible = nd.get_switch("toggle_display_mode") == "PLAN"; + var visible = (nd.get_switch("toggle_display_mode") == "PLAN" and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))); layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -671,6 +673,24 @@ canvas.NDStyles["Airbus"] = { is_false: func(nd) nd.symbols.compass_mask_ctr.hide(), } }, + { + id: "nd_warn_memo", + impl: { + init: func(nd, symbol), + predicate: ALWAYS, + is_true: func(nd) nd.symbols.nd_warn_memo.hide(), + is_false: func(nd), + }, + }, + { + id: "nd_warn_msgbox", + impl: { + init: func(nd, symbol), + predicate: ALWAYS, + is_true: func(nd) nd.symbols.nd_warn_msgbox.hide(), + is_false: func(nd), + }, + }, { # TODO: taOnly doesn"t need to use getprop polling in update(), use a listener instead! id: "taOnly", # the SVG ID @@ -900,11 +920,42 @@ canvas.NDStyles["Airbus"] = { is_false: func(nd) {},#nd.symbols.gs.hide(), }, }, + { + id:"unavailARC", + impl: { + init: func(nd,symbol), + common: func(nd), + predicate: func(nd) (!nd.get_switch("toggle_centered") and nd.get_switch("toggle_display_mode") != "PLAN" + and (systems.ADIRS.ADIRunits[0].aligned != 1 and (systems.ADIRS.ADIRunits[2].aligned != 1 or att_switch.getValue() == 0))), + is_true: func(nd) { + nd.symbols.unavailARC.show(); + }, + is_false: func(nd) { + nd.symbols.unavailARC.hide(); + }, + }, + }, + { + id:"unavailNAV", + impl: { + init: func(nd,symbol), + common: func(nd), + predicate: func(nd) (nd.get_switch("toggle_centered") + and (systems.ADIRS.ADIRunits[0].aligned != 1 and (systems.ADIRS.ADIRunits[2].aligned != 1 or att_switch.getValue() == 0))), + is_true: func(nd) { + nd.symbols.unavailNAV.show(); + }, + is_false: func(nd) { + nd.symbols.unavailNAV.hide(); + }, + }, + }, { id:"compass", impl: { init: func(nd,symbol), - predicate: func(nd) (!nd.get_switch("toggle_centered") and nd.get_switch("toggle_display_mode") != "PLAN"), + predicate: func(nd) (!nd.get_switch("toggle_centered") and nd.get_switch("toggle_display_mode") != "PLAN" + and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), is_true: func(nd) { nd.symbols.compass.setRotation(-nd.userHdgTrk*D2R); nd.symbols.compass.show() @@ -916,7 +967,8 @@ canvas.NDStyles["Airbus"] = { id:"compassApp", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch("toggle_centered") and nd.get_switch("toggle_display_mode") != "PLAN"), + predicate: func(nd) (nd.get_switch("toggle_centered") and nd.get_switch("toggle_display_mode") != "PLAN" + and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), is_true: func(nd) { nd.symbols.compassApp.setRotation(-nd.userHdgTrk*D2R); nd.symbols.compassApp.show() @@ -928,7 +980,7 @@ canvas.NDStyles["Airbus"] = { id:"northUp", impl: { init: func(nd,symbol), - predicate: func(nd) nd.get_switch("toggle_display_mode") == "PLAN", + predicate: func(nd) (nd.get_switch("toggle_display_mode") == "PLAN" and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), is_true: func(nd) nd.symbols.northUp.show(), is_false: func(nd) nd.symbols.northUp.hide(), }, # of northUp.impl @@ -937,7 +989,8 @@ canvas.NDStyles["Airbus"] = { id:"planArcs", impl: { init: func(nd,symbol), - predicate: func(nd) ((nd.in_mode("toggle_display_mode", ["APP","VOR","PLAN"])) or ((nd.get_switch("toggle_display_mode") == "MAP") and (nd.get_switch("toggle_centered")))), + predicate: func(nd) (((nd.in_mode("toggle_display_mode", ["APP","VOR","PLAN"])) or ((nd.get_switch("toggle_display_mode") == "MAP") and (nd.get_switch("toggle_centered")))) + and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), is_true: func(nd) nd.symbols.planArcs.show(), is_false: func(nd) nd.symbols.planArcs.hide(), }, # of planArcs.impl @@ -946,7 +999,8 @@ canvas.NDStyles["Airbus"] = { id:"rangeArcs", impl: { init: func(nd,symbol), - predicate: func(nd) ((nd.get_switch("toggle_display_mode") == "MAP") and (!nd.get_switch("toggle_centered"))), + predicate: func(nd) ((nd.get_switch("toggle_display_mode") == "MAP") and (!nd.get_switch("toggle_centered")) + and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), is_true: func(nd) nd.symbols.rangeArcs.show(), is_false: func(nd) nd.symbols.rangeArcs.hide(), }, # of rangeArcs.impl @@ -1047,7 +1101,8 @@ canvas.NDStyles["Airbus"] = { id:"aplSymMap", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered")), + predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered") + and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), is_true: func(nd) { nd.symbols.aplSymMap.set("z-index", 10); nd.symbols.aplSymMap.show(); @@ -1060,7 +1115,8 @@ canvas.NDStyles["Airbus"] = { id:"aplSymMapCtr", impl: { init: func(nd,symbol), - predicate: func(nd) ((nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered")) or nd.in_mode("toggle_display_mode", ["APP","VOR"])), + predicate: func(nd) (((nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered")) or nd.in_mode("toggle_display_mode", ["APP","VOR"])) + and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), is_true: func(nd) { nd.symbols.aplSymMapCtr.set("z-index", 10); nd.symbols.aplSymMapCtr.show(); @@ -1157,8 +1213,8 @@ canvas.NDStyles["Airbus"] = { id:"trkInd2", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR","MAP"]) and - nd.get_switch("toggle_centered")), + predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR","MAP"]) and nd.get_switch("toggle_centered") + and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), is_true: func(nd) { nd.symbols.trkInd2.show(); nd.symbols.trkInd2.setRotation((nd.aircraft_source.get_trk_mag()-nd.aircraft_source.get_hdg_mag())*D2R); @@ -1172,7 +1228,8 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered") and - getprop(nd.options.defaults.lat_ctrl) != nd.options.defaults.managed_val), + getprop(nd.options.defaults.lat_ctrl) != nd.options.defaults.managed_val and + (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), is_true: func(nd) { nd.symbols.trkline2.show(); }, From 9a982768031e724f9a09d3fc459df1d37a38743e Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 5 Nov 2020 20:58:25 +0000 Subject: [PATCH 25/33] Now works --- Models/Instruments/ND/canvas/ND.nas | 6 ++ .../ND/canvas/framework/navdisplay.nas | 5 +- Models/Instruments/ND/canvas/style.nas | 55 ++++++++++++++----- Nasal/Systems/ADIRS/ADR.nas | 4 ++ 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/Models/Instruments/ND/canvas/ND.nas b/Models/Instruments/ND/canvas/ND.nas index 170fd04b..809943de 100644 --- a/Models/Instruments/ND/canvas/ND.nas +++ b/Models/Instruments/ND/canvas/ND.nas @@ -63,6 +63,7 @@ var myCockpit_switches = { "toggle_chrono": {path: "/inputs/CHRONO", value: 0, type: "INT"}, "toggle_xtrk_error": {path: "/nd/xtrk-error", value: 0, type: "BOOL"}, "toggle_trk_line": {path: "/nd/trk-line", value: 0, type: "BOOL"}, + "ADIRS3": {path: "/nd/ir-3", value: 0, type: "BOOL"}, }; var canvas_nd_base = { @@ -186,6 +187,8 @@ var canvas_ND_1 = { # here we make the ND: me.NDCpt = ND.new("instrumentation/efis", myCockpit_switches, "Airbus"); + me.NDCpt.attitude_heading_setting = -1; + me.NDCpt.adirs_property = props.globals.getNode("/instrumentation/efis[0]/nd/ir-1",1); me.NDCpt.newMFD(canvas_group); me.NDCpt.update(); @@ -205,7 +208,10 @@ var canvas_ND_2 = { m.init(canvas_group); # here we make the ND: + myCockpit_switches["ADIRS"]= {path: "/nd/ir-2", value: 0, type: "BOOL"}; me.NDFo = ND.new("instrumentation/efis[1]", myCockpit_switches, "Airbus"); + me.NDFo.attitude_heading_setting = 1; + me.NDFo.adirs_property = props.globals.getNode("/instrumentation/efis[1]/nd/ir-2",1); me.NDFo.newMFD(canvas_group); me.NDFo.update(); diff --git a/Models/Instruments/ND/canvas/framework/navdisplay.nas b/Models/Instruments/ND/canvas/framework/navdisplay.nas index b0f46311..bb489686 100644 --- a/Models/Instruments/ND/canvas/framework/navdisplay.nas +++ b/Models/Instruments/ND/canvas/framework/navdisplay.nas @@ -11,6 +11,7 @@ var _MP_dbg_lvl = canvas._MP_dbg_lvl; var assert_m = canvas.assert_m; var wxr_live_tree = "/instrumentation/wxr"; +var adirs_3 = props.globals.getNode("/instrumentation/efis[0]/nd/ir-3", 1); canvas.NavDisplay.set_switch = func(s, v) { var switch = me.efis_switches[s]; @@ -433,7 +434,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec me.symbols.selHdgLine2.setRotation(hdgBugRot); } - var staPtrVis = (!me.in_mode("toggle_display_mode", ["PLAN"]) and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))); + var staPtrVis = (!me.in_mode("toggle_display_mode", ["PLAN"]) and (me.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == me.attitude_heading_setting))); if((me.in_mode("toggle_display_mode", ["MAP"]) and me.get_switch("toggle_display_type") == "CRT") or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD")) { @@ -459,7 +460,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec var adf1hdg = getprop("/instrumentation/adf[1]/indicated-bearing-deg"); if(!me.get_switch("toggle_centered")) { - if(me.in_mode("toggle_display_mode", ["PLAN"]) or (systems.ADIRS.ADIRunits[0].aligned != 1 and (systems.ADIRS.ADIRunits[2].aligned != 1 or att_switch.getValue() == 0))) + if(me.in_mode("toggle_display_mode", ["PLAN"]) or (me.adirs_property.getValue() != 1 and (adirs_3.getValue() != 1 or att_switch.getValue() != me.attitude_heading_setting))) me.symbols.trkInd.hide(); else me.symbols.trkInd.show(); diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index 66b21de3..1eb6b840 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -8,6 +8,7 @@ var ALWAYS = func 1; var NOTHING = func nil; var att_switch = props.globals.getNode("/controls/switching/ATTHDG", 1); +var adirs_3 = props.globals.getNode("/instrumentation/efis[0]/nd/ir-3", 1); canvas.NDStyles["Airbus"] = { font_mapper: func(family, weight) { @@ -519,7 +520,7 @@ canvas.NDStyles["Airbus"] = { missed_constraint_color: [1,0.57,0.14] }, predicate: func(nd, layer) { - var visible= (nd.in_mode("toggle_display_mode", ["MAP","PLAN"]) and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))); + var visible= (nd.in_mode("toggle_display_mode", ["MAP","PLAN"]) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))); layer.group.setVisible( visible ); if (visible) { layer.toggle_cstr = nd.get_switch("toggle_cstr"); @@ -595,7 +596,7 @@ canvas.NDStyles["Airbus"] = { always_update: 1, update_on:["toggle_display_mode"], predicate: func(nd, layer) { - var visible = (nd.get_switch("toggle_display_mode") == "PLAN" and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))); + var visible = (nd.get_switch("toggle_display_mode") == "PLAN" and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))); layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -920,13 +921,41 @@ canvas.NDStyles["Airbus"] = { is_false: func(nd) {},#nd.symbols.gs.hide(), }, }, + { + id:"nd_warn_hdg", + impl: { + init: func(nd,symbol), + common: func(nd), + predicate: func(nd) (nd.adirs_property.getValue() != 1 and (adirs_3.getValue() != 1 or att_switch.getValue() != nd.attitude_heading_setting)), + is_true: func(nd) { + nd.symbols.nd_warn_hdg.show(); + }, + is_false: func(nd) { + nd.symbols.nd_warn_hdg.hide(); + }, + }, + }, + { + id:"nd_warn_map", + impl: { + init: func(nd,symbol), + common: func(nd), + predicate: func(nd) (nd.adirs_property.getValue() != 1 and (adirs_3.getValue() != 1 or att_switch.getValue() != nd.attitude_heading_setting)), + is_true: func(nd) { + nd.symbols.nd_warn_map.show(); + }, + is_false: func(nd) { + nd.symbols.nd_warn_map.hide(); + }, + }, + }, { id:"unavailARC", impl: { init: func(nd,symbol), common: func(nd), predicate: func(nd) (!nd.get_switch("toggle_centered") and nd.get_switch("toggle_display_mode") != "PLAN" - and (systems.ADIRS.ADIRunits[0].aligned != 1 and (systems.ADIRS.ADIRunits[2].aligned != 1 or att_switch.getValue() == 0))), + and (nd.adirs_property.getValue() != 1 and (adirs_3.getValue() != 1 or att_switch.getValue() != nd.attitude_heading_setting))), is_true: func(nd) { nd.symbols.unavailARC.show(); }, @@ -941,7 +970,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), common: func(nd), predicate: func(nd) (nd.get_switch("toggle_centered") - and (systems.ADIRS.ADIRunits[0].aligned != 1 and (systems.ADIRS.ADIRunits[2].aligned != 1 or att_switch.getValue() == 0))), + and (nd.adirs_property.getValue() != 1 and (adirs_3.getValue() != 1 or att_switch.getValue() != nd.attitude_heading_setting))), is_true: func(nd) { nd.symbols.unavailNAV.show(); }, @@ -955,7 +984,7 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) (!nd.get_switch("toggle_centered") and nd.get_switch("toggle_display_mode") != "PLAN" - and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), + and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) { nd.symbols.compass.setRotation(-nd.userHdgTrk*D2R); nd.symbols.compass.show() @@ -968,7 +997,7 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) (nd.get_switch("toggle_centered") and nd.get_switch("toggle_display_mode") != "PLAN" - and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), + and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) { nd.symbols.compassApp.setRotation(-nd.userHdgTrk*D2R); nd.symbols.compassApp.show() @@ -980,7 +1009,7 @@ canvas.NDStyles["Airbus"] = { id:"northUp", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch("toggle_display_mode") == "PLAN" and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), + predicate: func(nd) (nd.get_switch("toggle_display_mode") == "PLAN" and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) nd.symbols.northUp.show(), is_false: func(nd) nd.symbols.northUp.hide(), }, # of northUp.impl @@ -990,7 +1019,7 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) (((nd.in_mode("toggle_display_mode", ["APP","VOR","PLAN"])) or ((nd.get_switch("toggle_display_mode") == "MAP") and (nd.get_switch("toggle_centered")))) - and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), + and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) nd.symbols.planArcs.show(), is_false: func(nd) nd.symbols.planArcs.hide(), }, # of planArcs.impl @@ -1000,7 +1029,7 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) ((nd.get_switch("toggle_display_mode") == "MAP") and (!nd.get_switch("toggle_centered")) - and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), + and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) nd.symbols.rangeArcs.show(), is_false: func(nd) nd.symbols.rangeArcs.hide(), }, # of rangeArcs.impl @@ -1102,7 +1131,7 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered") - and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), + and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) { nd.symbols.aplSymMap.set("z-index", 10); nd.symbols.aplSymMap.show(); @@ -1116,7 +1145,7 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) (((nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered")) or nd.in_mode("toggle_display_mode", ["APP","VOR"])) - and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), + and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) { nd.symbols.aplSymMapCtr.set("z-index", 10); nd.symbols.aplSymMapCtr.show(); @@ -1214,7 +1243,7 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR","MAP"]) and nd.get_switch("toggle_centered") - and (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), + and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) { nd.symbols.trkInd2.show(); nd.symbols.trkInd2.setRotation((nd.aircraft_source.get_trk_mag()-nd.aircraft_source.get_hdg_mag())*D2R); @@ -1229,7 +1258,7 @@ canvas.NDStyles["Airbus"] = { predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered") and getprop(nd.options.defaults.lat_ctrl) != nd.options.defaults.managed_val and - (systems.ADIRS.ADIRunits[0].aligned == 1 or (systems.ADIRS.ADIRunits[2].aligned == 1 and att_switch.getValue() == -1))), + (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) { nd.symbols.trkline2.show(); }, diff --git a/Nasal/Systems/ADIRS/ADR.nas b/Nasal/Systems/ADIRS/ADR.nas index b97f0bf8..623bb520 100644 --- a/Nasal/Systems/ADIRS/ADR.nas +++ b/Nasal/Systems/ADIRS/ADR.nas @@ -7,6 +7,8 @@ var _NUMADIRU = 3; var _selfTestTime = nil; +var ADIRSnodesND = [props.globals.getNode("/instrumentation/efis[0]/nd/ir-1", 1),props.globals.getNode("/instrumentation/efis[1]/nd/ir-2", 1),props.globals.getNode("/instrumentation/efis[0]/nd/ir-3", 1)]; + var ADIRU = { # local vars _alignTime: 0, @@ -110,6 +112,7 @@ var ADIRU = { print("Stopping alignment or setting unaligned state"); me.inAlign = 0; me.aligned = 0; + ADIRSnodesND[me.num].setValue(0); ADIRS.Operating.aligned[me.num].setValue(0); if (me.alignTimer != nil) { me.alignTimer.stop(); @@ -118,6 +121,7 @@ var ADIRU = { stopAlignAligned: func() { me.inAlign = 0; me.aligned = 1; + ADIRSnodesND[me.num].setValue(1); ADIRS.Operating.aligned[me.num].setValue(1); if (me.alignTimer != nil) { me.alignTimer.stop(); From d7c297a0b7377dc917927d71fb5c64e7d64826de Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 7 Nov 2020 01:22:06 +0000 Subject: [PATCH 26/33] Emesary IESI --- Models/Instruments/IESI/IESI.nas | 461 ++++++++++--------- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 5 +- 2 files changed, 236 insertions(+), 230 deletions(-) diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index 47563c50..c3494ca7 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -2,147 +2,172 @@ # Copyright (c) 2020 Josh Davidson (Octal450) -var IESI = nil; -var IESI_display = nil; -var elapsedtime = 0; +var elapsed_seconds = 0; var ASI = 0; var alt = 0; -var altTens = 0; var airspeed_act = 0; var mach_act = 0; # props.nas nodes var iesi_init = props.globals.initNode("/instrumentation/iesi/iesi-init", 0, "BOOL"); var iesi_reset = props.globals.initNode("/instrumentation/iesi/att-reset", 0, "DOUBLE"); -var iesi_brt = props.globals.getNode("/controls/lighting/DU/iesi", 1); -var iesi_rate = props.globals.getNode("/systems/acconfig/options/iesi-rate", 1); -var et = props.globals.getNode("/sim/time/elapsed-sec", 1); -var aconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); - -var airspeed = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-speed-kt", 1); -var mach = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-mach", 1); -var pitch = props.globals.getNode("/instrumentation/iesi/pitch-deg", 1); -var skid = props.globals.getNode("/instrumentation/iesi/slip-skid", 1); -var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1); -var altitude_ind = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft-pfd", 1); - -var altimeter_mode = props.globals.getNode("/instrumentation/altimeter[0]/std", 1); -var qnh_hpa = props.globals.getNode("/instrumentation/altimeter/setting-hpa", 1); -var qnh_inhg = props.globals.getNode("/instrumentation/altimeter/setting-inhg", 1); var _showIESI = 0; var _fast = 0; var _IESITime = 0; -var canvas_IESI_base = { - init: func(canvas_group, file) { - var font_mapper = func(family, weight) { +var canvas_IESI = { + new: func(svg, name) { + var obj = {parents: [canvas_IESI] }; + obj.canvas = canvas.new({ + "name": "IESI", + "size": [1024, 1024], + "view": [1024, 1024], + "mipmapping": 1, + }); + + obj.canvas.addPlacement({"node": "iesi.screen"}); + obj.group = obj.canvas.createGroup(); + + obj.font_mapper = func(family, weight) { return "LiberationFonts/LiberationSans-Regular.ttf"; }; - canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); - - var svg_keys = me.getKeys(); - foreach(var key; svg_keys) { - me[key] = canvas_group.getElementById(key); - var svg_keys = me.getKeys(); + canvas.parsesvg(obj.group, svg, {"font-mapper": obj.font_mapper} ); + foreach(var key; obj.getKeys()) { + obj[key] = obj.group.getElementById(key); + + var clip_el = obj.group.getElementById(key ~ "_clip"); + if (clip_el != nil) { + clip_el.setVisible(0); + var tran_rect = clip_el.getTransformedBounds(); - foreach (var key; svg_keys) { - me[key] = canvas_group.getElementById(key); - - var clip_el = canvas_group.getElementById(key ~ "_clip"); - if (clip_el != nil) { - clip_el.setVisible(0); - var tran_rect = clip_el.getTransformedBounds(); - - var clip_rect = sprintf("rect(%d,%d, %d,%d)", - tran_rect[1], # 0 ys - tran_rect[2], # 1 xe - tran_rect[3], # 2 ye - tran_rect[0]); #3 xs - # coordinates are top,right,bottom,left (ys, xe, ye, xs) ref: l621 of simgear/canvas/CanvasElement.cxx - me[key].set("clip", clip_rect); - me[key].set("clip-frame", canvas.Element.PARENT); - } + var clip_rect = sprintf("rect(%d,%d, %d,%d)", + tran_rect[1], + tran_rect[2], + tran_rect[3], + tran_rect[0]); + obj[key].set("clip", clip_rect); + obj[key].set("clip-frame", canvas.Element.PARENT); } - } + }; + obj.AI_horizon_trans = obj["AI_horizon"].createTransform(); + obj.AI_horizon_rot = obj["AI_horizon"].createTransform(); - me.AI_horizon_trans = me["AI_horizon"].createTransform(); - me.AI_horizon_rot = me["AI_horizon"].createTransform(); + obj.middleAltOffset = nil; + + obj.update_items = [ + props.UpdateManager.FromHashValue("airspeed", 0.5, func(val) { + # Subtract 30, since the scale starts at 30, but don't allow less than 0, or more than 520 knots + if (val <= 30) { + ASI = 0; + } else if (val >= 520) { + ASI = 490; + } else { + ASI = val - 30; + } + obj["ASI_scale"].setTranslation(0, ASI * 8.295); + }), + props.UpdateManager.FromHashList(["altitude","altitude_ind"], nil, func(val) { + if (val.altitude > 50000) { + val.altitude = 50000; + } elsif (val.altitude < -2000) { + val.altitude = -2000; + } + + if (val.altitude < 0) { + obj["negText"].show(); + obj["negText2"].show(); + } else { + obj["negText"].hide(); + obj["negText2"].hide(); + } + + obj.altOffset = (val.altitude / 500) - int(val.altitude / 500); + obj.middleAltText = roundaboutAlt(val.altitude / 100); + if (obj.altOffset > 0.5) { + obj.middleAltOffset = -(obj.altOffset - 1) * 258.5528; + } else { + obj.middleAltOffset = -obj.altOffset * 258.5528; + } + + obj["ALT_scale"].setTranslation(0, -obj.middleAltOffset); + obj["ALT_scale"].update(); + obj["ALT_five"].setText(sprintf("%03d", abs(obj.middleAltText+10))); + obj["ALT_four"].setText(sprintf("%03d", abs(obj.middleAltText+5))); + obj["ALT_three"].setText(sprintf("%03d", abs(obj.middleAltText))); + obj["ALT_two"].setText(sprintf("%03d", abs(obj.middleAltText-5))); + obj["ALT_one"].setText(sprintf("%03d", abs(obj.middleAltText-10))); + + + if (val.altitude < 0 and val.altitude_ind > 20) { + val.altitude_ind = 20; + } elsif (val.altitude > 0 and val.altitude_ind > 500) { + val.altitude_ind = 500; + } + + obj["ALT_digits"].setText(sprintf("%s", val.altitude_ind)); + obj["ALT_meters"].setText(sprintf("%5.0f", math.round(val.altitude * 0.3048, 10))); + obj.altTens = num(right(sprintf("%02d", val.altitude), 2)); + obj["ALT_tens"].setTranslation(0, obj.altTens * 3.16); + }), + props.UpdateManager.FromHashValue("mach", 0.5, func(val) { + if (val >= 0.5) { + obj._machWasAbove50 = 1; + obj["ASI_mach_decimal"].show(); + obj["ASI_mach"].show(); + } elsif (val >= 0.45 and obj._machWasAbove50) { + obj["ASI_mach_decimal"].show(); + obj["ASI_mach"].show(); + } else { + obj._machWasAbove50 = 0; + obj["ASI_mach_decimal"].hide(); + obj["ASI_mach"].hide(); + } + + if (val >= 0.999) { + obj["ASI_mach"].setText("99"); + } else { + obj["ASI_mach"].setText(sprintf("%2.0f", val * 100)); + } + }), + props.UpdateManager.FromHashValue("pitch", nil, func(val) { + obj.AI_horizon_trans.setTranslation(0, val * 16.74); + }), + props.UpdateManager.FromHashValue("roll", nil, func(val) { + obj.AI_horizon_rot.setRotation(-val * D2R, obj["AI_center"].getCenter()); + obj["AI_bank"].setRotation(-val * D2R); + }), + props.UpdateManager.FromHashValue("skid", nil, func(val) { + obj["AI_slipskid"].setTranslation(val, 0); + }), + props.UpdateManager.FromHashList(["altimeter_mode","qnh_hpa","qnh_inhg"], nil, func(val) { + obj.updateQNH(val); + }), + ]; _showIESI = 0; _fast = 0; _IESITime = 0.0; + obj._cachedInhg = nil; - me.page = canvas_group; - - return me; - }, - getKeys: func() { - return []; - }, - update: func() { - cur_time = et.getValue(); - # todo consider relay 7XB for power of DC HOT 1 - # todo transient max 0.2s - # todo 20W power consumption - if (iesi_reset.getValue() == 1) { - if (iesi_init.getBoolValue() and _IESITime + 90 >= et.getValue()) { - _fast = 1; - } else { - _fast = 0; - } - iesi_init.setBoolValue(0); - } - - if (systems.ELEC.Bus.dcEss.getValue() >= 25 or (systems.ELEC.Bus.dcHot1.getValue() >= 25 and airspeed.getValue() >= 50 and cur_time >= 5)) { - _showIESI = 1; - IESI.update(); - - if (aconfig.getValue() != 1 and iesi_init.getValue() != 1) { - iesi_init.setBoolValue(1); - if (_fast) { - _IESITime = cur_time - 80; - _fast = 0; - } else { - _IESITime = cur_time; - } - } else if (aconfig.getValue() == 1 and iesi_init.getValue() != 1) { - iesi_init.setBoolValue(1); - _IESITime = cur_time - 87; - } - } else { - _showIESI = 0; - iesi_init.setBoolValue(0); - } - - if (_showIESI and iesi_brt.getValue() > 0.01) { - IESI.page.show(); - } else { - IESI.page.hide(); - } - }, -}; - -var canvas_IESI = { - new: func(canvas_group, file) { - var m = {parents: [canvas_IESI, canvas_IESI_base]}; - m.init(canvas_group, file); - m._cachedInhg = -99; - m._machWasAbove50 = 0; - m._roll = 0; - return m; - }, + return obj; + }, getKeys: func() { return ["IESI","IESI_Init","ASI_scale","ASI_mach","ASI_mach_decimal","AI_center","AI_horizon","AI_bank","AI_slipskid","ALT_scale","ALT_one","ALT_two","ALT_three","ALT_four","ALT_five","ALT_digits","ALT_tens","ALT_meters","QNH_setting","QNH_std","negText","negText2","AI_bank_scale"]; }, - update: func() { - if (qnh_inhg.getValue() != me._cachedInhg) { - me._cachedInhg = qnh_inhg.getValue(); - me.updateQNH(); + update: func(notification) { + if (notification.qnh_inhg != me._cachedInhg) { + me._cachedInhg = notification.qnh_inhg; + me.updateQNH(notification); } - if (_IESITime + 90 >= et.getValue()) { + me.updatePower(notification); + if (me.group.getVisible() == 0) { + return; + } + + if (_IESITime + 90 >= notification.elapsed_seconds) { me["IESI"].hide(); me["IESI_Init"].show(); return; @@ -151,137 +176,119 @@ var canvas_IESI = { me["IESI"].show(); } - # Airspeed - # Subtract 30, since the scale starts at 30, but don't allow less than 0, or more than 520 knots - airspeed_act = airspeed.getValue(); - mach_act = mach.getValue(); - if (airspeed_act <= 30) { - ASI = 0; - } else if (airspeed_act >= 520) { - ASI = 490; - } else { - ASI = airspeed_act - 30; - } - me["ASI_scale"].setTranslation(0, ASI * 8.295); - - if (mach_act >= 0.5) { - me._machWasAbove50 = 1; - me["ASI_mach_decimal"].show(); - me["ASI_mach"].show(); - } elsif (mach_act >= 0.45 and me._machWasAbove50) { - me["ASI_mach_decimal"].show(); - me["ASI_mach"].show(); - } else { - me._machWasAbove50 = 0; - me["ASI_mach_decimal"].hide(); - me["ASI_mach"].hide(); - } - - if (mach_act >= 0.999) { - me["ASI_mach"].setText("99"); - } else { - me["ASI_mach"].setText(sprintf("%2.0f", mach_act * 100)); - } - - # Attitude - me._roll = pts.Orientation.roll.getValue(); - me.AI_horizon_trans.setTranslation(0, pitch.getValue() * 16.74); - me.AI_horizon_rot.setRotation(-me._roll * D2R, me["AI_center"].getCenter()); - - me["AI_slipskid"].setTranslation(skid.getValue(), 0); - me["AI_bank"].setRotation(-me._roll * D2R); - - # Altitude - me.altitude = altitude.getValue(); - if (me.altitude > 50000) { - me.altitude = 50000; - } elsif (me.altitude < -2000) { - me.altitude = -2000; - } - - if (me.altitude < 0) { - me["negText"].show(); - me["negText2"].show(); - } else { - me["negText"].hide(); - me["negText2"].hide(); - } - - me.altOffset = me.altitude / 500 - int(me.altitude / 500); - me.middleAltText = roundaboutAlt(me.altitude / 100); - me.middleAltOffset = nil; - if (me.altOffset > 0.5) { - me.middleAltOffset = -(me.altOffset - 1) * 258.5528; - } else { - me.middleAltOffset = -me.altOffset * 258.5528; - } - me["ALT_scale"].setTranslation(0, -me.middleAltOffset); - me["ALT_scale"].update(); - me["ALT_five"].setText(sprintf("%03d", abs(me.middleAltText+10))); - me["ALT_four"].setText(sprintf("%03d", abs(me.middleAltText+5))); - me["ALT_three"].setText(sprintf("%03d", abs(me.middleAltText))); - me["ALT_two"].setText(sprintf("%03d", abs(me.middleAltText-5))); - me["ALT_one"].setText(sprintf("%03d", abs(me.middleAltText-10))); - - me.altitudeText = altitude_ind.getValue(); - if (me.altitude < 0 and me.altitudeText > 20) { - me.altitudeText = 20; - } elsif (me.altitude > 0 and me.altitudeText > 500) { - me.altitudeText = 500; - } - - me["ALT_digits"].setText(sprintf("%s", me.altitudeText)); - me["ALT_meters"].setText(sprintf("%5.0f", math.round(me.altitude * 0.3048, 10))); - altTens = num(right(sprintf("%02d", me.altitude), 2)); - me["ALT_tens"].setTranslation(0, altTens * 3.16); + foreach(var update_item; me.update_items) + { + update_item.update(notification); + } }, - updateQNH: func() { - if (altimeter_mode.getBoolValue()) { + updateQNH: func(notification) { + if (notification.altimeter_mode) { me["QNH_setting"].hide(); me["QNH_std"].show(); } else { - me["QNH_setting"].setText(sprintf("%4.0f", qnh_hpa.getValue()) ~ "/" ~ sprintf("%2.2f", qnh_inhg.getValue())); + me["QNH_setting"].setText(sprintf("%4.0f", notification.qnh_hpa) ~ "/" ~ sprintf("%2.2f", notification.qnh_inhg)); me["QNH_setting"].show(); me["QNH_std"].hide(); } - } + }, + updatePower: func(notification) { + # todo consider relay 7XB for power of DC HOT 1 + # todo transient max 0.2s + # todo 20W power consumption + if (notification.attReset == 1) { + if (notification.iesiInit and _IESITime + 90 >= notification.elapsed_seconds) { + _fast = 1; + } else { + _fast = 0; + } + iesi_init.setBoolValue(0); + } + + if (notification.dcEss >= 25 or (notification.dcHot1 >= 25 and notification.airspeed >= 50 and notification.elapsed_seconds >= 5)) { + _showIESI = 1; + if (notification.acconfig != 1 and notification.iesiInit != 1) { + iesi_init.setBoolValue(1); + if (_fast) { + _IESITime = notification.elapsed_seconds - 80; + _fast = 0; + } else { + _IESITime = notification.elapsed_seconds; + } + } else if (notification.acconfig == 1 and notification.iesiInit != 1) { + iesi_init.setBoolValue(1); + _IESITime = notification.elapsed_seconds - 87; + } + } else { + _showIESI = 0; + iesi_init.setBoolValue(0); + } + + if (_showIESI and notification.iesiBrt > 0.01) { + me.group.setVisible(1); + } else { + me.group.setVisible(0); + } + }, }; -setlistener("sim/signals/fdm-initialized", func { - IESI_display = canvas.new({ - "name": "IESI", - "size": [1024, 1024], - "view": [1024, 1024], - "mipmapping": 1 - }); - IESI_display.addPlacement({"node": "iesi.screen"}); - var group_IESI = IESI_display.createGroup(); - - IESI = canvas_IESI.new(group_IESI, "Aircraft/A320-family/Models/Instruments/IESI/res/iesi.svg"); - - IESI.updateQNH(); - - IESI_update.start(); - if (iesi_rate.getValue() > 1) { - rateApply(); - } -}); +var IESIRecipient = +{ + new: func(_ident) + { + var IESIRecipient = emesary.Recipient.new(_ident); + IESIRecipient.MainScreen = nil; + IESIRecipient.Receive = func(notification) + { + if (notification.NotificationType == "FrameNotification") + { + if (IESIRecipient.MainScreen == nil) { + IESIRecipient.MainScreen = canvas_IESI.new("Aircraft/A320-family/Models/Instruments/IESI/res/iesi.svg", "A320 IESI"); + } + + #if (!math.mod(notifications.frameNotification.FrameCount,2)){ + IESIRecipient.MainScreen.update(notification); + #} + return emesary.Transmitter.ReceiptStatus_OK; + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + return IESIRecipient; + }, +}; -setlistener("/instrumentation/altimeter[0]/std", func() { if (IESI != nil) { IESI.updateQNH(); } }, 0, 0); +var A320IESI = IESIRecipient.new("A320 IESI"); +emesary.GlobalTransmitter.Register(A320IESI); -var rateApply = func { - IESI_update.restart(0.05 * iesi_rate.getValue()); +var input = { + "acconfig": "/systems/acconfig/autoconfig-running", + "airspeed": "/instrumentation/airspeed-indicator[0]/indicated-speed-kt", + "altitude": "/instrumentation/altimeter/indicated-altitude-ft", + "altitude_ind": "/instrumentation/altimeter/indicated-altitude-ft-pfd", + "altimeter_mode": "/instrumentation/altimeter[0]/std", + "attReset": "/instrumentation/iesi/att-reset", + "dcEss": "/systems/electrical/bus/dc-ess", + "dcHot1": "/systems/electrical/bus/dc-hot-1", + "iesiBrt": "/controls/lighting/DU/iesi", + "iesiInit": "/instrumentation/iesi/iesi-init", + "mach": "/instrumentation/airspeed-indicator/indicated-mach", + "pitch": "/instrumentation/iesi/pitch-deg", + "qnh_hpa": "/instrumentation/altimeter[0]/setting-hpa", + "qnh_inhg": "/instrumentation/altimeter[0]/setting-inhg", + "roll": "/orientation/roll-deg", + "skid": "/instrumentation/iesi/slip-skid", +}; + +foreach (var name; keys(input)) { + emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 IESI", name, input[name])); } -var IESI_update = maketimer(0.05, func { - canvas_IESI_base.update(); -}); - var showIESI = func { - var dlg = canvas.Window.new([256, 256], "dialog").set("resize", 1); - dlg.setCanvas(IESI_display); + var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); + dlg.setCanvas(A320IESI.MainScreen.canvas); } +setlistener("", func() { if (A320IESI.MainScreen != nil) { A320IESI.MainScreen.updateQNH(notification); } }, 0, 0); + var roundabout = func(x) { var y = x - int(x); return y < 0.5 ? int(x) : 1 + int(x); diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 00bdfe9c..505e5826 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -68,6 +68,7 @@ var canvas_upperECAM = { obj[key].set("clip-frame", canvas.Element.PARENT); } }; + canvas.parsesvg(obj.test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg", {"font-mapper": obj.font_mapper} ); foreach(var key; obj.getKeysTest()) { obj[key] = obj.test.getElementById(key); @@ -451,8 +452,6 @@ var canvas_upperECAM = { obj["ECAMR7"].setFont("LiberationMonoCustom.ttf"); obj["ECAMR8"].setFont("LiberationMonoCustom.ttf"); - obj.page = obj.group; - # cache obj._cachedN1 = [nil, nil]; obj._cachedN2 = [nil, nil]; @@ -1090,7 +1089,7 @@ var showUpperECAM = func { } setlistener("/systems/electrical/bus/ac-ess", func() { - A320EWD.MainScreen.powerTransient(); + if (A320EWD.MainScreen != nil) { A320EWD.MainScreen.powerTransient() } }, 0, 0); var slatLockTimer = maketimer(0.50, func { From 6baf63c35c4f55aeffab27ad45d1be65c8471854 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 7 Nov 2020 13:54:30 +0000 Subject: [PATCH 27/33] Emesary IESI: fix bugs --- Models/Instruments/IESI/IESI.nas | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index c3494ca7..85258f17 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -2,16 +2,11 @@ # Copyright (c) 2020 Josh Davidson (Octal450) -var elapsed_seconds = 0; -var ASI = 0; -var alt = 0; -var airspeed_act = 0; -var mach_act = 0; - # props.nas nodes var iesi_init = props.globals.initNode("/instrumentation/iesi/iesi-init", 0, "BOOL"); var iesi_reset = props.globals.initNode("/instrumentation/iesi/att-reset", 0, "DOUBLE"); +var ASI = 0; var _showIESI = 0; var _fast = 0; var _IESITime = 0; @@ -57,7 +52,7 @@ var canvas_IESI = { obj.middleAltOffset = nil; obj.update_items = [ - props.UpdateManager.FromHashValue("airspeed", 0.5, func(val) { + props.UpdateManager.FromHashValue("airspeed", nil, func(val) { # Subtract 30, since the scale starts at 30, but don't allow less than 0, or more than 520 knots if (val <= 30) { ASI = 0; @@ -111,7 +106,7 @@ var canvas_IESI = { obj.altTens = num(right(sprintf("%02d", val.altitude), 2)); obj["ALT_tens"].setTranslation(0, obj.altTens * 3.16); }), - props.UpdateManager.FromHashValue("mach", 0.5, func(val) { + props.UpdateManager.FromHashValue("mach", nil, func(val) { if (val >= 0.5) { obj._machWasAbove50 = 1; obj["ASI_mach_decimal"].show(); From 7d77279fe66f9dcf81e28c59151f44a74d64ad74 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 7 Nov 2020 14:35:31 +0000 Subject: [PATCH 28/33] Bugfixes, enable ATT HDG switch --- Models/FlightDeck/a320.flightdeck.xml | 59 ++++++++++++++++++++++++++ Models/Instruments/ND/canvas/style.nas | 19 +++++---- Models/Instruments/PFD/PFD.nas | 4 +- Nasal/Libraries/buttons.nas | 4 +- Nasal/Panels/SwitchingPanel.nas | 4 ++ 5 files changed, 78 insertions(+), 12 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index e8944999..915d3d1e 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -6975,6 +6975,65 @@ + + + rotate + ecam_att_hdg + ecam_att_hdg.mark + -30 + controls/navigation/switching/att-hdg + + -0.432428 + -0.067552 + -0.063695 + -0.432195 + -0.067552 + -0.062285 + + + + + pick + ecam_att_hdg + + + + true + + nasal + + + + nasal + + + + + + + true + + nasal + + + + nasal + + + + diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index 1eb6b840..478ae2a0 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -7,7 +7,7 @@ var ALWAYS = func 1; var NOTHING = func nil; -var att_switch = props.globals.getNode("/controls/switching/ATTHDG", 1); +var att_switch = props.globals.getNode("/controls/navigation/switching/att-hdg", 1); var adirs_3 = props.globals.getNode("/instrumentation/efis[0]/nd/ir-3", 1); canvas.NDStyles["Airbus"] = { @@ -455,7 +455,7 @@ canvas.NDStyles["Airbus"] = { update_on:["toggle_range","toggle_display_mode", "toggle_cstr", "toggle_wpt_idx"], predicate: func(nd, layer) { - var visible= (nd.in_mode("toggle_display_mode", ["MAP","PLAN"])); + var visible= (nd.in_mode("toggle_display_mode", ["MAP","PLAN"]) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))); layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -763,7 +763,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg") != nil and getprop("/FMGC/flightplan[2]/active") and - nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), + nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)), is_true: func(nd) { nd.symbols.wpActiveId.setText(getprop("/FMGC/flightplan[2]/current-leg")); nd.symbols.wpActiveId.show(); @@ -777,7 +777,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg") != nil and getprop("/FMGC/flightplan[2]/active") and - nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), + nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)), is_true: func(nd) { #var cur_wp = getprop("/autopilot/route-manager/current-wp"); var deg = nil; @@ -800,9 +800,10 @@ canvas.NDStyles["Airbus"] = { id: "wpActiveDist", impl: { init: func(nd,symbol), - predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg-dist") != nil and + predicate: func(nd) (getprop("/FMGC/flightplan[2]/current-leg-dist") != nil and getprop("/FMGC/flightplan[2]/active") and - nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), + nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]) + and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) { var dst = getprop("/FMGC/flightplan[2]/current-leg-dist"); nd.symbols.wpActiveDist.setText(sprintf("%3.01f",dst)); @@ -815,7 +816,8 @@ canvas.NDStyles["Airbus"] = { id: "wpActiveDistLbl", impl: { init: func(nd,symbol), - predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg-dist") != nil and getprop("/FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), + predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg-dist") != nil and getprop("/FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]) + and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)), is_true: func(nd) { nd.symbols.wpActiveDistLbl.show(); if(getprop("/FMGC/flightplan[2]/current-leg-dist") > 1000) @@ -828,7 +830,8 @@ canvas.NDStyles["Airbus"] = { id: "eta", impl: { init: func(nd,symbol), - predicate: func(nd) getprop("/autopilot/route-manager/wp/eta") != nil and getprop("/FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), + predicate: func(nd) getprop("/autopilot/route-manager/wp/eta") != nil and getprop("/FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]) + and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)), is_true: func(nd) { var etaSec = getprop("/sim/time/utc/day-seconds")+ getprop("/autopilot/route-manager/wp/eta-seconds"); diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index a8a3f641..156f3976 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -109,8 +109,8 @@ var athr = props.globals.getNode("/it-autoflight/output/athr", 1); var gear_agl = props.globals.getNode("/position/gear-agl-ft", 1); var aileron_input = props.globals.getNode("/controls/flight/aileron-input-fast", 1); var elevator_input = props.globals.getNode("/controls/flight/elevator-input-fast", 1); -var att_switch = props.globals.getNode("/controls/switching/ATTHDG", 1); -var air_switch = props.globals.getNode("/controls/switching/AIRDATA", 1); +var att_switch = props.globals.getNode("/controls/navigation/switching/att-hdg", 1); +var air_switch = props.globals.getNode("/controls/navigation/switching/air-data", 1); var appr_enabled = props.globals.getNode("/it-autoflight/output/appr-armed/", 1); var loc_enabled = props.globals.getNode("/it-autoflight/output/loc-armed/", 1); var vert_gs = props.globals.getNode("/it-autoflight/output/vert/", 1); diff --git a/Nasal/Libraries/buttons.nas b/Nasal/Libraries/buttons.nas index edbc2a09..17682b2b 100644 --- a/Nasal/Libraries/buttons.nas +++ b/Nasal/Libraries/buttons.nas @@ -62,8 +62,8 @@ var variousReset = func { setprop("/controls/lighting/DU/mcdu1", 1); setprop("/controls/lighting/DU/mcdu2", 1); setprop("modes/fcu/hdg-time", -45); - setprop("/controls/switching/ATTHDG", 0); - setprop("/controls/switching/AIRDATA", 0); + setprop("/controls/navigation/switching/att-hdg", 0); + setprop("/controls/navigation/switching/air-data", 0); setprop("/controls/switches/no-smoking-sign", 1); setprop("/controls/switches/seatbelt-sign", 1); } diff --git a/Nasal/Panels/SwitchingPanel.nas b/Nasal/Panels/SwitchingPanel.nas index 96066a20..2e2fa280 100644 --- a/Nasal/Panels/SwitchingPanel.nas +++ b/Nasal/Panels/SwitchingPanel.nas @@ -25,6 +25,10 @@ var SwitchingPanel = { dmc.DMController.DMCs[1].changeActiveADIRS(1); } }, + doAttHdg: func(newAttHdg) { + if (newAttHdg < -1 or newAttHdg > 1) { return; } + me.Switches.attHdg.setValue(newAttHdg); + }, doEisDMC: func(newDMC) { if (newDMC < -1 or newDMC > 1) { return; } me.Switches.eisDMC.setValue(newDMC); From 682adfd7b0fe2dcfb4471d725dd32f87b1039616 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 7 Nov 2020 14:50:15 +0000 Subject: [PATCH 29/33] Hide layers when in failed mode --- Models/Instruments/ND/canvas/style.nas | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index 478ae2a0..04bc5a7b 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -89,7 +89,7 @@ canvas.NDStyles["Airbus"] = { predicate: func(nd, layer) { var visible=nd.get_switch("toggle_weather") and nd.get_switch("toggle_weather_live") and - nd.get_switch("toggle_display_mode") != "PLAN"; + nd.get_switch("toggle_display_mode") != "PLAN" and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); layer.group.setVisible(visible); if (visible) { layer.update(); @@ -108,7 +108,7 @@ canvas.NDStyles["Airbus"] = { #print("Running storms predicate"); var visible=nd.get_switch("toggle_weather") and !nd.get_switch("toggle_weather_live") and - nd.get_switch("toggle_display_mode") != "PLAN"; + nd.get_switch("toggle_display_mode") != "PLAN" and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); layer.group.setVisible(visible); if (visible) { #print("storms update requested! (timer issue when closing the dialog?)"); @@ -125,7 +125,7 @@ canvas.NDStyles["Airbus"] = { predicate: func(nd, layer) { var visible = nd.get_switch("toggle_waypoints") and nd.in_mode("toggle_display_mode", ["MAP"]) and - (nd.rangeNm() <= 40); + (nd.rangeNm() <= 40) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); layer.group.setVisible( visible ); if (visible) layer.update(); @@ -154,7 +154,7 @@ canvas.NDStyles["Airbus"] = { isMapStructure: 1, update_on: ["toggle_display_mode","toggle_range",{rate_hz: 2}], predicate: func(nd, layer) { - var visible = nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]);# and nd.get_switch("toggle_fplan"); + var visible = nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -240,7 +240,7 @@ canvas.NDStyles["Airbus"] = { "toggle_display_mode"], predicate: func(nd, layer) { var visible = nd.get_switch("toggle_airports") and - nd.in_mode("toggle_display_mode", ["MAP"]); + nd.in_mode("toggle_display_mode", ["MAP"]) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -263,7 +263,7 @@ canvas.NDStyles["Airbus"] = { # toggle visibility here var visible = nd.get_switch("toggle_vor") and nd.in_mode("toggle_display_mode", ["MAP"]) and - (nd.rangeNm() <= 40); + (nd.rangeNm() <= 40) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -292,7 +292,7 @@ canvas.NDStyles["Airbus"] = { predicate: func(nd, layer) { var visible = nd.get_switch("toggle_dme") and nd.in_mode("toggle_display_mode", ["MAP"]) and - (nd.rangeNm() <= 40); + (nd.rangeNm() <= 40) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); # toggle visibility here layer.group.setVisible( visible ); if (visible) { @@ -325,7 +325,7 @@ canvas.NDStyles["Airbus"] = { predicate: func(nd, layer) { var visible = nd.get_switch("toggle_ndb") and nd.in_mode("toggle_display_mode", ["MAP"]) and - (nd.rangeNm() <= 40); + (nd.rangeNm() <= 40) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); # print("Running vor layer predicate"); # toggle visibility here layer.group.setVisible( visible ); @@ -392,7 +392,6 @@ canvas.NDStyles["Airbus"] = { var visible = nd.get_switch("toggle_traffic"); layer.group.setVisible( visible ); if (visible) { - #print("Updating MapStructure ND layer: TFC"); layer.update(); } }, # end of layer update predicate @@ -403,7 +402,7 @@ canvas.NDStyles["Airbus"] = { update_on:["toggle_range","toggle_display_mode"], predicate: func(nd, layer) { var visible = (nd.rangeNm() <= 40) and - nd.in_mode("toggle_display_mode", ["MAP","PLAN"]) ; + nd.in_mode("toggle_display_mode", ["MAP","PLAN"]) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)) ; layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -423,7 +422,7 @@ canvas.NDStyles["Airbus"] = { always_update: 1, update_on:["toggle_range","toggle_display_mode","toggle_wpt_idx"], predicate: func(nd, layer) { - var visible= nd.in_mode("toggle_display_mode", ["MAP","PLAN"]); + var visible= nd.in_mode("toggle_display_mode", ["MAP","PLAN"]) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -545,7 +544,7 @@ canvas.NDStyles["Airbus"] = { isMapStructure: 1, update_on: ["toggle_display_mode","toggle_range",{rate_hz: 2}], predicate: func(nd, layer) { - var visible = nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]); + var visible = nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -566,7 +565,7 @@ canvas.NDStyles["Airbus"] = { isMapStructure: 1, update_on: ["toggle_display_mode","toggle_range"], predicate: func(nd, layer) { - var visible = nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]); + var visible = nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); layer.group.setVisible( visible ); if (visible) { layer.update(); From 9b45e4d67571f76bc47dd4e494a9c98e869f3b62 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 7 Nov 2020 19:07:55 +0000 Subject: [PATCH 30/33] It was necessary to manually call predicates to update RTE layers --- .../Instruments/ND/canvas/framework/navdisplay.nas | 2 ++ Nasal/Panels/SwitchingPanel.nas | 6 ++++++ Nasal/Systems/ADIRS/ADR.nas | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/Models/Instruments/ND/canvas/framework/navdisplay.nas b/Models/Instruments/ND/canvas/framework/navdisplay.nas index bb489686..81d82153 100644 --- a/Models/Instruments/ND/canvas/framework/navdisplay.nas +++ b/Models/Instruments/ND/canvas/framework/navdisplay.nas @@ -161,6 +161,7 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update var make_event_handler = func(predicate, layer) func predicate(me, layer); me.layers={}; # storage container for all ND specific layers + me.predicates={}; # look up all required layers as specified per the NDStyle hash and do the initial setup for event handling var default_opts = me.options != nil and contains(me.options, "defaults") ? me.options.defaults : nil; foreach(var layer; me.nd_style.layers) { @@ -215,6 +216,7 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update # pass the ND instance and the layer handle to the predicate when it is called # so that it can directly access the ND instance and its own layer (without having to know the layer"s name) var event_handler = make_event_handler(layer.predicate, the_layer); + me.predicates[layer.name] = event_handler; foreach(var event; layer.update_on) { # this handles timers if (typeof(event)=="hash" and contains(event, "rate_hz")) { diff --git a/Nasal/Panels/SwitchingPanel.nas b/Nasal/Panels/SwitchingPanel.nas index 2e2fa280..abc9962b 100644 --- a/Nasal/Panels/SwitchingPanel.nas +++ b/Nasal/Panels/SwitchingPanel.nas @@ -28,6 +28,12 @@ var SwitchingPanel = { doAttHdg: func(newAttHdg) { if (newAttHdg < -1 or newAttHdg > 1) { return; } me.Switches.attHdg.setValue(newAttHdg); + foreach (var predicate; keys(canvas_nd.ND_1.NDCpt.predicates)) { + call(canvas_nd.ND_1.NDCpt.predicates[predicate]); + } + foreach (var predicate; keys(canvas_nd.ND_2.NDFo.predicates)) { + call(canvas_nd.ND_2.NDFo.predicates[predicate]); + } }, doEisDMC: func(newDMC) { if (newDMC < -1 or newDMC > 1) { return; } diff --git a/Nasal/Systems/ADIRS/ADR.nas b/Nasal/Systems/ADIRS/ADR.nas index 623bb520..f00c3b7a 100644 --- a/Nasal/Systems/ADIRS/ADR.nas +++ b/Nasal/Systems/ADIRS/ADR.nas @@ -117,6 +117,12 @@ var ADIRU = { if (me.alignTimer != nil) { me.alignTimer.stop(); } + foreach (var predicate; keys(canvas_nd.ND_1.NDCpt.predicates)) { + call(canvas_nd.ND_1.NDCpt.predicates[predicate]); + } + foreach (var predicate; keys(canvas_nd.ND_2.NDFo.predicates)) { + call(canvas_nd.ND_2.NDFo.predicates[predicate]); + } }, stopAlignAligned: func() { me.inAlign = 0; @@ -126,6 +132,12 @@ var ADIRU = { if (me.alignTimer != nil) { me.alignTimer.stop(); } + foreach (var predicate; keys(canvas_nd.ND_1.NDCpt.predicates)) { + call(canvas_nd.ND_1.NDCpt.predicates[predicate]); + } + foreach (var predicate; keys(canvas_nd.ND_2.NDFo.predicates)) { + call(canvas_nd.ND_2.NDFo.predicates[predicate]); + } }, alignLoop: func() { me._roll = pts.Orientation.roll.getValue(); From a59364f64feefc38d344f78eda1a54f8bcf0bf53 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 8 Nov 2020 14:40:54 +0000 Subject: [PATCH 31/33] APU: fix bug where it would shutdown on some power transients --- Nasal/Systems/APU.nas | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Nasal/Systems/APU.nas b/Nasal/Systems/APU.nas index 6ab5dac0..07fe75c7 100644 --- a/Nasal/Systems/APU.nas +++ b/Nasal/Systems/APU.nas @@ -256,6 +256,7 @@ var APU = { APUNodes.Controls.bleed.setValue(0); me.bleedTime = pts.Sim.Time.elapsedSec.getValue(); }, + _powerLost: 0, update: func() { me._count += 1; if (me._count == 5) { @@ -263,14 +264,22 @@ var APU = { if (me.state == 5 and APUNodes.Oil.pressure.getValue() < 35 or APUNodes.Oil.temperature.getValue() > 135) { me.autoStop(); } - if (systems.ELEC.Bus.dcBat.getValue() < 25) { - if (me.GenericControls.starter.getValue()) { - me.GenericControls.starter.setValue(0); - } - if (me.state != 0) { - me.autoStop(); + if (!me._powerLost) { + me._powerLost = 1; + settimer(func() { + if (me._powerLost) { + if (me.GenericControls.starter.getValue()) { + me.GenericControls.starter.setValue(0); + } + if (me.state != 0) { + me.autoStop(); + } + } + }, 0.2); } + } else { + me._powerLost = 0; } } }, From 497364fbfdcc5f022ebf5c6ca5da7e657747294f Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 8 Nov 2020 17:39:27 +0000 Subject: [PATCH 32/33] Bugfix APU that would fail to start due to not being synced with JSBSim perfectly --- Models/Instruments/OHpanel/OHpanel.xml | 2 +- Nasal/Systems/APU.nas | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index 25e3fafc..1bea790e 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -5773,7 +5773,7 @@ nasal diff --git a/Nasal/Systems/APU.nas b/Nasal/Systems/APU.nas index 07fe75c7..8f57a2df 100644 --- a/Nasal/Systems/APU.nas +++ b/Nasal/Systems/APU.nas @@ -87,19 +87,25 @@ var APU = { powerOn: func() { # just in case me.resetStuff(); - if (systems.ELEC.Bus.dcBat.getValue() < 25) { return; } + if (systems.ELEC.Bus.dcBat.getValue() < 25) { + settimer(func() { + if (systems.ELEC.Bus.dcBat.getValue() < 25) { + me.resetStuff(); + return; + } + }, 0.2); + } # apu able to receive emergency stop or start signals me.setState(1); me.fuelValveCmd.setValue(1); me.inletFlap.open(); - me.checkOil(); me.listenSignals = 1; settimer(func() { if (APUNodes.Controls.master.getValue() and !getprop("/systems/acconfig/autoconfig-running")) { me.setState(2); } }, 3); - settimer(func() { me.checkOil }, 8); + settimer(func() { me.checkOil() }, 8); }, startCommand: func(fast = 0) { if (me.listenSignals and (me.state == 1 or me.state == 2)) { From 3456e840f0bf8feed51db959fe8d7465c6923e72 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 8 Nov 2020 20:10:17 +0000 Subject: [PATCH 33/33] Fix Refuel panel for KGS / LBS --- gui/dialogs/refuel.nas | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gui/dialogs/refuel.nas b/gui/dialogs/refuel.nas index 63495a6e..df58abee 100644 --- a/gui/dialogs/refuel.nas +++ b/gui/dialogs/refuel.nas @@ -483,6 +483,7 @@ var refuelClass = { }); + systems.fuelSvc.Nodes.requestFuelLbs.setValue(pts.Consumables.Fuel.totalFuelLbs.getValue()); amount.setValue(math.round((systems.fuelSvc.Nodes.requestFuelLbs.getValue() + systems.fuelSvc.Nodes.requestLbs.getValue()) / 1000, 0.1)); me._timerf(); @@ -593,11 +594,11 @@ var refuelClass = { if (acconfig_weight_kgs.getValue() == 1) { amount.setValue(target - 0.1 * LBS2KGS); if ((target - 0.1) * LBS2KGS >= 10.0) { - me._FQI_pre.setText(sprintf("%2.1f", (target - 0.1) * LBS2KGS)); + me._FQI_pre.setText(sprintf("%2.1f", (target - (0.1 * LBS2KGS)) * LBS2KGS)); } else { - me._FQI_pre.setText(sprintf("%2.2f", (target - 0.1) * LBS2KGS)); + me._FQI_pre.setText(sprintf("%2.2f", (target - (0.1 * LBS2KGS)) * LBS2KGS)); } - systems.fuelSvc.Nodes.requestLbs.setValue((((target - 0.1) * LBS2KGS) - math.round(pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000, 0.1)) * 1000); + systems.fuelSvc.Nodes.requestLbs.setValue(((target - 0.1) - math.round(pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000, 0.1)) * 1000); } else { amount.setValue(target - 0.1); if (target - 0.1 >= 10.0) { @@ -615,11 +616,11 @@ var refuelClass = { if (acconfig_weight_kgs.getValue() == 1) { amount.setValue(target + 0.1); if ((target + 0.1) * LBS2KGS >= 10.0) { - me._FQI_pre.setText(sprintf("%2.1f", (target + 0.1) * LBS2KGS)); + me._FQI_pre.setText(sprintf("%2.1f", (target + (0.1 * LBS2KGS)) * LBS2KGS)); } else { - me._FQI_pre.setText(sprintf("%2.2f", (target + 0.1) * LBS2KGS)); + me._FQI_pre.setText(sprintf("%2.2f", (target + (0.1 * LBS2KGS)) * LBS2KGS)); } - systems.fuelSvc.Nodes.requestLbs.setValue((((target + 0.1) * LBS2KGS) - math.round(pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000, 0.1)) * 1000); + systems.fuelSvc.Nodes.requestLbs.setValue(((target + 0.1) - math.round(pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000, 0.1)) * 1000); } else { amount.setValue(target + 0.1); if (target + 0.1 >= 10.0) {