diff --git a/A320-main.xml b/A320-main.xml index 41be07d7..05eec927 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -5,17 +5,56 @@ - + 0 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 + + @@ -512,8 +560,33 @@ 2019.2.0 + + + 3000 + + + + + M + A320 + SDE2FGHIRWXY + S + + + + 4500 + 4500 + + + 41000 + 0.82 + 350 + + + + @@ -543,6 +616,39 @@ + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + 0 @@ -846,6 +952,7 @@ 1 1 1 + 1 1 1 @@ -1085,6 +1192,10 @@ 2000 0 + + faa + faa + 5.4 @@ -1109,6 +1220,7 @@ + 0 0 0 @@ -1381,6 +1493,7 @@ + 0 14.7 14.7 @@ -1573,6 +1686,10 @@ 1.0 + + false + + true @@ -1722,6 +1839,10 @@ 1219 true + + + false + @@ -4254,6 +4375,9 @@ + + Aircraft/A320-family/Nasal/emesary/M_frame_notification.nas + Aircraft/A320-family/Nasal/Libraries/property-tree-setup.nas @@ -4316,21 +4440,22 @@ Aircraft/A320-family/Nasal/MCDU/DUPLICATE.nas - Aircraft/A320-family/Nasal/MCDU/DIRTO.nas - Aircraft/A320-family/Nasal/MCDU/LATREV.nas - Aircraft/A320-family/Nasal/MCDU/VERTREV.nas - Aircraft/A320-family/Nasal/MCDU/DEPARTURE.nas - Aircraft/A320-family/Nasal/MCDU/ARRIVAL.nas - Aircraft/A320-family/Nasal/MCDU/AIRWAYS.nas - Aircraft/A320-family/Nasal/MCDU/CLOSESTAIRPORT.nas - Aircraft/A320-family/Nasal/MCDU/RECEIVEDMESSAGES.nas - Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas - Aircraft/A320-family/Nasal/MCDU/HOLD.nas - Aircraft/A320-family/Nasal/MCDU/F-PLN.nas - Aircraft/A320-family/Nasal/MCDU/WINDCLB.nas - Aircraft/A320-family/Nasal/MCDU/WINDCRZ.nas - Aircraft/A320-family/Nasal/MCDU/WINDDES.nas - Aircraft/A320-family/Nasal/MCDU/WINDHIST.nas + Aircraft/A320-family/Nasal/MCDU/DIRTO.nas + Aircraft/A320-family/Nasal/MCDU/LATREV.nas + Aircraft/A320-family/Nasal/MCDU/VERTREV.nas + Aircraft/A320-family/Nasal/MCDU/DEPARTURE.nas + Aircraft/A320-family/Nasal/MCDU/ARRIVAL.nas + Aircraft/A320-family/Nasal/MCDU/AIRWAYS.nas + Aircraft/A320-family/Nasal/MCDU/CLOSESTAIRPORT.nas + Aircraft/A320-family/Nasal/MCDU/RECEIVEDMESSAGES.nas + Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas + Aircraft/A320-family/Nasal/MCDU/HOLD.nas + Aircraft/A320-family/Nasal/MCDU/F-PLN.nas + Aircraft/A320-family/Nasal/MCDU/WINDCLB.nas + Aircraft/A320-family/Nasal/MCDU/WINDCRZ.nas + Aircraft/A320-family/Nasal/MCDU/WINDDES.nas + Aircraft/A320-family/Nasal/MCDU/WINDHIST.nas + Aircraft/A320-family/Nasal/MCDU/ATIS.nas Aircraft/A320-family/Nasal/MCDU/MCDU.nas Aircraft/A320-family/Nasal/MCDU/INITA.nas Aircraft/A320-family/Nasal/MCDU/IRSINIT.nas @@ -4360,6 +4485,7 @@ Aircraft/A320-family/Models/Instruments/ND/canvas/ND.nas + Aircraft/A320-family/Nasal/emesary/exec.nas Aircraft/A320-family/Models/Instruments/Upper-ECAM/Upper-ECAM.nas Aircraft/A320-family/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -4399,6 +4525,7 @@ Aircraft/A320-family/Nasal/Panels/atc.nas + Aircraft/A320-family/Nasal/Systems/Comm/Dictionary.nas Aircraft/A320-family/Nasal/Systems/Comm/Notification.nas diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 361b17fa..729db319 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -76,6 +76,8 @@ setprop("/systems/acconfig/options/keyboard-mode", 0); setprop("/systems/acconfig/options/weight-kgs", 0); setprop("/systems/acconfig/options/adirs-skip", 0); setprop("/systems/acconfig/options/allow-oil-consumption", 0); +setprop("/systems/acconfig/options/atis-server", "faa"); +setprop("/systems/acconfig/options/wxr-server", "noaa"); setprop("/systems/acconfig/options/welcome-skip", 0); setprop("/systems/acconfig/options/no-rendering-warn", 0); setprop("/systems/acconfig/options/save-state", 0); @@ -231,6 +233,8 @@ var readSettings = func { setprop("/sim/model/autopush/route/show-wingtip", getprop("/systems/acconfig/options/autopush/show-wingtip")); setprop("/options/system/fo-view", getprop("/systems/acconfig/options/fo-view")); setprop("/FMGC/simbrief-username", getprop("/systems/acconfig/options/simbrief-username")); + setprop("/systems/atsu/atis-server", getprop("/systems/acconfig/options/atis-server")); + setprop("/systems/atsu/wxr-server", getprop("/systems/acconfig/options/wxr-server")); } var writeSettings = func { @@ -243,6 +247,8 @@ var writeSettings = func { setprop("/systems/acconfig/options/autopush/show-wingtip", getprop("/sim/model/autopush/route/show-wingtip")); setprop("/systems/acconfig/options/fo-view", getprop("/options/system/fo-view")); setprop("/systems/acconfig/options/simbrief-username", getprop("/FMGC/simbrief-username")); + setprop("/systems/acconfig/options/atis-server", getprop("/systems/atsu/atis-server")); + setprop("/systems/acconfig/options/wxr-server", getprop("/systems/atsu/wxr-server")); io.write_properties(getprop("/sim/fg-home") ~ "/Export/A320-family-config.xml", "/systems/acconfig/options"); } diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 098a32a4..e8944999 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -7250,7 +7250,129 @@ iesi_btn_plus iesi_btn_rst + + + pick + iesi_btn_rst + + + false + + property-assign + /instrumentation/iesi/att-reset-cmd + 1 + + + + property-assign + /instrumentation/iesi/att-reset-cmd + 0 + + + + + + translate + iesi_btn_rst + /instrumentation/iesi/att-reset-cmd + 0.0025 + + -0.53312 + -0.16166 + 0.16956 + -0.53977 + -0.16166 + 0.16765 + + + + + pick + iesi_btn_plus + + + true + + property-assign + /instrumentation/iesi/plus + 1 + + + property-adjust + controls/lighting/DU/iesi + 0.05 + 0 + 1 + + + + property-assign + /instrumentation/iesi/plus + 0 + + + + + + + translate + iesi_btn_plus + /instrumentation/iesi/plus + 0.0025 + + -0.53312 + -0.16166 + 0.16956 + -0.53977 + -0.16166 + 0.16765 + + + + + pick + iesi_btn_minus + + + true + + property-assign + /instrumentation/iesi/minus + 1 + + + property-adjust + controls/lighting/DU/iesi + -0.05 + 0 + 1 + + + + property-assign + /instrumentation/iesi/minus + 0 + + + + + + + translate + iesi_btn_minus + /instrumentation/iesi/minus + 0.0025 + + -0.53312 + -0.16166 + 0.16956 + -0.53977 + -0.16166 + 0.16765 + + + Aircraft/A320-family/Models/Effects/clock @@ -8458,5 +8580,49 @@ + + + + + pick + radar_sys + + + false + + property-toggle + /instrumentation/efis[0]/inputs/wxr + + + property-toggle + /instrumentation/efis[1]/inputs/wxr + + + property-toggle + /instrumentation/wxr/enabled + + + nasal + + + + + + + rotate + radar_sys + -20 + /instrumentation/wxr/enabled +
+ 0.020282 + -0.210647 + -0.140496 +
+ + 1 + 0 + 0 + +
diff --git a/Models/FlightDeck/res/Engine.png b/Models/FlightDeck/res/Engine.png index 04a73794..08c49d48 100644 Binary files a/Models/FlightDeck/res/Engine.png and b/Models/FlightDeck/res/Engine.png differ diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index f7bff132..47563c50 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -13,16 +13,16 @@ var mach_act = 0; # props.nas nodes var iesi_init = props.globals.initNode("/instrumentation/iesi/iesi-init", 0, "BOOL"); -var iesi_time = props.globals.initNode("/instrumentation/iesi/iesi-init-time", 0.0, "DOUBLE"); +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("/orientation/pitch-deg", 1); -var roll = props.globals.getNode("/orientation/roll-deg", 1); -var skid = props.globals.getNode("/instrumentation/slip-skid-ball/indicated-slip-skid", 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); @@ -30,6 +30,10 @@ 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 = { init: func(canvas_group, file) { var font_mapper = func(family, weight) { @@ -66,6 +70,10 @@ var canvas_IESI_base = { me.AI_horizon_trans = me["AI_horizon"].createTransform(); me.AI_horizon_rot = me["AI_horizon"].createTransform(); + _showIESI = 0; + _fast = 0; + _IESITime = 0.0; + me.page = canvas_group; return me; @@ -75,19 +83,42 @@ var canvas_IESI_base = { }, 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)) { - IESI.page.show(); + _showIESI = 1; IESI.update(); if (aconfig.getValue() != 1 and iesi_init.getValue() != 1) { iesi_init.setBoolValue(1); - iesi_time.setValue(cur_time); + 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); - iesi_time.setValue(cur_time - 87); + _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(); } }, @@ -98,14 +129,20 @@ var canvas_IESI = { var m = {parents: [canvas_IESI, canvas_IESI_base]}; m.init(canvas_group, file); m._cachedInhg = -99; - + m._machWasAbove50 = 0; + m._roll = 0; return m; }, 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"]; + 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 (iesi_time.getValue() + 90 >= et.getValue()) { + if (qnh_inhg.getValue() != me._cachedInhg) { + me._cachedInhg = qnh_inhg.getValue(); + me.updateQNH(); + } + + if (_IESITime + 90 >= et.getValue()) { me["IESI"].hide(); me["IESI_Init"].show(); return; @@ -115,22 +152,27 @@ var canvas_IESI = { } # Airspeed - # Subtract 30, since the scale starts at 30, but don"t allow less than 0, or more than 420 situations + # 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 >= 420) { - ASI = 390; + } 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(); } @@ -142,14 +184,29 @@ 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(-roll.getValue() * D2R, me["AI_center"].getCenter()); + me.AI_horizon_rot.setRotation(-me._roll * D2R, me["AI_center"].getCenter()); - me["AI_slipskid"].setTranslation(math.clamp(skid.getValue(), -7, 7) * -15, 0); - me["AI_bank"].setRotation(-roll.getValue() * D2R); + 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; @@ -166,15 +223,17 @@ var canvas_IESI = { me["ALT_two"].setText(sprintf("%03d", abs(me.middleAltText-5))); me["ALT_one"].setText(sprintf("%03d", abs(me.middleAltText-10))); - me["ALT_digits"].setText(sprintf("%s", altitude_ind.getValue())); - me["ALT_meters"].setText(sprintf("%5.0f", me.altitude * 0.3048)); - altTens = num(right(sprintf("%02d", altitude.getValue()), 2)); - me["ALT_tens"].setTranslation(0, altTens * 3.16); - - if (qnh_inhg.getValue() != me._cachedInhg) { - me._cachedInhg = qnh_inhg.getValue(); - me.updateQNH(); + 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); }, updateQNH: func() { if (altimeter_mode.getBoolValue()) { @@ -231,4 +290,4 @@ var roundabout = func(x) { var roundaboutAlt = func(x) { var y = x * 0.2 - int(x * 0.2); return y < 0.5 ? 5 * int(x * 0.2) : 5 + 5 * int(x * 0.2); -}; +}; \ No newline at end of file diff --git a/Models/Instruments/IESI/IESI.xml b/Models/Instruments/IESI/IESI.xml index aba1e064..4705e023 100644 --- a/Models/Instruments/IESI/IESI.xml +++ b/Models/Instruments/IESI/IESI.xml @@ -19,15 +19,15 @@ - + diff --git a/Models/Instruments/IESI/res/iesi.svg b/Models/Instruments/IESI/res/iesi.svg index 6e50dc10..a68c652f 100644 --- a/Models/Instruments/IESI/res/iesi.svg +++ b/Models/Instruments/IESI/res/iesi.svg @@ -12,7 +12,7 @@ viewBox="0 0 1024 1024" version="1.1" id="svg2" - inkscape:version="0.91 r13725" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)" sodipodi:docname="iesi.svg"> @@ -37,17 +37,17 @@ guidetolerance="10" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1920" - inkscape:window-height="1030" + inkscape:window-width="1366" + inkscape:window-height="705" id="namedview371" - showgrid="false" - inkscape:zoom="1" - inkscape:cx="593.66324" - inkscape:cy="533.76317" - inkscape:window-x="1592" + showgrid="true" + inkscape:zoom="0.90509668" + inkscape:cx="529.7525" + inkscape:cy="2142.6048" + inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" - inkscape:current-layer="svg2" + inkscape:current-layer="IESI" showguides="true" inkscape:snap-global="false" units="pt" @@ -62,6 +62,90 @@ originx="0" originy="0" /> + + + INIT 90s + + SPD + + ALT + + ATT + @@ -98,7 +182,7 @@ @@ -106,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" /> @@ -120,16 +204,16 @@ id="text4488" y="378.41025" x="433.55658" - style="font-style:normal;font-weight:normal;font-size:30.52176857px;line-height:1.25;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" + 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">10 @@ -137,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" /> @@ -149,11 +233,11 @@ 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" /> 20 + 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">20 @@ -180,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" /> @@ -194,16 +278,16 @@ id="text4387" y="63.250156" x="433.55658" - style="font-style:normal;font-weight:normal;font-size:30.52176857px;line-height:1.25;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" + 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">30 @@ -211,251 +295,86 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4393" - d="m 437.0192,-133.29641 113.79938,0" - 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" /> - - 40 + 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 - - - 50 - - - - - 60 - - - - - 70 - - - + 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 - - - - - 90 - + x="417.83078" + y="-496.30688" + 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">80 10 + 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 @@ -482,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" /> 30 + 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 - - - - - - + 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 + 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">50 - - - - 60 - - - - - 70 - - - - 80 - - - - - 90 + + + + + + + + + @@ -815,11 +617,11 @@ 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" /> 000 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:75px;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">000 @@ -867,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" /> @@ -885,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" /> @@ -897,11 +699,11 @@ 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" /> 000 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:75px;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">000 @@ -929,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" /> @@ -941,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" /> @@ -967,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" /> @@ -979,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" /> @@ -991,9 +793,9 @@ - - 280 - 300 - - - - - 320 - - - 340 - - - 360 - - - 380 - - - 400 - - - 420 - - 260 - - - 240 - - - 220 - - - - - - 200 - - - - - 180 - - - - - 160 - - - - - 140 - - - - - 120 - - - - - 100 - - - - - 80 - - - - - 60 - - - - - 40 - - - - - - - 00 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;text-anchor:start;fill:#0dc04b;fill-opacity:1;stroke-width:0.75">00  40200080604020008060 00 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:74px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:end;text-anchor:end;fill:#0dc04b;fill-opacity:1;stroke-width:0.75">00 @@ -1879,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" /> + + + + + NEG + NEG + + 280 + 300 + + + + + 320 + + + 340 + + + 360 + + + 380 + + + 400 + + + 420 + + 260 + + + 240 + + + 220 + + + + + + 200 + + + + + 180 + + + + + 160 + + + + + 140 + + + + + 120 + + + + + 100 + + + + + 80 + + + + + 60 + + + + + 40 + + + + + + + + 440 + + + 460 + + + 480 + + + 500 + + + 520 + + 1013/29.92 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:86px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#179ab7;fill-opacity:1;stroke-width:0.75">1013/29.92 STD - - - INIT 90s - - SPD - - ALT - - ATT - diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 02cf3277..d4e0c476 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -25,6 +25,7 @@ var myCLBWIND = [nil, nil]; var myCRZWIND = [nil, nil]; var myDESWIND = [nil, nil]; var myHISTWIND = [nil, nil]; +var myAtis = [nil, nil]; var default = "BoeingCDU-Large.ttf"; #var symbol = "helvetica_medium.txf"; var symbol = "LiberationMonoCustom.ttf"; @@ -231,7 +232,8 @@ var canvas_MCDU_base = { "PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","PERFAPPR_LDG_3","PERFAPPR_LDG_F","PERFGA","PERFGA_FE","PERFGA_SE","PERFGA_OE","FPLN","FPLN_From", "FPLN_TMPY_group","FPLN_FROM","FPLN_Callsign","departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L","arrow1R","arrow2R", "arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group","IRSINIT","IRSINIT_1","IRSINIT_2","IRSINIT_star","NOTIFY","NOTIFY_FLTNBR","NOTIFY_AIRPORT","WEATHERREQSEND", - "WIND","WIND_CANCEL","WIND_INSERT_star","WIND_UPDOWN","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE"]; + "WIND","WIND_CANCEL","WIND_INSERT_star","WIND_UPDOWN","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE","ATISSend1","ATISSend2","ATISSend3","ATISSend4", + "ATISArrows"]; }, update: func() { if (systems.ELEC.Bus.ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) { @@ -362,6 +364,15 @@ var canvas_MCDU_base = { me["PRINTPAGE"].setColor(WHITE); } } + if (page != "ATIS") { + me["ATISSend1"].hide(); + me["ATISSend2"].hide(); + me["ATISSend3"].hide(); + me["ATISSend4"].hide(); + } + if (page != "ATISDETAIL") { + me["ATISArrows"].hide(); + } if (page == "F-PLNA" or page == "F-PLNB") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); @@ -545,12 +556,14 @@ var canvas_MCDU_base = { me.showLeftArrow(1, 1, 1, -1, 1, 1); me.showRight(1, 1, 1, 1, 1, -1); me.showRightS(-1, -1, -1, -1, -1, -1); - me.showRightArrow(1, 1, 1, 1, 1, -1); + me.showRightArrow(1, 1, 1, 1, 1, 1); me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); me.standardFontSize(); me.standardFontColour(); + me["Simple_R6"].setColor(BLUE); + me["Simple_R6_Arrow"].setColor(BLUE); me["Simple_L1"].setText(" PREFLIGHT"); me["Simple_L2"].setText(" ENROUTE"); @@ -564,8 +577,72 @@ var canvas_MCDU_base = { me["Simple_R3"].setText("RCVD MSGS "); me["Simple_R4"].setText("REPORTS "); me["Simple_R5"].setText("CONFIG "); + me["Simple_R6"].setText("MESSAGE "); pageSwitch[i].setBoolValue(1); } + + if (mcdu.ReceivedMessagesDatabase.firstUnviewed() != -99) { + me["Simple_R6"].show(); + me["Simple_R6_Arrow"].show(); + } else { + me["Simple_R6"].hide(); + me["Simple_R6_Arrow"].hide(); + } + } else if (page == "AOCCONFIG") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHideWithCenter(); + me["Simple_Title"].setText("AOC CONFIGURATION"); + me.defaultPageNumbers(); + + me.showLeft(1, -1, -1, -1, -1, 1); + me["Simple_L0S"].hide(); + me.showLeftS(1, -1, -1, -1, -1, 1); + me.showLeftArrow(-1, -1, -1, -1, -1, 1); + me.showCenter(1, 1, 1, 1, 1, -1); + me.showCenterS(1, -1, 1, -1, 1, -1); + me.showRight(1, -1, -1, -1, -1, 1); + me.showRightS(1, -1, -1, -1, -1, -1); + me.showRightArrow(-1, -1, -1, -1, -1, -1); + me["Simple_C3B"].hide(); + me["Simple_C4B"].hide(); + + me.standardFontSize(); + me.standardFontColour(); + + me["Simple_L1S"].setText("A/C REG"); + me["Simple_L1"].setFontSize(small); + me["Simple_L1"].setColor(GREEN); + me["Simple_C1S"].setColor(GREEN); + me["Simple_R1"].setFontSize(small); + me["Simple_R1"].setColor(GREEN); + me["Simple_R1S"].setText("TYPE"); + me["Simple_L6S"].setText(" RETURN TO"); + me["Simple_L6"].setText(" AOC MENU"); + me["Simple_C2"].setText("ATSU SW AND DB PN"); + me["Simple_C3S"].setText("998.2459.501"); + me["Simple_C3S"].setFontSize(small); + me["Simple_C3S"].setColor(GREEN); + me["Simple_C3"].setText("998.2460.501"); + me["Simple_C3"].setFontSize(small); + me["Simple_C3"].setColor(GREEN); + me["Simple_C4"].setText("ATSU AOC ID"); + me["Simple_C5S"].setText("AS2TOC1015010F1"); + me["Simple_C5S"].setFontSize(small); + me["Simple_C5S"].setColor(GREEN); + me["Simple_C5"].setText("AS2TOC1012001F2"); + me["Simple_C5"].setFontSize(small); + me["Simple_C5"].setColor(GREEN); + me["Simple_R6"].setText("PRINT "); + me["Simple_R6"].setColor(BLUE); + me["Simple_C1"].setFontSize(small); + me["Simple_C1"].setColor(GREEN); + pageSwitch[i].setBoolValue(1); + } + me["Simple_L1"].setText(getprop("/options/model-options/registration")); + me["Simple_C1S"].setText(sprintf("%02.0f", getprop("/sim/time/utc/hour")) ~ sprintf("%02.0f", getprop("/sim/time/utc/minute"))); + me["Simple_C1"].setText(sprintf("%02.0f", getprop("/sim/time/utc/day")) ~ "/" ~ sprintf("%02.0f", getprop("/sim/time/utc/month")) ~ "/" ~ right(sprintf(getprop("/sim/time/utc/year")), 2)); + me["Simple_R1S"].setText("TYPE"); + me["Simple_R1"].setText(getprop("/MCDUC/type")); } else if (page == "WEATHERREQ") { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); @@ -913,6 +990,217 @@ var canvas_MCDU_base = { me["Simple_R1"].setText("ATIS "); pageSwitch[i].setBoolValue(1); } + } else if (page == "ATISDETAIL") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHide(); + me["Simple_PageNum"].hide(); + me["ArrowLeft"].hide(); + me["ArrowRight"].hide(); + + me["Simple_L0S"].hide(); + me["Simple_C3B"].hide(); + me["Simple_C4B"].hide(); + + me.fontLeft(default, default, default, default, default, default); + me.fontLeftS(default, default, default, default, default, default); + me.fontRight(default, default, default, default, default, default); + me.fontRightS(default, default, default, default, default, default); + + me.fontSizeLeft(small, small, small, small, normal, normal); + me.fontSizeCenter(normal, normal, normal, normal, normal, normal); + me.fontSizeRight(normal, normal, normal, normal, normal, normal); + + me.colorLeftS("grn", "wht", "wht", "wht", "wht", "wht"); + me.colorRightS("grn", "wht", "wht", "wht", "wht", "wht"); + + + if (myAtis[i] != nil) { + me["Simple_Title"].setText(sprintf("%s", myAtis[i].title)); + + me.dynamicPageArrowFunc(myAtis[i]); + me.colorLeftArrow(myAtis[i].arrowsColour[0][0],myAtis[i].arrowsColour[0][1],myAtis[i].arrowsColour[0][2],myAtis[i].arrowsColour[0][3],myAtis[i].arrowsColour[0][4],myAtis[i].arrowsColour[0][5]); + me.colorRightArrow(myAtis[i].arrowsColour[1][0],myAtis[i].arrowsColour[1][1],myAtis[i].arrowsColour[1][2],myAtis[i].arrowsColour[1][3],myAtis[i].arrowsColour[1][4],myAtis[i].arrowsColour[1][5]); + + me.dynamicPageFunc(myAtis[i].L1, "Simple_L1"); + me.dynamicPageFunc(myAtis[i].L2, "Simple_L2"); + me.dynamicPageFunc(myAtis[i].L3, "Simple_L3"); + me.dynamicPageFunc(myAtis[i].L4, "Simple_L4"); + me.dynamicPageFunc(myAtis[i].L5, "Simple_L5"); + me.dynamicPageFunc(myAtis[i].L6, "Simple_L6"); + + me.colorLeft(myAtis[i].L1[2],myAtis[i].L2[2],myAtis[i].L3[2],myAtis[i].L4[2],myAtis[i].L5[2],myAtis[i].L6[2]); + + me.dynamicPageFunc(myAtis[i].R1, "Simple_R1"); + me.dynamicPageFunc(myAtis[i].R2, "Simple_R2"); + me.dynamicPageFunc(myAtis[i].R3, "Simple_R3"); + me.dynamicPageFunc(myAtis[i].R4, "Simple_R4"); + me.dynamicPageFunc(myAtis[i].R5, "Simple_R5"); + me.dynamicPageFunc(myAtis[i].R6, "Simple_R6"); + + me.colorRight(myAtis[i].R1[2],myAtis[i].R2[2],myAtis[i].R3[2],myAtis[i].R4[2],myAtis[i].R5[2],myAtis[i].R6[2]); + } + + if (myAtis[i].getNumPages() > 1) { + me["Simple_PageNum"].show(); + me["ATISArrows"].show(); + me["Simple_PageNum"].setText(myAtis[i].page ~ "/" ~ myAtis[i].getNumPages()); + } else { + me["Simple_PageNum"].hide(); + me["ATISArrows"].hide(); + } + + pageSwitch[i].setBoolValue(1); + } + } else if (page == "ATIS") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHideWithCenter(); + me["Simple_Title"].setText("ATS623 ATIS MENU"); + me["Simple_Title"].setColor(1, 1, 1); + me["Simple_PageNum"].hide(); + me["ArrowLeft"].hide(); + me["ArrowRight"].hide(); + + me.showLeft(1, 1, 1, 1, -1, 1); + me["Simple_L0S"].hide(); + me.showLeftS(1, -1, -1, -1, -1, 1); + me.showLeftArrow(1, 1, 1, -1, -1, 1); + me.showCenter(-1, -1, -1, -1, -1, -1); + me.showCenterS(-1, -1, -1, -1, -1, -1); + me.showRight(1, 1, 1, 1, 1, 1); + me.showRightS(1, 1, 1, 1, 1, 1); + me.showRightArrow(-1, -1, -1, -1, 1, -1); + me["Simple_C3B"].hide(); + me["Simple_C4B"].hide(); + + me.standardFontSize(); + + me.colorLeft("blu", "blu", "blu", "blu", "wht", "wht"); + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorCenter("grn", "grn", "grn", "grn", "wht", "wht"); + me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRight("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); + + + me["Simple_L1S"].setText(" ARPT/TYPE"); + me["Simple_L6S"].setText(" ATC MENU"); + me["Simple_L4"].setText(" [ ]/[ ]"); + me["Simple_L4"].setFont(symbol); + me["Simple_L6"].setText(" RETURN"); + + me["Simple_C1"].setFontSize(small); + me["Simple_C2"].setFontSize(small); + me["Simple_C3"].setFontSize(small); + me["Simple_C4"].setFontSize(small); + + me["Simple_R1S"].setText("REQ "); + me["Simple_R1"].setText("SEND "); + me["Simple_R2S"].setText("REQ "); + me["Simple_R2"].setText("SEND "); + me["Simple_R3S"].setText("REQ "); + me["Simple_R3"].setText("SEND "); + me["Simple_R4S"].setText("REQ "); + me["Simple_R4"].setText("SEND "); + me["Simple_R5S"].setText("AUTO "); + me["Simple_R5"].setText("UPDATE "); + me["Simple_R6S"].setText("PRINT MANUAL "); + me["Simple_R6"].setText("SET AUTO "); + pageSwitch[i].setBoolValue(1); + } + + if (atsu.ATISInstances[0].station != nil) { + me["Simple_L1"].setText(" " ~ atsu.ATISInstances[0].station ~ "/" ~ (atsu.ATISInstances[0].type == 0 ? "ARR" : "DEP")); + me["Simple_L1"].setFont(default); + me["Simple_L1_Arrow"].show(); + } else { + me["Simple_L1"].setText(" [ ]/[ ]"); + me["Simple_L1"].setFont(symbol); + me["Simple_L1_Arrow"].hide(); + } + + if (atsu.ATISInstances[0].received) { + me["Simple_C1"].setText(" " ~ atsu.ATISInstances[0].receivedCode ~ " " ~ atsu.ATISInstances[0].receivedTime); + me["Simple_C1"].show(); + } else { + me["Simple_C1"].hide(); + } + + if (atsu.ATISInstances[1].station != nil) { + me["Simple_L2"].setText(" " ~ atsu.ATISInstances[1].station ~ "/" ~ (atsu.ATISInstances[1].type == 0 ? "ARR" : "DEP")); + me["Simple_L2"].setFont(default); + me["Simple_L2_Arrow"].show(); + } else { + me["Simple_L2"].setText(" [ ]/[ ]"); + me["Simple_L2"].setFont(symbol); + me["Simple_L2_Arrow"].hide(); + } + + if (atsu.ATISInstances[1].received) { + me["Simple_C2"].setText(" " ~ atsu.ATISInstances[1].receivedCode ~ " " ~ atsu.ATISInstances[1].receivedTime); + me["Simple_C2"].show(); + } else { + me["Simple_C2"].hide(); + } + + if (atsu.ATISInstances[2].station != nil) { + me["Simple_L3"].setText(" " ~ atsu.ATISInstances[2].station ~ "/" ~ (atsu.ATISInstances[2].type == 0 ? "ARR" : "DEP")); + me["Simple_L3"].setFont(default); + me["Simple_L3_Arrow"].show(); + } else { + me["Simple_L3"].setText(" [ ]/[ ]"); + me["Simple_L3"].setFont(symbol); + me["Simple_L3_Arrow"].hide(); + } + + if (atsu.ATISInstances[2].received) { + me["Simple_C3"].setText(" " ~ atsu.ATISInstances[2].receivedCode ~ " " ~ atsu.ATISInstances[2].receivedTime); + me["Simple_C3"].show(); + } else { + me["Simple_C3"].hide(); + } + + if (atsu.ATISInstances[3].station != nil) { + me["Simple_L4"].setText(" " ~ atsu.ATISInstances[3].station ~ "/" ~ (atsu.ATISInstances[3].type == 0 ? "ARR" : "DEP")); + me["Simple_L4"].setFont(default); + me["Simple_L4_Arrow"].show(); + } else { + me["Simple_L4"].setText(" [ ]/[ ]"); + me["Simple_L4"].setFont(symbol); + me["Simple_L4_Arrow"].hide(); + } + + if (atsu.ATISInstances[3].received) { + me["Simple_C4"].setText(" " ~ atsu.ATISInstances[3].receivedCode ~ " " ~ atsu.ATISInstances[3].receivedTime); + me["Simple_C4"].show(); + } else { + me["Simple_C4"].hide(); + } + + if (atsu.ATISInstances[0].sent) { + me["ATISSend1"].hide(); + } else { + me["ATISSend1"].show(); + } + + if (atsu.ATISInstances[1].sent) { + me["ATISSend2"].hide(); + } else { + me["ATISSend2"].show(); + } + + if (atsu.ATISInstances[2].sent) { + me["ATISSend3"].hide(); + } else { + me["ATISSend3"].show(); + } + + if (atsu.ATISInstances[3].sent) { + me["ATISSend4"].hide(); + } else { + me["ATISSend4"].show(); + } } else if (page == "NOTIFICATION") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); @@ -1225,21 +1513,21 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (atsu.AOC.server == 1) { + if (atsu.AOC.server.getValue() == "vatsim") { me["Simple_R1"].setText("VATSIM "); me["Simple_R2_Arrow"].show(); me["Simple_R3_Arrow"].hide(); - } elsif (atsu.AOC.server == 0) { + } elsif (atsu.AOC.server.getValue() == "noaa") { me["Simple_R1"].setText("NOAA "); me["Simple_R2_Arrow"].hide(); me["Simple_R3_Arrow"].show(); } - if (atsu.ATIS.server == 1) { + if (atsu.ATIS.serverSel.getValue() == "vatsim") { me["Simple_L1"].setText(" VATSIM"); me["Simple_L2_Arrow"].show(); me["Simple_L3_Arrow"].hide(); - } elsif (atsu.ATIS.server == 0) { + } elsif (atsu.ATIS.serverSel.getValue() == "faa") { me["Simple_L1"].setText(" FAA"); me["Simple_L2_Arrow"].hide(); me["Simple_L3_Arrow"].show(); diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg index 365d0760..9eb38288 100644 --- a/Models/Instruments/MCDU/res/mcdu.svg +++ b/Models/Instruments/MCDU/res/mcdu.svg @@ -12,7 +12,7 @@ viewBox="0 0 1024 864" version="1.1" id="svg2" - inkscape:version="1.0beta2 (2b71d25, 2019-12-03)" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)" sodipodi:docname="mcdu.svg"> @@ -37,17 +37,17 @@ guidetolerance="20" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1440" - inkscape:window-height="819" + inkscape:window-width="1366" + inkscape:window-height="705" id="namedview371" showgrid="true" - inkscape:zoom="0.78947164" - inkscape:cx="929.63178" - inkscape:cy="751.57487" - inkscape:window-x="481" - inkscape:window-y="23" - inkscape:window-maximized="0" - inkscape:current-layer="WIND" + inkscape:zoom="3.1578866" + inkscape:cx="1122.1906" + inkscape:cy="986.92422" + inkscape:window-x="-8" + inkscape:window-y="-8" + inkscape:window-maximized="1" + inkscape:current-layer="svg2" showguides="false" inkscape:snap-global="false" units="px" @@ -1016,7 +1016,7 @@ inkscape:label="#g4241" id="g4241"> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -1103,7 +1103,7 @@ x="177.72771" style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" xml:space="preserve"> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -1235,7 +1235,7 @@ inkscape:label="arrow5L" id="arrow5L"> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -2617,7 +2617,7 @@ id="tspan1088" x="478.87796" y="171.04486" - style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.9924px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">= + style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.99240112px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">= = + style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.99240112px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">= + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> = @@ -2833,7 +2833,7 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path1243" - d="m 998.71909,284.70793 -28.52965,0" + d="M 998.71909,284.70793 H 970.18944" style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Models/Instruments/ND/canvas/framework/navdisplay.nas b/Models/Instruments/ND/canvas/framework/navdisplay.nas index 6115d8a4..b0f46311 100644 --- a/Models/Instruments/ND/canvas/framework/navdisplay.nas +++ b/Models/Instruments/ND/canvas/framework/navdisplay.nas @@ -335,12 +335,12 @@ canvas.NavDisplay.update_sub = func(){ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft specific, cannot easily be reused by other aircraft { var _time = systime(); - # Disables WXR Live if it"s not enabled. The toggle_weather_live should be common to all + # Disables WXR Live if it's not enabled. The toggle_weather_live should be common to all # ND instances. - var wxr_live_enabled = getprop(wxr_live_tree~"/enabled"); - if(wxr_live_enabled == nil or wxr_live_enabled == "") + var wxr_live_enabled = getprop(wxr_live_tree~'/enabled'); + if(wxr_live_enabled == nil or wxr_live_enabled == '') wxr_live_enabled = 0; - me.set_switch("toggle_weather_live", wxr_live_enabled); + me.set_switch('toggle_weather_live', wxr_live_enabled); call(me.update_sub, nil, nil, caller(0)[0]); # call this in the same namespace to "steal" its variables # MapStructure update! diff --git a/Models/Instruments/ND/canvas/map/WXR_live.lcontroller b/Models/Instruments/ND/canvas/map/WXR_live.lcontroller index c4ed451e..1589232b 100644 --- a/Models/Instruments/ND/canvas/map/WXR_live.lcontroller +++ b/Models/Instruments/ND/canvas/map/WXR_live.lcontroller @@ -25,16 +25,9 @@ var new = func(layer) { }; layer.searcher._equals = func(l,r) l.equals(r); m.addVisibilityListener(); - var aircraft_dir = split('/', getprop("sim/aircraft-dir"))[-1]; - var saved_conf = getprop("sim/fg-home") ~ "/Export/wxr_api.xml"; - var df_conf = getprop("sim/fg-root") ~ "/Aircraft/" ~ aircraft_dir ~ - "/Models/Instruments/ND/canvas/wxr_api.xml"; - if(io.stat(saved_conf) != nil) - io.read_properties(saved_conf, wxr_tree); - else - io.read_properties(df_conf, wxr_tree); return m; }; + var del = func() { #print(name~".lcontroller.del()"); foreach (var l; me.listeners) @@ -43,9 +36,6 @@ var del = func() { var searchCmd = func { if(me.map.getRange() == nil) return []; - var api_key = getprop(wxr_tree~"/api-key"); - if(!api_key or api_key == '' or api_key == 'YOUR API KEY') - return []; var lat = getprop(wxr_tree~"/center/latitude-deg"); var lon = getprop(wxr_tree~"/center/longitude-deg"); @@ -58,14 +48,9 @@ var searchCmd = func { var result = geo.Coord.new(); result.set_latlon(lat, lon); result.rangeNm = me.map.getRange(); - result.key = api_key; - result.res = getprop(wxr_tree~"/resolution"); - result.ltype = getprop(wxr_tree~"/layer-type"); - result.smooth = getprop(wxr_tree~"/smooth"); - result.fetchRad = getprop(wxr_tree~"/fetch-radius"); + result.fetchRad = 184; # is this number accurate? result.equals = func(r){ - me.ltype == r.ltype and me.fetchRad == r.fetchRad and - me.lat == r.lat and me.lon == r.lon + me.fetchRad == r.fetchRad and me.lat == r.lat and me.lon == r.lon }; return [result]; diff --git a/Models/Instruments/ND/canvas/map/WXR_live.symbol b/Models/Instruments/ND/canvas/map/WXR_live.symbol index 53971407..b1557884 100644 --- a/Models/Instruments/ND/canvas/map/WXR_live.symbol +++ b/Models/Instruments/ND/canvas/map/WXR_live.symbol @@ -11,19 +11,18 @@ var getWXRImageFilePath = func(){ var home = getprop('sim/fg-home'); var aircraft = getprop('sim/aircraft'); var idx = me.layer.getCanvas()._node.getIndex(); - return home ~ '/Export/' ~ aircraft ~ '-wxr-'~me.ltype~'-'~idx~'.png'; + return home ~ '/Export/' ~ aircraft ~ '-wxr-'~idx~'.png'; +}; + +var processRequest = func(r) { + var splitVector = split(",", r.response); + var timeStamp = split("]",splitVector[size(splitVector) - 1]); + return timeStamp[0]; }; var getWXRAPIUrl = func(lat, lon){ - var res = me.res; - if(me.ltype == "radar"){ - return "http://api.wunderground.com/api/"~me.key~ - "/radar/image.png?centerlat="~lat~"¢erlon="~lon~ - "&radius="~me.fetchRad~"&width="~res~"&height="~res~ - "&smooth="~me.smooth; - } else { - return nil; - } + if (me.timeStamp == nil) { return nil; } + return "https://tilecache.rainviewer.com/v2/radar/" ~ sprintf("%s",me.timeStamp) ~ "/512/5/" ~ lat ~ "/" ~ lon ~ "/7/0_0.png"; }; var fetchWXRMap = func(size){ @@ -34,15 +33,14 @@ var fetchWXRMap = func(size){ var url = me.getWXRAPIUrl(lat, lon); var filePath = me.getWXRImageFilePath(); if(url == nil) { - print(me.name~': No URL!'); + logprint(3,me.name,": No URL!"); return; } me.fetching = 1; http.save(url, filePath) .fail(func(){ - print(me.name~': Download failed!'); - me.wxlayer.hide(); - }) + logprint(3,me.name,":Download failed!");} + ) .done(func(){ var sz = size * 2; var transl = -size; @@ -57,28 +55,28 @@ var fetchWXRMap = func(size){ setprop("instrumentation/wxr/center/latitude-deg", lat); setprop("instrumentation/wxr/center/longitude-deg", lon); me.fetching = 0; - print("[WXR] Live Layer Request: "~url); # Debugging + logprint(4,me.name,": Layer Request: ",url); }); }; var init = func { #print('WXR init'); me.fetching = 0; - me.key = me.model.key; # API Key from Wunderground API Subscription - me.res = me.model.res; # Resolution of image to fetch (default 2048) - me.ltype = me.model.ltype; # Layer Type - radar, satellite - me.smooth = me.model.smooth; # If we should fetch a smoothened image or the original + me.timeStamp = nil; me.fetchRad = me.model.fetchRad; # Radius of radar layer to fetch me.range = me.model.rangeNm; # Range of Navigation Display me.viewport_radius = me.getOption('viewport_radius', 670); me.wxlayer = me.element.createChild("image").set("z-index", -100).hide(); - me.last_request = -210; - me.update_interval = 240; + me.last_request = -600; + me.update_interval = 600; var r_scaled = (me.fetchRad*me.viewport_radius)/me.range; me.fetchWXRMap(r_scaled); + + me.timeStamp = nil; + http.load("https://api.rainviewer.com/public/maps.json").done(func(r) me.timeStamp = processRequest(r)); }; var draw = func { @@ -86,15 +84,12 @@ var draw = func { var update_size = (range != me.range); me.range = range; me.fetchRad = me.model.fetchRad; # Radius of radar layer to fetch - #var r_scaled = (me.fetchRad*670)/me.range; var r_scaled = (me.fetchRad*me.viewport_radius)/me.range; var hdg = me.layer.map.getHdg(); var rot = 0 - hdg; - if(rot < 0) rot = 360 + rot; + if(rot < 0) rot = 360 + rot + -getprop("/environment/magnetic-variation-deg"); me.element.setRotation(rot*D2R); if(update_size){ - print('WXR draw range:'~ me.range); - print('Update size: '~r_scaled~'x2 = '~(r_scaled*2)); me.wxlayer.hide(); me.wxlayer.setSize(2*r_scaled, 2*r_scaled) .setTranslation(-r_scaled, -r_scaled); @@ -102,12 +97,6 @@ var draw = func { } if(getprop("sim/time/elapsed-sec") - me.last_request > me.update_interval) { - #print('Fetching WXR map...'); - me.key = me.model.key; # API Key from Wunderground API Subscription - me.res = me.model.res; # Resolution of image to fetch (default 2048) - me.ltype = me.model.ltype; # Layer Type - radar, satellite - me.smooth = me.model.smooth; # If we should fetch a smoothened image or the original - me.fetchWXRMap(r_scaled); } }; diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index cf95ab3d..a8a3f641 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -15,6 +15,8 @@ var updateR = 0; var elapsedtime = 0; var altTens = 0; var altPolarity = ""; +var track_diff = 0; +var AICenter = nil; # Fetch nodes: var state1 = props.globals.getNode("/systems/thrust/state1", 1); @@ -34,7 +36,7 @@ var thr2 = props.globals.getNode("/controls/engines/engine[1]/throttle-pos", 1); var wow0 = props.globals.getNode("/gear/gear[0]/wow"); var wow1 = props.globals.getNode("/gear/gear[1]/wow"); var wow2 = props.globals.getNode("/gear/gear[2]/wow"); -var pitch = props.globals.getNode("/orientation/pitch-deg", 1); +var pitch = props.globals.getNode("/instrumentation/pfd/pitch-deg-non-linear", 1); var roll = props.globals.getNode("/orientation/roll-deg", 1); var elapsedtime = props.globals.getNode("/sim/time/elapsed-sec", 1); var du1_lgt = props.globals.getNode("/controls/lighting/DU/du1", 1); @@ -126,6 +128,16 @@ var inner_marker = props.globals.getNode("/instrumentation/marker-beacon/inner", var flap_config = props.globals.getNode("/controls/flight/flaps-input", 1); var hundredAbove = props.globals.getNode("/instrumentation/pfd/hundred-above", 1); var minimum = props.globals.getNode("/instrumentation/pfd/minimums", 1); +var aoa_1 = props.globals.getNode("/systems/navigation/adr/output/aoa-1", 1); +var aoa_2 = props.globals.getNode("/systems/navigation/adr/output/aoa-2", 1); +var aoa_3 = props.globals.getNode("/systems/navigation/adr/output/aoa-3", 1); +var adr_1_switch = props.globals.getNode("/controls/navigation/adirscp/switches/adr-1", 1); +var adr_2_switch = props.globals.getNode("/controls/navigation/adirscp/switches/adr-2", 1); +var adr_3_switch = props.globals.getNode("/controls/navigation/adirscp/switches/adr-3", 1); +var adr_1_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-1-fault", 1); +var adr_2_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-2-fault", 1); +var adr_3_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-3-fault", 1); +var air_data_switch = props.globals.getNode("/controls/navigation/switching/air-data", 1); # Create Nodes: var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE"); @@ -137,7 +149,7 @@ var horizon_ground = props.globals.initNode("/instrumentation/pfd/horizon-ground var hdg_diff = props.globals.initNode("/instrumentation/pfd/hdg-diff", 0.0, "DOUBLE"); var hdg_scale = props.globals.initNode("/instrumentation/pfd/heading-scale", 0.0, "DOUBLE"); var track = props.globals.initNode("/instrumentation/pfd/track-deg", 0.0, "DOUBLE"); -var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); +#var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); # returns incorrect value var du1_test = props.globals.initNode("/instrumentation/du/du1-test", 0, "BOOL"); var du1_test_time = props.globals.initNode("/instrumentation/du/du1-test-time", 0.0, "DOUBLE"); var du1_offtime = props.globals.initNode("/instrumentation/du/du1-off-time", 0.0, "DOUBLE"); @@ -200,6 +212,9 @@ var canvas_PFD_base = { me.AI_horizon_hdg_trans = me["AI_heading"].createTransform(); me.AI_horizon_hdg_rot = me["AI_heading"].createTransform(); + me.AI_fpv_trans = me["FPV"].createTransform(); + me.AI_fpv_rot = me["FPV"].createTransform(); + me.page = canvas_group; return me; @@ -212,7 +227,7 @@ var canvas_PFD_base = { "AI_agl_g","AI_agl","AI_error","AI_group","FD_roll","FD_pitch","ALT_box_flash","ALT_box","ALT_box_amber","ALT_scale","ALT_target","ALT_target_digit","ALT_one","ALT_two","ALT_three","ALT_four","ALT_five","ALT_digits","ALT_tens","ALT_digit_UP", "ALT_digit_DN","ALT_error","ALT_group","ALT_group2","ALT_frame","VS_pointer","VS_box","VS_digit","VS_error","VS_group","QNH","QNH_setting","QNH_std","QNH_box","LOC_pointer","LOC_scale","GS_scale","GS_pointer","CRS_pointer","HDG_target","HDG_scale", "HDG_one","HDG_two","HDG_three","HDG_four","HDG_five","HDG_six","HDG_seven","HDG_digit_L","HDG_digit_R","HDG_error","HDG_group","HDG_frame","TRK_pointer","machError","ilsError","ils_code","ils_freq","dme_dist","dme_dist_legend","ILS_HDG_R","ILS_HDG_L", - "ILS_right","ILS_left","outerMarker","middleMarker","innerMarker","v1_group","v1_text","vr_speed","F_target","S_target","FS_targets","flap_max","clean_speed","ground","ground_ref","spdLimError"]; + "ILS_right","ILS_left","outerMarker","middleMarker","innerMarker","v1_group","v1_text","vr_speed","F_target","S_target","FS_targets","flap_max","clean_speed","ground","ground_ref","FPV","spdLimError"]; }, updateDu1: func() { var elapsedtime_act = elapsedtime.getValue(); @@ -961,12 +976,15 @@ var canvas_PFD_base = { me["HDG_target"].hide(); } - me["TRK_pointer"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, 0); + + var heading_deg = heading.getValue(); + track_diff = geo.normdeg180(track.getValue() - heading_deg); + me["TRK_pointer"].setTranslation(me.getTrackDiffPixels(track_diff),0); split_ils = split("/", ils_data1.getValue()); if (ap_ils_mode.getValue() == 1 and size(split_ils) == 2) { magnetic_hdg = ils_crs.getValue(); - magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading.getValue()); + magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading_deg); if (magnetic_hdg_dif >= -23.62 and magnetic_hdg_dif <= 23.62) { me["CRS_pointer"].setTranslation((magnetic_hdg_dif / 10) * 98.5416, 0); me["ILS_HDG_R"].hide(); @@ -1010,6 +1028,28 @@ var canvas_PFD_base = { me.AI_horizon_hdg_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); me["AI_heading"].update(); }, + + # Get Angle of Attack from ADR1 or, depending on Switching panel, ADR3 + getAOAForPFD1: func() { + if (air_data_switch.getValue() != -1 and adr_1_switch.getValue() and !adr_1_fault.getValue()) return aoa_1.getValue(); + if (air_data_switch.getValue() == -1 and adr_3_switch.getValue() and !adr_3_fault.getValue()) return aoa_3.getValue(); + return nil; + }, + + # Get Angle of Attack from ADR2 or, depending on Switching panel, ADR3 + getAOAForPFD2: func() { + if (air_data_switch.getValue() != 1 and adr_2_switch.getValue() and !adr_2_fault.getValue()) return aoa_2.getValue(); + if (air_data_switch.getValue() == 1 and adr_3_switch.getValue() and !adr_3_fault.getValue()) return aoa_3.getValue(); + return nil; + }, + + # Convert difference between magnetic heading and track measured in degrees to pixel for display on PFDs + # And set max and minimum values + getTrackDiffPixels: func(track_diff_deg) { + return ((math.clamp(track_diff_deg, -23.62, 23.62) / 10) * 98.5416); + }, + + }; var canvas_PFD_1 = { @@ -1087,6 +1127,26 @@ var canvas_PFD_1 = { me["FD_pitch"].hide(); } + # If TRK FPA selected, display FPV on PFD1 + if (ap_trk_sw.getValue() == 0 ) { + me["FPV"].hide(); + } else { + var aoa = me.getAOAForPFD1(); + if (aoa == nil or (systems.ADIRS.ADIRunits[0].aligned != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].aligned != 1 and att_switch.getValue() == -1)){ + me["FPV"].hide(); + } else { + var roll_deg = roll.getValue() or 0; + AICenter = me["AI_center"].getCenter(); + var track_x_translation = me.getTrackDiffPixels(track_diff); + + me.AI_fpv_trans.setTranslation(track_x_translation, math.clamp(aoa, -20, 20) * 12.5); + me.AI_fpv_rot.setRotation(-roll_deg * D2R, AICenter); + me["FPV"].setRotation(roll_deg * D2R); # It shouldn't be rotated, only the axis should be + me["FPV"].show(); + } + + } + # ILS if (ap_ils_mode.getValue() == 1) { me["LOC_scale"].show(); @@ -1842,6 +1902,25 @@ var canvas_PFD_2 = { me["FD_pitch"].hide(); } + # If TRK FPA selected, display FPV on PFD2 + if (ap_trk_sw.getValue() == 0 ) { + me["FPV"].hide(); + } else { + var aoa = me.getAOAForPFD2(); + if (aoa == nil or (systems.ADIRS.ADIRunits[1].aligned != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].aligned != 1 and att_switch.getValue() == 1)) { + me["FPV"].hide(); + } else { + var roll_deg = roll.getValue() or 0; + AICenter = me["AI_center"].getCenter(); + var track_x_translation = me.getTrackDiffPixels(track_diff); + + me.AI_fpv_trans.setTranslation(track_x_translation, math.clamp(aoa, -20, 20) * 12.5); + me.AI_fpv_rot.setRotation(-roll_deg * D2R, AICenter); + me["FPV"].setRotation(roll_deg * D2R); # It shouldn't be rotated, only the axis should be + me["FPV"].show(); + } + } + # ILS if (ap_ils_mode2.getValue() == 1) { me["LOC_scale"].show(); diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 88060ede..5be2191d 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -41,9 +41,9 @@ inkscape:window-maximized="1" inkscape:window-y="-8" inkscape:window-x="-8" - inkscape:cy="567.21927" - inkscape:cx="992.76655" - inkscape:zoom="1.0773413" + inkscape:cy="259.23779" + inkscape:cx="201.84998" + inkscape:zoom="2.56" showgrid="true" id="namedview371" inkscape:window-height="705" @@ -105,7 +105,7 @@ inkscape:label="#g5492" id="AI_background"> + style="opacity:1;fill:#368acd;fill-opacity:1;stroke:none;stroke-width:2.58922005;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + id="AI_scale" + inkscape:label="#g1094"> + inkscape:label="#g1636"> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> - - - - - - - - - - - - - - - - - - + d="m 375.0679,151.98345 146.37368,-3.9e-4" + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20011425;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + d="m 365.50874,-25.418749 165.49199,4.5e-4" + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20024991;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> - - - - + + 10 + 10 + 20 + 20 + 30 + 30 + 50 + 50 + 80 + 80 + + + 10 + 10 + 20 + 20 + 30 + 30 + 50 + 50 + 80 + 80 + + inkscape:label="#g1754"> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> - - - - - - - - - + d="m 393.624,876.36943 109.26112,4e-5" + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + d="M 375.59592,994.63672 H 520.9132" + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> - - - - - - - - - - - - - - - - - - - - - 10 - 10 - 20 - 20 - 30 - 30 - 40 - 40 - 50 - 50 - 60 - 60 - 70 - 70 - 80 - 80 - 90 - 90 - - - 10 - 10 - 20 - 20 - 30 - 30 - 40 - 40 - 50 - 50 - 60 - 60 - 70 - 70 - 80 - 80 - 90 - 90 - - + + + + + + + d="m 370.5312,169.07528 h 21.6616" + style="fill:none;fill-opacity:1;stroke:#0dc04b;stroke-width:3.19994998;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -1074,8 +604,8 @@ id="g4951" transform="translate(133.78495)"> @@ -1083,15 +613,15 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4956" - d="m 370.53103,162.42242 h 21.66136" - style="fill:none;fill-opacity:1;stroke:#0dc04b;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 370.53103,177.1501 h 21.66136" + style="fill:none;fill-opacity:1;stroke:#0dc04b;stroke-width:3.19994998;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -1099,8 +629,8 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path4968" - d="m 370.53103,162.42242 h 21.66136" - style="fill:none;fill-opacity:1;stroke:#0dc04b;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 370.53103,147.50219 h 21.66136" + style="fill:none;fill-opacity:1;stroke:#0dc04b;stroke-width:3.19994998;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + d="m 370.5312,139.42737 h 21.6616" + style="fill:none;fill-opacity:1;stroke:#0dc04b;stroke-width:3.19994998;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> @@ -1124,54 +654,54 @@ inkscape:label="#g4999" id="AI_pitch_lim_X"> X X X X @@ -1182,7 +712,7 @@ transform="translate(0,-97.082454)" inkscape:label="#g4918"> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + 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" /> + 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" /> + 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" /> + style="opacity:1;fill:#368acd;fill-opacity:1;stroke:none;stroke-width:2.58922005;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.73024011;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + 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" /> + 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" /> + 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" /> + 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" /> + style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.30556011;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;stroke:#c9d121;stroke-width:3.54375005;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:label="fixed_aircraft_outline_1" /> + style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:8.10006046;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + sodipodi:nodetypes="cccccccccccc" + inkscape:label="fixed_aircraft_outline_2" /> + 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" /> + style="fill:none;fill-opacity:1;stroke:#c9cc15;stroke-width:3.99993992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + 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" /> + 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" /> @@ -1493,9 +1025,9 @@ inkscape:connector-curvature="0" id="path3932" d="m 340.35189,239.5184 5.62182,14.20878" - 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" /> + 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" /> + 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" /> + 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" /> + style="fill:none;fill-opacity:1;stroke:#0dc04b;stroke-width:3.19994998;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#0dc04b;stroke-width:3.19994998;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + 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" /> + 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" /> + 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" /> + 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" /> + 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" /> 0000 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:45px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#0dc04b;fill-opacity:1;stroke-width:0.65757698">0000 + 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" /> + 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" /> + 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" /> + 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" /> + 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" /> LIM + + + + + + diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 875a16f3..00bdfe9c 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -1,62 +1,17 @@ -# 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"); -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 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 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); +var du3_lgt = props.globals.getNode("/controls/lighting/DU/du3"); 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_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); @@ -65,14 +20,6 @@ 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); @@ -81,148 +28,460 @@ 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 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) { - var font_mapper = func(family, weight) { +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(canvas_group, file, {"font-mapper": font_mapper}); - - var svg_keys = me.getKeys(); - foreach(var key; svg_keys) { - me[key] = canvas_group.getElementById(key); + + 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 = canvas_group.getElementById(key ~ "_clip"); + 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], # 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); + 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); + }; - # 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"); - - - me.page = canvas_group; - - return me; - }, - getKeys: func() { - return []; - }, - updateDu3: func() { - elapsedtime = pts.Sim.Time.elapsedSec.getValue(); + obj.units = acconfig_weight_kgs.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); + 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 { - du3_test.setValue(1); - du3_test_amount.setValue(0); - du3_test_time.setValue(-100); + 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"); + } } - } - } else { - du3_test.setValue(0); - du3_offtime.setValue(elapsedtime); - } - }, - update: func() { - elapsedtime = pts.Sim.Time.elapsedSec.getValue(); - cur_eng_option = eng_option.getValue(); + 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; + } + }), + ]; - 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(); + 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(); } - } - } else { - upperECAM_test.page.hide(); - upperECAM_cfm_eis2.page.hide(); - upperECAM_iae_eis2.page.hide(); - } + + 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") { @@ -241,184 +500,148 @@ var canvas_upperECAM_base = { return [1,1,1]; } }, - updateBase: func() { - # 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(); + 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 (rev_1_cur >= 0.95) { - me["REV1"].setColor(0.0509,0.7529,0.2941); - } else { - me["REV1"].setColor(0.7333,0.3803,0); + if (me.group.getVisible() == 0) { + return; } - 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(); + 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 (rev_2_cur >= 0.95) { - me["REV2"].setColor(0.0509,0.7529,0.2941); - } else { - me["REV2"].setColor(0.7333,0.3803,0); + if (fadec.FADEC.Eng1.n2 != me._cachedN2[0]) { + me.updateN21(); + } + if (fadec.FADEC.Eng2.n2 != me._cachedN2[1]) { + me.updateN22(); } - # 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 (fadec.FADEC.Eng1.egt != me._cachedEGT[0]) { + me.updateEGT1(); + } + if (fadec.FADEC.Eng2.egt != me._cachedEGT[1]) { + me.updateEGT2(); } - if (flapsPos > 0) { - me["FlapDots"].show(); - } else { - me["FlapDots"].hide(); + if (fadec.FADEC.Eng1.ff != me._cachedFF[0]) { + me.updateFF1(); + } + if (fadec.FADEC.Eng2.ff != me._cachedFF[1]) { + me.updateFF2(); } - if (pts.Fdm.JSBsim.Fcs.slatLocked.getValue()) { - if (slatLockGoing == 0) { - slatLockGoing = 1; + if (notification.eng1_n1 or notification.eng2_n1) { + foreach(var update_item; me.update_items_fadec_powered_n1) + { + update_item.update(notification); } - if (slatLockGoing == 1) { - slatLockTimer.start(); - if (slatLockFlash.getValue()) { - me["SlatAlphaLock"].show(); - } else { - me["SlatAlphaLock"].hide(); - } + } + + 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 { - 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()); - - # FOB - if (acconfig_weight_kgs.getValue()) + foreach (var update_item; me.ecam_update) { - 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"); + update_item.update(notification); + } + }, + updateCFM: func(notification) { + me.updateCommon(notification); + if (me.group.getVisible() == 0) { + return; } - # 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(); - - 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())); - - me["ECAM_Right"].show(); + foreach (var update_item; me.update_items_cfm_only) { + update_item.update(notification); + } }, -}; - -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); - - return m; + 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); + } + } }, - 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() { - # 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) { + + 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-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); @@ -426,35 +649,37 @@ var canvas_upperECAM_cfm_eis2 = { 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(); + } } - - 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) { + }, + 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-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); @@ -462,28 +687,50 @@ var canvas_upperECAM_cfm_eis2 = { 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(); + } } - - if (rev_2_act < 0.01 and fadec.FADEC.Eng2.n1 == 1) { - me["N12-thr"].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["N12-thr"].hide(); + me["N21"].hide(); + me["N21-decimal"].hide(); + me["N21-decpnt"].hide(); + me["N21-XX"].show(); } - - # 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); - + }, + 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); @@ -501,7 +748,9 @@ var canvas_upperECAM_cfm_eis2 = { 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); @@ -519,155 +768,11 @@ var canvas_upperECAM_cfm_eis2 = { 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)))); - - 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(); - } else { - me["N1Lim-mode"].hide(); - me["N1Lim-XX"].show(); - me["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(); - } else { - me["N1Lim"].hide(); - me["N1Lim-decpnt"].hide(); - me["N1Lim-decimal"].hide(); - me["N1Lim-percent"].hide(); - } - - me.updateBase(); }, -}; - -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); - - 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"]; - }, - update: func() { - 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(); - - # 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)); - - 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); - - if (fadec.FADEC.Eng1.epr == 1) { + + 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(); @@ -692,14 +797,10 @@ var canvas_upperECAM_iae_eis2 = { me["EPR1-XX"].show(); me["EPR1-XX2"].show(); } - - if (rev_1_act < 0.01 and fadec.FADEC.Eng1.epr == 1) { - me["EPR1-thr"].show(); - } else { - me["EPR1-thr"].hide(); - } - - if (fadec.FADEC.Eng2.epr == 1) { + }, + 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(); @@ -724,176 +825,9 @@ var canvas_upperECAM_iae_eis2 = { me["EPR2-XX"].show(); me["EPR2-XX2"].show(); } - - if (rev_2_act < 0.01 and fadec.FADEC.Eng2.epr == 1) { - me["EPR2-thr"].show(); - } else { - me["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()))); - - 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(); - } - - # 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)))); - - 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)))); - - 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); - - 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); - - 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(); - } 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 (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(); - } 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 (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 - } else { - me["N11-thr"].hide(); - me["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 - } else { - me["N12-thr"].hide(); - me["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)))); - - 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["FFlow1-weight-unit"].setText("KG/H"); - me["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"); - } - + }, + updateFF1: func() { + me._cachedFF[0] = fadec.FADEC.Eng1.ff; if (fadec.FADEC.Eng1.ff == 1) { me["FF1"].show(); me["FF1-XX"].hide(); @@ -901,7 +835,9 @@ var canvas_upperECAM_iae_eis2 = { 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(); @@ -909,87 +845,69 @@ var canvas_upperECAM_iae_eis2 = { me["FF2"].hide(); me["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)); - - 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(); - } else { - me["EPRLim-mode"].hide(); - me["EPRLim-XX"].show(); - me["EPRLim-XX2"].show(); - } - - if ((fadecPower1 or fadecPower2 or fadecPowerStart) and thrLimit != "MREV") { - me["EPRLim"].show(); - me["EPRLim-decpnt"].show(); - me["EPRLim-decimal"].show(); - } else { - me["EPRLim"].hide(); - me["EPRLim-decpnt"].hide(); - me["EPRLim-decimal"].hide(); - } - - me.updateBase(); }, -}; - -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); + 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(); } } - - me.page = canvas_group; - - return me; + + 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(); + } + + if (val.reverser_1 >= 0.95) { + me["REV1"].setColor(0.0509,0.7529,0.2941); + } else { + me["REV1"].setColor(0.7333,0.3803,0); + } }, - new: func(canvas_group, file) { - var m = {parents: [canvas_upperECAM_test]}; - m.init(canvas_group, file); - - return m; + 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(); + } + } + + 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); + } }, - getKeys: func() { - return ["Test_white","Test_text"]; - }, - update: func() { - elapsedtime = pts.Sim.Time.elapsedSec.getValue(); - if (du3_test_time.getValue() + 1 >= elapsedtime) { + + updateTest: func() { + if (du3_test_time.getValue() + 1 >= pts.Sim.Time.elapsedSec.getValue()) { me["Test_white"].show(); me["Test_text"].hide(); } else { @@ -997,82 +915,188 @@ var canvas_upperECAM_test = { me["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())); + 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 { - upperECAM_cfm_eis2[key].setColor(upperECAM_cfm_eis2.getColorString(node.getValue())); + du3_test.setValue(0); + du3_offtime.setValue(pts.Sim.Time.elapsedSec.getValue()); } - }, 0, 0); + }, + 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; + }, +}; -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(); +var A320EWD = UpperECAMRecipient.new("A320 E/WD"); +emesary.GlobalTransmitter.Register(A320EWD); - 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"); +input = { + fuelTotalLbs: "/consumables/fuel/total-fuel-lbs", + acconfigUnits: "/systems/acconfig/options/weight-kgs", + slatLocked: "/fdm/jsbsim/fcs/slat-locked", - 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"); + # 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]", - 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"); + # N2 parameters + N2_actual_1: "/engines/engine[0]/n2-actual", + N2_actual_2: "/engines/engine[1]/n2-actual", - upperECAM_update.start(); - if (rate.getValue() > 1) { - u_rateApply(); - } -}); + # 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", +}; -var u_rateApply = func { - upperECAM_update.restart(0.05 * rate.getValue()); +foreach (var name; keys(input)) { + emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Upper ECAM", name, input[name])); } -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); + dlg.setCanvas(A320EWD.MainScreen.canvas); } setlistener("/systems/electrical/bus/ac-ess", func() { - canvas_upperECAM_base.updateDu3(); + 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 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/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 2aa703d6..fa2c5a26 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; @@ -1374,10 +1320,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); @@ -1403,10 +1349,12 @@ var messages_priority_2 = func { if (yawDamperSysFault.clearFlag == 0 and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8 and phaseVar2 != 10 and warningNodes.Logic.yawDamper12Fault.getBoolValue()) { yawDamperSysFault.active = 1; - yawDamperSysFaultFac.active = 1; + yawDamperSysFaultFac1.active = 1; + yawDamperSysFaultFac2.active = 1; } else { ECAM_controller.warningReset(yawDamperSysFault); - ECAM_controller.warningReset(yawDamperSysFaultFac); + ECAM_controller.warningReset(yawDamperSysFaultFac1); + ECAM_controller.warningReset(yawDamperSysFaultFac2); } if (rudTravLimSysFault.clearFlag == 0 and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8 and warningNodes.Logic.rtlu12Fault.getBoolValue()) { @@ -2407,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"; @@ -2480,6 +2428,11 @@ var messages_memo = func { gpws_flap_mode_off.active = 0; } + if (!fmgc.FMGCInternal.flightNumSet and toMemoLine1.active != 1 and ldgMemoLine1.active != 1 and (phaseVarMemo2 <= 2 or phaseVarMemo2 == 6 or phaseVarMemo2 >= 9)) { + company_datalink_stby.active = 1; + } else { + company_datalink_stby.active = 0; + } } var messages_right_memo = func { @@ -2622,7 +2575,13 @@ var messages_right_memo = func { } else { ldg_lt.active = 0; } - + + if (mcdu.ReceivedMessagesDatabase.firstUnviewed() != -99 and (phaseVarMemo2 <= 2 or phaseVarMemo2 == 6 or phaseVarMemo2 >= 9)) { + company_msg.active = 1; + } else { + company_msg.active = 0; + } + if (getprop("/controls/ice-protection/leng") == 1 or getprop("/controls/ice-protection/reng") == 1 or getprop("/systems/electrical/bus/dc-1") == 0 or getprop("/systems/electrical/bus/dc-2") == 0) { eng_aice.active = 1; } else { diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index a62d76a9..5df843e6 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -287,7 +287,8 @@ var warnings = std.Vector.new([ var fac12FaultSuccess = warning.new(msg: " •IF UNSUCCESSFUL :", colour: "w"), var fac12FaultFacOff = warning.new(msg: " -FAC 1+2............OFF", colour: "c"), var yawDamperSysFault = warning.new(msg: "AUTO FLT YAW DAMPER SYS", colour: "a", aural: 1, light: 1, isMainMsg: 1), - var yawDamperSysFaultFac = warning.new(msg: " -FAC 1+2....OFF THEN ON", colour: "c"), + var yawDamperSysFaultFac1 = warning.new(msg: " -FAC 1......OFF THEN ON", colour: "c"), + var yawDamperSysFaultFac2 = warning.new(msg: " -FAC 2......OFF THEN ON", colour: "c"), # var rudderTrimSysFault = warning.new(msg: "AUTO FLT RUD TRIM SYS", colour: "a", aural: 1, light: 1, isMainMsg: 1), not implemented # var rudderTrimSysFaultFac = warning.new(msg: " -FAC 1+2....OFF THEN ON", colour: "c"), var rudTravLimSysFault = warning.new(msg: "AUTO FLT RUD TRV LIM SYS", colour: "a", aural: 1, light: 1, isMainMsg: 1), @@ -542,11 +543,9 @@ var memos = std.Vector.new([ var pred_ws_off = memo.new(msg: "PRED W/S OFF"), # Not yet implemented var terr_stby = memo.new(msg: "TERR STBY" ), # Not yet implemented var tcas_stby = memo.new(msg: "TCAS STBY" ), # Not yet implemented - var acars_call = memo.new(msg: "ACARS CALL" ), # Not yet implemented var company_call = memo.new(msg: "COMPANY CALL"), var satcom_alert = memo.new(msg: "SATCOM ALERT"), # Not yet implemented - var acars_msg = memo.new(msg: "ACARS MSG" ), # Not yet implemented - var company_msg = memo.new(msg: "COMPANY MSG" ), # Not yet implemented + var company_msg = memo.new(msg: "COMPANY MSG" ), var eng_aice = memo.new(msg: "ENG A.ICE" ), var wing_aice = memo.new(msg: "WING A.ICE" ), var ice_not_det = memo.new(msg: "ICE NOT DET" ), # Not yet implemented @@ -560,7 +559,6 @@ var memos = std.Vector.new([ var gpws_flap3 = memo.new(msg: "GPWS FLAP 3" ), var hf_data_ovrd = memo.new(msg: "HF DATA OVRD"), # Not yet implemented var hf_voice = memo.new(msg: "HF VOICE" ), # Not yet implemented - var acars_stby = memo.new(msg: "ACARS STBY" ), # Not yet implemented var vhf3_voice = memo.new(msg: "VHF3 VOICE" ), var auto_brk_lo = memo.new(msg: "AUTO BRK LO" ), var auto_brk_med = memo.new(msg: "AUTO BRK MED"), diff --git a/Nasal/ECAM/ECAM-phases.nas b/Nasal/ECAM/ECAM-phases.nas index a0188197..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 = { @@ -29,7 +24,7 @@ var FWC = { phase5: props.globals.initNode("/ECAM/phases/monostable/phase-5", 0, "BOOL"), phase7: props.globals.initNode("/ECAM/phases/monostable/phase-7", 0, "BOOL"), phase9: props.globals.initNode("/ECAM/phases/monostable/phase-9", 0, "BOOL"), - phase1Output: props.globals.initNode("/ECAM/phases/monostable/phase-1-output"), + phase1Output: props.globals.initNode("/ECAM/phases/monostable/phase-1-300-output"), phase5Output: props.globals.initNode("/ECAM/phases/monostable/phase-5-output"), phase7Output: props.globals.initNode("/ECAM/phases/monostable/phase-7-output"), phase9Output: props.globals.initNode("/ECAM/phases/monostable/phase-9-output"), @@ -53,24 +48,28 @@ 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"), + 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"), - altChg: props.globals.getNode("it-autoflight/input/alt-is-changing", 1), + toPower: props.globals.getNode("/ECAM/phases/phase-calculation/takeoff-power"), + altChg: props.globals.getNode("/it-autoflight/input/alt-is-changing", 1), }; var phaseLoop = func() { @@ -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,8 +107,8 @@ var phaseLoop = func() { FWC.Flipflop.phase10Reset.setBoolValue(0); } - if ((FWC.Logic.gnd.getBoolValue() and twoEngOff and myPhase == 9) and FWC.Flipflop.phase10Output.getBoolValue()) { - FWC.Monostable.phase1.setBoolValue(1); + 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/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/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 4141153e..792df12e 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -14,7 +14,14 @@ var SimbriefParser = { var stamp = systime(); http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml") .fail(func me.failure(i)) - .done(func me.read(getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml", i)); + .done(func { + var errs = []; + call(me.read, [(getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml"),i], SimbriefParser, {}, errs); + if (size(errs) > 0) { + debug.printerror(errs); + me.failure(i); + } + }); }, failure: func(i) { mcdu.mcdu_message(i, "SIMBRIEF DOWNLOAD FAILED"); @@ -25,141 +32,202 @@ var SimbriefParser = { if (data != nil) { if (data.getChild("OFP") == nil) { print("XML file " ~ xml ~ " not a valid Simbrief file"); + me.failure(i); + return; } else { me.node = data; - me.parseOFP(); - mcdu.mcdu_message(i, "AOC ACT F-PLN UPLINK"); + if (me.parseOFP() == nil) { + print("Failure to parse Simbrief OFP"); + me.failure(i); + } else { + mcdu.mcdu_message(i, "AOC ACT F-PLN UPLINK"); + } } } else { print("Error reading " ~ xml); + me.failure(i); } }, + tryFindByCoord: func(coords, id, type) { + var result = nil; + if (type == "nav") { + result = findNavaidsByID(id); + } elsif (type == "fix") { + result = findFixesByID(id); + } else { + return nil; + } + + if (size(result) == 0) { return nil; } + foreach (var test; result) { + if (math.abs(test.lat - coords.lat()) < 0.01666666666 and math.abs(test.lon - coords.lon()) < 0.01666666666) { + return test; + } + } + return nil; + }, + buildFlightplan: func() { + # Flightplan stuff + fmgc.flightPlanController.flightplans[3] = createFlightplan(); + fmgc.flightPlanController.flightplans[3].cleanPlan(); + + # INITA + var departureID = me.OFP.getNode("origin/icao_code").getValue(); + var departures = findAirportsByICAO(departureID); + var destinationID = me.OFP.getNode("destination/icao_code").getValue(); + var destinations = findAirportsByICAO(destinationID); + + 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.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); + + fmgc.updateArptLatLon(); + fmgc.updateARPT(); + } else { + me.cleanupInvalid(); + return nil; + } + + var runwayStore = departures[0].runways[me.OFP.getNode("origin/plan_rwy").getValue()]; + if (runwayStore != nil) { + fmgc.flightPlanController.flightplans[3].departure_runway = runwayStore; + } + + runwayStore = destinations[0].runways[me.OFP.getNode("destination/plan_rwy").getValue()]; + if (runwayStore != nil) { + fmgc.flightPlanController.flightplans[3].destination_runway = runwayStore; + } + + var alternateID = me.OFP.getNode("alternate/icao_code").getValue(); + var alternates = findAirportsByICAO(alternateID); + if (alternates != nil and size(alternates) != 0) { + fmgc.FMGCInternal.altAirport = alternateID; + atsu.ATISInstances[2].newStation(alternateID); + fmgc.FMGCInternal.altAirportSet = 1; + } + + var wps = []; + var ofpNavlog = me.OFP.getNode("navlog"); + var ofpFixes = ofpNavlog.getChildren("fix"); + var ident = ""; + var coords = nil; + var wp = nil; + var _foundSID = 0; + var _foundSTAR = 0; + var _foundTOC = 0; + var _foundTOD = 0; + var _sid = nil; + var _star = nil; + + foreach (var ofpFix; ofpFixes) { + if (ofpFix.getNode("is_sid_star").getBoolValue()) { + if (!_foundSID) { + _sid = fmgc.flightPlanController.flightplans[3].departure.getSid(ofpFix.getNode("via_airway").getValue()); + if (_sid != nil) { + _foundSID = 1; + } + } + } + + if (ofpFix.getNode("is_sid_star").getBoolValue()) { + if (!_foundSTAR) { + _star = fmgc.flightPlanController.flightplans[3].destination.getStar(ofpFix.getNode("via_airway").getValue()); + if (_star != nil) { + _foundSTAR = 1; + } + } + } + + if (ofpFix.getNode("is_sid_star").getBoolValue() and _foundSID and _foundSTAR) { + continue; + } # todo what happens if you don't find one but find the other + + ident = ofpFix.getNode("ident").getValue(); + if (find(departureID, ident) != -1 or find(destinationID, ident) != -1) { + continue; + } + + if (ident == "TOC") { + _foundTOC = 1; + continue; + } + + if (ident == "TOD") { + _foundTOC = 1; + continue; + } + + coords = geo.Coord.new(); + coords.set_latlon( + ofpFix.getNode("pos_lat").getValue(), + ofpFix.getNode("pos_long").getValue()); + + wp = me.tryFindByCoord(coords,ident,"fix"); + wp = me.tryFindByCoord(coords,ident,"nav"); + if (wp == nil) { + wp = createWP(coords, ident); + } + + append(wps, wp); + } + + fmgc.flightPlanController.flightplans[3].insertWaypoints(wps, 1); + if (_sid != nil) { + fmgc.flightPlanController.flightplans[3].sid = _sid; + } + if (_star != nil) { + fmgc.flightPlanController.flightplans[3].star = _star; + } + fmgc.flightPlanController.destroyTemporaryFlightPlan(3, 1); + fmgc.windController.updatePlans(); + fmgc.updateRouteManagerAlt(); + + return 1; + }, parseOFP: func() { me.OFP = me.node.getChild("OFP"); - me.store1 = nil; - me.store2 = nil; - - me.store1 = me.OFP.getChild("params"); - var units = me.store1.getChild("units").getValue(); - - me.store1 = me.OFP.getChild("general"); - me.store2 = me.OFP.getChild("alternate"); - fmgc.FMGCInternal.flightNum = (me.store1.getChild("icao_airline").getValue() or "") ~ (me.store1.getChild("flight_number").getValue() or ""); + if (me.buildFlightplan() == nil) { + return nil; + } + fmgc.FMGCInternal.flightNum = (me.OFP.getNode("general/icao_airline").getValue() or "") ~ (me.OFP.getNode("general/flight_number").getValue() or ""); fmgc.FMGCInternal.flightNumSet = 1; - fmgc.FMGCInternal.costIndex = me.store1.getChild("costindex").getValue(); + fmgc.FMGCInternal.costIndex = me.OFP.getNode("general/costindex").getValue(); fmgc.FMGCInternal.costIndexSet = 1; fmgc.FMGCNodes.costIndex.setValue(fmgc.FMGCInternal.costIndex); - fmgc.FMGCInternal.tropo = me.store1.getChild("avg_tropopause").getValue(); + fmgc.FMGCInternal.tropo = me.OFP.getNode("general/avg_tropopause").getValue(); fmgc.FMGCInternal.tropoSet = 1; - fmgc.FMGCInternal.crzFt = me.store1.getChild("initial_altitude").getValue(); - fmgc.FMGCInternal.crzFl = me.store1.getChild("initial_altitude").getValue() / 100; - fmgc.altvert(); - fmgc.FMGCInternal.crzSet = 1; + + # Set cruise altitude + fmgc.FMGCInternal.crzFt = me.OFP.getNode("general/initial_altitude").getValue(); + fmgc.FMGCInternal.crzFl = fmgc.FMGCInternal.crzFt / 100; + fmgc.FMGCInternal.crzTemp = (((fmgc.FMGCInternal.crzFt / 1000) * -2) + 15) + me.OFP.getNode("general/avg_temp_dev").getValue(); + fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFt / 100; mcdu.updateCrzLvlCallback(); - fmgc.FMGCInternal.crzTemp = (((me.store1.getChild("initial_altitude").getValue() / 1000) * -2) + 15) + me.store1.getChild("avg_temp_dev").getValue(); fmgc.FMGCInternal.crzTempSet = 1; - fmgc.FMGCInternal.crzProg = me.store1.getChild("initial_altitude").getValue() / 100; - if (num(me.store1.getChild("avg_wind_comp").getValue()) >= 0) { - fmgc.FMGCInternal.tripWind = "TL" ~ abs(me.store1.getChild("avg_wind_comp").getValue()); + fmgc.FMGCInternal.crzSet = 1; + fmgc.altvert(); + + var windComp = me.OFP.getNode("general/avg_wind_comp").getValue(); + if (num(windComp) >= 0) { + fmgc.FMGCInternal.tripWind = "TL" ~ abs(windComp); } else { - fmgc.FMGCInternal.tripWind = "HD" ~ abs(me.store1.getChild("avg_wind_comp").getValue()); + fmgc.FMGCInternal.tripWind = "HD" ~ abs(windComp); } - fmgc.FMGCInternal.tripWindValue = abs(me.store1.getChild("avg_wind_comp").getValue()); - - fmgc.FMGCInternal.altAirport = me.store2.getChild("icao_code").getValue(); - fmgc.FMGCInternal.altAirportSet = 1; - - # Flightplan stuff - fmgc.flightPlanController.flightplans[3] = createFlightplan(); - - # INITA - me.store1 = me.OFP.getChild("origin"); - me.store2 = me.OFP.getChild("destination"); - - fmgc.FMGCInternal.depApt = me.store1.getChild("icao_code").getValue(); - fmgc.FMGCInternal.arrApt = me.store2.getChild("icao_code").getValue(); - fmgc.FMGCInternal.toFromSet = 1; - fmgc.FMGCNodes.toFromSet.setValue(1); - fmgc.flightPlanController.flightplans[3].departure = airportinfo(fmgc.FMGCInternal.depApt); - fmgc.flightPlanController.flightplans[3].destination = airportinfo(fmgc.FMGCInternal.arrApt); - fmgc.FMGCInternal.altSelected = 0; - fmgc.updateArptLatLon(); - fmgc.updateARPT(); - call(func() { - fmgc.flightPlanController.flightplans[3].departure_runway = airportinfo(fmgc.FMGCInternal.depApt).runways[me.store1.getChild("plan_rwy").getValue()]; - fmgc.flightPlanController.flightplans[3].destination_runway = airportinfo(fmgc.FMGCInternal.arrApt).runways[me.store2.getChild("plan_rwy").getValue()]; - }); - - me.store1 = me.OFP.getChild("navlog").getChildren(); - if (size(me.store1) != 0) { - var firstIsSID = 0; - var SIDID = ""; - if (me.store1[0].getChild("is_sid_star").getValue() == 1) { - if (fmgc.flightPlanController.flightplans[3].departure.getSid(me.store1[0].getChild("via_airway").getValue()) != nil) { - firstIsSID = 1; - SIDID = me.store1[0].getChild("via_airway").getValue(); - } - } - var lastIsSTAR = 0; - var STARID = ""; - if (me.store1[-1].getChild("is_sid_star").getValue() == 1) { - if (fmgc.flightPlanController.flightplans[3].destination.getStar(me.store1[-1].getChild("via_airway").getValue()) != nil) { - lastIsSTAR = 1; - STARID = me.store1[-1].getChild("via_airway").getValue(); - } - } - - var lastSIDIndex = -999; - var firstSTARIndex = -999; - var TOCinSIDflag = 0; - var TODinSTARflag = 0; - for (var i = 0; i < size(me.store1); i = i + 1) { - if (firstIsSID) { - if (me.store1[i].getChild("is_sid_star").getValue() == 0 or me.store1[i].getChild("via_airway").getValue() != SIDID) { - lastSIDIndex = i - 1; - break; - } - } - } - - for (var i = lastSIDIndex == -999 ? 0 : lastSIDIndex; i < size(me.store1); i = i + 1) { - if (STARID != "") { - if (me.store1[i].getChild("is_sid_star").getValue() == 1 and me.store1[i].getChild("via_airway").getValue() == STARID) { - firstSTARIndex = i; - break; - } - } - } - - var max = firstSTARIndex == -999 ? size(me.store1) - 1 : firstSTARIndex - 1; - for (var i = lastSIDIndex == -999 ? 0 : lastSIDIndex + 2; i < max; i = i + 1) { - if (me.store1[i].getChild("ident").getValue() == "TOC" or me.store1[i].getChild("ident").getValue() == "TOD") { continue; } - var coord = geo.Coord.new(); - coord.set_latlon(me.store1[i].getChild("pos_lat").getValue(), me.store1[i].getChild("pos_long").getValue()); - var fixes = findFixesByID(coord, me.store1[i].getChild("ident").getValue()); - var navaids = findNavaidsByID(coord, me.store1[i].getChild("ident").getValue()); - if (size(fixes) > 0) { - fmgc.flightPlanController.flightplans[3].appendWP(createWPFrom(fixes[0])); - } else if (size(navaids) > 0) { - fmgc.flightPlanController.flightplans[3].appendWP(createWPFrom(navaids[0])); - } else { - var WP = createWP(coord, me.store1[i].getChild("ident").getValue()); - fmgc.flightPlanController.flightplans[3].appendWP(WP); - } - } - fmgc.flightPlanController.flightplans[3].sid = fmgc.flightPlanController.flightplans[3].departure.getSid(SIDID); - fmgc.flightPlanController.flightplans[3].star = fmgc.flightPlanController.flightplans[3].destination.getStar(STARID); - } - fmgc.flightPlanController.destroyTemporaryFlightPlan(3, 1); - - fmgc.windController.updatePlans(); - fmgc.updateRouteManagerAlt(); + fmgc.FMGCInternal.tripWindValue = abs(windComp); # INITB me.store1 = me.OFP.getChild("fuel"); me.store2 = me.OFP.getChild("weights"); - if (units == "lbs") { + if (me.OFP.getNode("params/units").getValue() == "lbs") { fmgc.FMGCInternal.taxiFuel = me.store1.getChild("taxi").getValue() / 1000; fmgc.FMGCInternal.taxiFuelSet = 1; fmgc.FMGCInternal.altFuel = me.store1.getChild("alternate_burn").getValue() / 1000; @@ -206,5 +274,7 @@ var SimbriefParser = { fmgc.FMGCInternal.blockCalculating = 0; fmgc.blockCalculating.setValue(0); fmgc.FMGCInternal.blockConfirmed = 1; + + return 1; }, }; \ No newline at end of file diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index f7aa6575..8ac87b43 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -173,6 +173,7 @@ var MessageController = { TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),TypeIMessage.new("RWY/LS MISMATCH"), TypeIMessage.new("VHF3 VOICE MSG NOT GEN"),TypeIMessage.new("NO COMM MSG NOT GEN"),TypeIMessage.new("WX UPLINK"), TypeIMessage.new("SIMBRIEF DOWNLOAD FAILED"),TypeIMessage.new("MISSING USERNAME"),TypeIMessage.new("AOC ACT F-PLN UPLINK"), + TypeIMessage.new("NO ANSWER TO REQUEST"),TypeIMessage.new("NO D-ATIS AVAILABLE"),TypeIMessage.new("BAD SERVER RESPONSE") ]), typeIIMessages: std.Vector.new([ TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"), diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index c0ef6ad0..426258dc 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -387,7 +387,7 @@ controls.stepSpoilers = func(step) { } var deploySpeedbrake = func { - if (pts.Gear.Wow[1].getBoolValue() or pts.Gear.Wow[2].getBoolValue()) { + if (pts.Gear.wow[1].getBoolValue() or pts.Gear.wow[2].getBoolValue()) { if (pts.Controls.Flight.speedbrake.getValue() < 1.0) { pts.Controls.Flight.speedbrake.setValue(1.0); } @@ -401,7 +401,7 @@ var deploySpeedbrake = func { } var retractSpeedbrake = func { - if (pts.Gear.Wow[1].getBoolValue() or pts.Gear.Wow[2].getBoolValue()) { + if (pts.Gear.wow[1].getBoolValue() or pts.Gear.wow[2].getBoolValue()) { if (pts.Controls.Flight.speedbrake.getValue() > 0.0) { pts.Controls.Flight.speedbrake.setValue(0.0); } diff --git a/Nasal/MCDU/ATIS.nas b/Nasal/MCDU/ATIS.nas new file mode 100644 index 00000000..520796cf --- /dev/null +++ b/Nasal/MCDU/ATIS.nas @@ -0,0 +1,111 @@ +var atisPage = { + title: nil, + fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]], + L1: [nil, nil, "ack"], # content, title, colour + L2: [nil, nil, "ack"], + L3: [nil, nil, "ack"], + L4: [nil, nil, "ack"], + L5: [nil, nil, "ack"], + L6: [nil, nil, "ack"], + C1: [nil, nil, "ack"], + C2: [nil, nil, "ack"], + C3: [nil, nil, "ack"], + C4: [nil, nil, "ack"], + C5: [nil, nil, "ack"], + C6: [nil, nil, "ack"], + R1: [nil, nil, "ack"], + R2: [nil, nil, "ack"], + R3: [nil, nil, "ack"], + R4: [nil, nil, "ack"], + R5: [nil, nil, "ack"], + R6: [nil, nil, "ack"], + computer: nil, + size: 0, + new: func(computer, index) { + var ap = {parents:[atisPage]}; + ap.computer = computer; + ap.page = 1; + ap.index = index; + ap.message = atsu.ATISInstances[index].lastATIS; + ap._setupPageWithData(); + ap._numPages = 1; + ap.update(); + return ap; + }, + del: func() { + return nil; + }, + getNumPages: func() { + me._numPages = math.ceil(size(me.message) / 210); + return me._numPages; + }, + scrollUp: func() { + me.page -= 1; + if (me.page < 1) { + me.page = me.getNumPages(); + } + me.update(); + }, + scrollDown: func() { + me.page += 1; + if (me.page > me.getNumPages()) { + me.page = 1; + } + me.update(); + }, + _clearPage: func() { + me.L2 = [nil, nil, "wht"]; + me.L3 = [nil, nil, "wht"]; + me.L4 = [nil, nil, "wht"]; + me.C1 = [nil, nil, "ack"]; + me.C2 = [nil, nil, "ack"]; + me.C3 = [nil, nil, "ack"]; + me.C4 = [nil, nil, "ack"]; + me.C5 = [nil, nil, "ack"]; + me.R2 = [nil, nil, "ack"]; + me.R3 = [nil, nil, "ack"]; + me.R4 = [nil, nil, "ack"]; + me.R5 = [nil, nil, "ack"]; + me.arrowsMatrix = [[0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0]]; + }, + _setupPageWithData: func() { + me.title = atsu.ATISInstances[me.index].station ~ "/" ~ (atsu.ATISInstances[me.index].type == 0 ? "ARR" : "DEP") ~ " ATIS "; + me.L5 = [" PREV ATIS", nil, "wht"]; + me.L6 = [" RETURN", " ATIS MENU", "wht"]; + me.R6 = ["PRINT ", nil, "blu"]; + me.arrowsMatrix = [[0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1]]; + me.arrowsColour = [["ack", "ack", "ack", "ack", "wht", "wht"], ["ack", "ack", "ack", "ack", "ack", "blu"]]; + me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + }, + update: func() { + me._clearPage(); + var message = atsu.ATISInstances[me.index].lastATIS; + var pageMinusOne = (me.page - 1); + var numberExtraChar = pageMinusOne * 210; + me.L1 = [substr(message, numberExtraChar, 30), atsu.ATISInstances[me.index].station ~ "/" ~ (atsu.ATISInstances[me.index].type == 0 ? "ARR" : "DEP"), "wht"]; + me.R1 = [" ",atsu.DictionaryString.fetchString1(atsu.ATISInstances[me.index].receivedCode).string2 ~ " " ~ atsu.ATISInstances[me.index].receivedTime ~ "Z", "wht"]; + if (size(message) > 30) { + me.L2[1] = substr(message, numberExtraChar + 30, 30); + } + if (size(message) > 60) { + me.L2[0] = substr(message, numberExtraChar + 60, 30); + } + if (size(message) > 90) { + me.L3[1] = substr(message, numberExtraChar + 90, 30); + } + if (size(message) > 120) { + me.L3[0] = substr(message, numberExtraChar + 120, 30); + } + if (size(message) > 150) { + me.L4[1] = substr(message, numberExtraChar + 150, 30); + } + if (size(message) > 180) { + me.L4[0] = substr(message, numberExtraChar + 180, 30); + } + + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + }, +}; \ No newline at end of file diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index e5cb5104..e734af23 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -27,6 +27,7 @@ var initInputA = func(key, i) { if (tfs == 4) { fmgc.FMGCInternal.altAirport = scratchpad; fmgc.FMGCInternal.altAirportSet = 1; + atsu.ATISInstances[2].newStation(scratchpad); fmgc.windController.updatePlans(); if (fmgc.FMGCInternal.blockConfirmed) { fmgc.FMGCInternal.fuelCalculating = 0; @@ -219,6 +220,8 @@ var initInputA = func(key, i) { } fmgc.FMGCInternal.depApt = fromto[0]; fmgc.FMGCInternal.arrApt = fromto[1]; + atsu.ATISInstances[0].newStation(fromto[0]); + atsu.ATISInstances[1].newStation(fromto[1]); fmgc.FMGCInternal.toFromSet = 1; fmgc.FMGCNodes.toFromSet.setValue(1); #scratchpad diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 97754a25..05d5d240 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -5,6 +5,7 @@ var pageNode = [props.globals.getNode("/MCDU[0]/page"), props.globals.getNode("/MCDU[1]/page")]; var page = nil; +var msg = nil; var scratchpadNode = [nil, nil]; var MCDU_init = func(i) { @@ -285,6 +286,74 @@ var lskbutton = func(btn, i) { pageNode[i].setValue("WEATHERREQ"); } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(1); + } else if (page == "ATIS") { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (scratchpad == "CLR") { + if (atsu.ATISInstances[0].sent != 1) { + if (fmgc.FMGCInternal.depApt != "") { + atsu.ATISInstances[0].newStation(fmgc.FMGCInternal.depApt); + } else { + atsu.ATISInstances[0].station = nil; + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } elsif (size(scratchpad) == 0) { + if (atsu.ATISInstances[0].received) { + canvas_mcdu.myAtis[i] = atisPage.new(i, 0); + pageNode[i].setValue("ATISDETAIL"); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } elsif (find("/", scratchpad) != -1) { + var str = split("/", scratchpad); + if (size(str[0]) > 0 and size(str[1]) == 0) { + var result = atsu.ATISInstances[0].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } elsif (size(str[0]) == 0 and size(str[1]) > 0) { + if (str[1] == "DEP") { + atsu.ATISInstances[0].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[0].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + mcdu_scratchpad.scratchpads[i].empty(); + } elsif (size(str[0]) > 0 and size(str[1]) > 0) { + var result = atsu.ATISInstances[0].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } + if (str[1] == "DEP") { + atsu.ATISInstances[0].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[0].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + var result = atsu.ATISInstances[0].newStation(scratchpad); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -356,7 +425,76 @@ var lskbutton = func(btn, i) { } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(2); } else if (page == "DATAMODE") { - atsu.ATIS.server = 0; + atsu.ATIS.serverSel.setValue("faa"); + acconfig.writeSettings(); + } else if (page == "ATIS") { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (scratchpad == "CLR") { + if (atsu.ATISInstances[1].sent != 1) { + if (fmgc.FMGCInternal.arrApt != "") { + atsu.ATISInstances[1].newStation(fmgc.FMGCInternal.arrApt); + } else { + atsu.ATISInstances[1].station = nil; + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } elsif (size(scratchpad) == 0) { + if (atsu.ATISInstances[1].received) { + canvas_mcdu.myAtis[i] = atisPage.new(i, 1); + pageNode[i].setValue("ATISDETAIL"); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } elsif (find("/", scratchpad) != -1) { + var str = split("/", scratchpad); + if (size(str[0]) > 0 and size(str[1]) == 0) { + var result = atsu.ATISInstances[1].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } elsif (size(str[0]) == 0 and size(str[1]) > 0) { + if (str[1] == "DEP") { + atsu.ATISInstances[1].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[1].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + mcdu_scratchpad.scratchpads[i].empty(); + } elsif (size(str[0]) > 0 and size(str[1]) > 0) { + var result = atsu.ATISInstances[1].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } + if (str[1] == "DEP") { + atsu.ATISInstances[1].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[1].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + var result = atsu.ATISInstances[1].newStation(scratchpad); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -411,7 +549,76 @@ var lskbutton = func(btn, i) { } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(3); } else if (page == "DATAMODE") { - atsu.ATIS.server = 1; + atsu.ATIS.serverSel.setValue("vatsim"); + acconfig.writeSettings(); + } else if (page == "ATIS") { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (scratchpad == "CLR") { + if (atsu.ATISInstances[2].sent != 1) { + if (fmgc.FMGCInternal.altAirportSet) { + atsu.ATISInstances[2].newStation(fmgc.FMGCInternal.altAirport); + } else { + atsu.ATISInstances[2].station = nil; + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } elsif (size(scratchpad) == 0) { + if (atsu.ATISInstances[2].received) { + canvas_mcdu.myAtis[i] = atisPage.new(i, 2); + pageNode[i].setValue("ATISDETAIL"); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } elsif (find("/", scratchpad) != -1) { + var str = split("/", scratchpad); + if (size(str[0]) > 0 and size(str[1]) == 0) { + var result = atsu.ATISInstances[2].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } elsif (size(str[0]) == 0 and size(str[1]) > 0) { + if (str[1] == "DEP") { + atsu.ATISInstances[2].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[2].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + mcdu_scratchpad.scratchpads[i].empty(); + } elsif (size(str[0]) > 0 and size(str[1]) > 0) { + var result = atsu.ATISInstances[2].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } + if (str[1] == "DEP") { + atsu.ATISInstances[2].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[2].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + var result = atsu.ATISInstances[2].newStation(scratchpad); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -460,6 +667,70 @@ var lskbutton = func(btn, i) { } } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(4); + } else if (page == "ATIS") { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (scratchpad == "CLR") { + if (atsu.ATISInstances[3].sent != 1) { + atsu.ATISInstances[3].station = nil; + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } elsif (size(scratchpad) == 0) { + if (atsu.ATISInstances[3].received) { + canvas_mcdu.myAtis[i] = atisPage.new(i, 3); + pageNode[i].setValue("ATISDETAIL"); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } elsif (find("/", scratchpad) != -1) { + var str = split("/", scratchpad); + if (size(str[0]) > 0 and size(str[1]) == 0) { + var result = atsu.ATISInstances[3].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } elsif (size(str[0]) == 0 and size(str[1]) > 0) { + if (str[1] == "DEP") { + atsu.ATISInstances[3].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[3].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + mcdu_scratchpad.scratchpads[i].empty(); + } elsif (size(str[0]) > 0 and size(str[1]) > 0) { + var result = atsu.ATISInstances[3].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } + if (str[1] == "DEP") { + atsu.ATISInstances[3].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[3].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + var result = atsu.ATISInstances[3].newStation(scratchpad); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -585,6 +856,12 @@ var lskbutton = func(btn, i) { pageNode[i].setValue("ATSUDLINK"); } else if (page == "COMMINIT" or page == "VOICEDIRECTORY" or page == "DATAMODE" or page == "COMMSTATUS" or page == "COMPANYCALL") { pageNode[i].setValue("COMMMENU"); + } else if (page == "ATIS") { + pageNode[i].setValue("ATCMENU2"); + } else if (page == "ATISDETAIL") { + pageNode[i].setValue("ATIS"); + } else if (page == "AOCCONFIG") { + pageNode[i].setValue("AOCMENU"); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -666,6 +943,14 @@ var rskbutton = func(btn, i) { } else if (page == "WEATHERTYPE") { atsu.AOC.selectedType = "TERM FCST"; pageNode[i].setValue("WEATHERREQ"); + } else if (page == "ATCMENU2") { + pageNode[i].setValue("ATIS"); + } else if (page == "ATIS") { + if (atsu.ATISInstances[0].station != nil and atsu.ATISInstances[0].sent != 1) { + atsu.ATISInstances[0].sendReq(i); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -698,7 +983,14 @@ var rskbutton = func(btn, i) { } else if (page == "AOCMENU") { pageNode[i].setValue("WEATHERREQ"); } else if (page == "DATAMODE") { - atsu.AOC.server = 0; + atsu.AOC.server.setValue("noaa"); + acconfig.writeSettings(); + } else if (page == "ATIS") { + if (atsu.ATISInstances[1].station != nil and atsu.ATISInstances[1].sent != 1) { + atsu.ATISInstances[1].sendReq(i); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -737,7 +1029,14 @@ var rskbutton = func(btn, i) { canvas_mcdu.myReceivedMessages[i] = receivedMessagesPage.new(i); pageNode[i].setValue("RECEIVEDMSGS"); } else if (page == "DATAMODE") { - atsu.AOC.server = 1; + atsu.AOC.server.setValue("vatsim"); + acconfig.writeSettings(); + } else if (page == "ATIS") { + if (atsu.ATISInstances[2].station != nil and atsu.ATISInstances[2].sent != 1) { + atsu.ATISInstances[2].sendReq(i); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -798,6 +1097,12 @@ var rskbutton = func(btn, i) { canvas_mcdu.myArrival[i].arrPushbuttonRight(4); } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonRight(4); + } else if (page == "ATIS") { + if (atsu.ATISInstances[3].station != nil and atsu.ATISInstances[3].sent != 1) { + atsu.ATISInstances[3].sendReq(i); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -884,7 +1189,7 @@ var rskbutton = func(btn, i) { } elsif (result == 4) { mcdu.mcdu_message(i, "NO COMM MSG NOT GEN"); } else { - mcdu_scratchpad.scratchpads[i].empty(); + pageNode[i].setValue("AOCMENU"); } } else if (page == "VOICEDIRECTORY") { for (var i = 0; i < 3; i = i + 1) { @@ -892,6 +1197,8 @@ var rskbutton = func(btn, i) { rmp.transfer(i + 1); } } + } else if (page == "AOCMENU") { + pageNode[i].setValue("AOCCONFIG"); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -944,6 +1251,13 @@ var rskbutton = func(btn, i) { pageNode[i].setValue("COMMMENU"); } else if (page == "CONNECTSTATUS") { pageNode[i].setValue("NOTIFICATION"); + } else if (page == "AOCMENU") { + msg = mcdu.ReceivedMessagesDatabase.firstUnviewed(); + if (msg != -99) { + canvas_mcdu.myReceivedMessages[i] = receivedMessagesPage.new(i); + canvas_mcdu.myReceivedMessage[i] = receivedMessagePage.new(i, msg); + pageNode[i].setValue("RECEIVEDMSG"); + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -1029,6 +1343,8 @@ var arrowbutton = func(btn, i) { initInputIRS("up",i); } else if (page == "WINDCRZ") { canvas_mcdu.myCRZWIND[i].pushButtonUp(); + } else if (page == "ATISDETAIL") { + canvas_mcdu.myAtis[i].scrollUp(); } } else if (btn == "down") { if (page == "F-PLNA" or page == "F-PLNB") { @@ -1043,6 +1359,8 @@ var arrowbutton = func(btn, i) { initInputIRS("down",i); } else if (page == "WINDCRZ") { canvas_mcdu.myCRZWIND[i].pushButtonDown(); + } else if (page == "ATISDETAIL") { + canvas_mcdu.myAtis[i].scrollDown(); } } } @@ -1088,7 +1406,7 @@ var pagebutton = func(btn, i) { pageNode[i].setValue("DATA"); } else if (btn == "mcdu") { var page = page; - if (page != "ATSUDLINK" and page != "AOCMENU" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "RECEIVEDMSG" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT") { + if (page != "ATSUDLINK" and page != "AOCMENU" and page != "AOCCONFIG" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "RECEIVEDMSG" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT" and page != "ATIS" and page != "ATISDETAIL") { setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", page); } else { setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page); diff --git a/Nasal/MCDU/RECEIVEDMESSAGES.nas b/Nasal/MCDU/RECEIVEDMESSAGES.nas index 1430ca53..13018346 100644 --- a/Nasal/MCDU/RECEIVEDMESSAGES.nas +++ b/Nasal/MCDU/RECEIVEDMESSAGES.nas @@ -73,7 +73,7 @@ var receivedMessagesPage = { if (me.size >= (me.curPage * 5) + -4) { message = ReceivedMessagesDatabase.database.vector[-5 + (me.curPage * 5)]; - me.L1[0] = " " ~ left(message.body, 23); + me.L1[0] = " " ~ left(message.body, size(message.body) > 23 ? 23 : size(message.body)); me.L1[2] = "blu"; if (!message.viewed) { me.L1[1] = " " ~ message.time ~ " NEW"; @@ -85,7 +85,7 @@ var receivedMessagesPage = { if (me.size >= (me.curPage * 5) + -3) { message = ReceivedMessagesDatabase.database.vector[-4 + (me.curPage * 5)]; - me.L2[0] = " " ~ left(message.body, 23); + me.L2[0] = " " ~ left(message.body, size(message.body) > 23 ? 23 : size(message.body)); me.L2[2] = "blu"; if (!message.viewed) { me.L2[1] = " " ~ message.time ~ " NEW"; @@ -97,7 +97,7 @@ var receivedMessagesPage = { if (me.size >= (me.curPage * 5) + -2) { message = ReceivedMessagesDatabase.database.vector[-3 + (me.curPage * 5)]; - me.L3[0] = " " ~ left(message.body, 23); + me.L3[0] = " " ~ left(message.body, size(message.body) > 23 ? 23 : size(message.body)); me.L3[2] = "blu"; if (!message.viewed) { me.L3[1] = " " ~ message.time ~ " NEW"; @@ -109,7 +109,7 @@ var receivedMessagesPage = { if (me.size >= (me.curPage * 5) + -1) { message = ReceivedMessagesDatabase.database.vector[-2 + (me.curPage * 5)]; - me.L4[0] = " " ~ left(message.body, 23); + me.L4[0] = " " ~ left(message.body, size(message.body) > 23 ? 23 : size(message.body)); me.L4[2] = "blu"; if (!message.viewed) { me.L4[1] = " " ~ message.time ~ " NEW"; @@ -121,7 +121,7 @@ var receivedMessagesPage = { if (me.size >= (me.curPage * 5) + 0) { message = ReceivedMessagesDatabase.database.vector[-1 + (me.curPage * 5)]; - me.L5[0] = " " ~ left(message.body, 23); + me.L5[0] = " " ~ left(message.body, size(message.body) > 23 ? 23 : size(message.body)); me.L5[2] = "blu"; if (!message.viewed) { me.L5[1] = " " ~ message.time ~ " NEW"; @@ -134,8 +134,19 @@ var receivedMessagesPage = { }, leftKey: func(index) { if (ReceivedMessagesDatabase.getSize() >= (-5 + index + (me.curPage * 5))) { - canvas_mcdu.myReceivedMessage[me.computer] = receivedMessagePage.new(me.computer, (-6 + index + (me.curPage * 5))); - setprop("MCDU[" ~ me.computer ~ "]/page", "RECEIVEDMSG"); + if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") { + ReceivedMessagesDatabase.removeAtIndex(-6 + index + (me.curPage * 5)); + me.update(); + if (ReceivedMessagesDatabase.getSize() < (me.curPage * 5) and ReceivedMessagesDatabase.getSize() >= 5) { + me.scrollLeft(); + } + mcdu_scratchpad.scratchpads[me.computer].empty(); + } elsif (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 0) { + canvas_mcdu.myReceivedMessage[me.computer] = receivedMessagePage.new(me.computer, (-6 + index + (me.curPage * 5))); + setprop("MCDU[" ~ me.computer ~ "]/page", "RECEIVEDMSG"); + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } } else { mcdu_message(me.computer, "NOT ALLOWED"); } @@ -288,12 +299,23 @@ var ReceivedMessagesDatabase = { canvas_mcdu.myReceivedMessages[1].update(); } }, + firstUnviewed: func() { + for (var i = 0; i < me.getSize(); i = i + 1) { + if (!me.database.vector[i].viewed) { + return i; + } + } + return -99; + }, getCountPages: func() { - return math.ceil(me.database.size() / 5); + return math.ceil(me.getSize() / 5); }, getSize: func() { return me.database.size(); }, + removeAtIndex: func(index) { + return me.database.pop(index); + }, clearDatabase: func() { me.database.clear(); }, 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/CPDLC.nas b/Nasal/Systems/Comm/CPDLC.nas index ca01dc3c..fb680947 100644 --- a/Nasal/Systems/Comm/CPDLC.nas +++ b/Nasal/Systems/Comm/CPDLC.nas @@ -2,41 +2,6 @@ # Jonathan Redpath # Copyright (c) 2020 Josh Davidson (Octal450) -var DictionaryItem = { - new: func(item, string) { - var DI = {parents: [DictionaryItem]}; - DI.item = item; - DI.string = string; - return DI; - }, -}; - -var Dictionary = { - database: std.Vector.new(), - addToDatabase: func(dictItem) { - me.database.append(dictItem); - }, - fetchString: func(string) { - foreach (var item; me.database.vector) { - if (me.item.string == string) { - return item; - } - } - }, - fetchItem: func(itemObj) { - foreach (var item; me.database.vector) { - if (item.item == itemObj) { - return item; - } - } - }, -}; - -makeNewDictionaryItem = func(item, string) { - var dictItem = DictionaryItem.new(item, string); - Dictionary.addToDatabase(dictItem); -}; - var CPDLCmessage = { new: func(text) { var cpdlcMessage = {parents: [CPDLCmessage] }; diff --git a/Nasal/Systems/Comm/Dictionary.nas b/Nasal/Systems/Comm/Dictionary.nas new file mode 100644 index 00000000..8d9e2655 --- /dev/null +++ b/Nasal/Systems/Comm/Dictionary.nas @@ -0,0 +1,75 @@ +# A3XX Dictionary +# Jonathan Redpath + +# Copyright (c) 2020 Josh Davidson (Octal450) +var DictionaryItemObj = { + new: func(item, string) { + var DI = {parents: [DictionaryItemObj]}; + DI.item = item; + DI.string = string; + return DI; + }, +}; + +var DictionaryObj = { + database: std.Vector.new(), + addToDatabase: func(dictItem) { + me.database.append(dictItem); + }, + fetchString: func(string) { + foreach (var item; me.database.vector) { + if (me.item.string == string) { + return item; + } + } + }, + fetchItem: func(itemObj) { + foreach (var item; me.database.vector) { + if (item.item == itemObj) { + return item; + } + } + }, +}; + +var makeNewDictionaryItem = func(item, string) { + var dictItem = DictionaryItemObj.new(item, string); + DictionaryObj.addToDatabase(dictItem); +}; + +var DictionaryItemString = { + new: func(string1, string2) { + var DI = {parents: [DictionaryItemString]}; + DI.string1 = string1; + DI.string2 = string2; + return DI; + }, +}; + +var DictionaryString = { + database: std.Vector.new(), + addToDatabase: func(dictItem) { + me.database.append(dictItem); + }, + fetchString1: func(stringSearch) { + foreach (var item; me.database.vector) { + if (string.uc(item.string1) == string.uc(stringSearch)) { + return item; + } + } + return ""; + }, + fetchString2: func(stringSearch) { + foreach (var item; me.database.vector) { + if (string.uc(item.string2) == string.uc(stringSearch)) { + return item; + } + } + return ""; + }, +}; + +var makeNewDictionaryString = func(string1, string2) { + var dictItem = DictionaryItemString.new(string1, string2); + DictionaryString.addToDatabase(dictItem); +}; \ No newline at end of file diff --git a/Nasal/Systems/Comm/Notification.nas b/Nasal/Systems/Comm/Notification.nas index 642a5386..c87f6305 100644 --- a/Nasal/Systems/Comm/Notification.nas +++ b/Nasal/Systems/Comm/Notification.nas @@ -3,7 +3,6 @@ # Copyright (c) 2020 Josh Davidson (Octal450) var defaultServer = "https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&mostRecent=true&hoursBeforeNow=12&stationString="; -var serverString = ""; var result = nil; var ATSU = { @@ -104,15 +103,10 @@ var AOC = { sentTime: nil, received: 0, receivedTime: nil, - server: 0, # 0 = noaa, 1 = vatsim + server: props.globals.getNode("/systems/atsu/wxr-server"), newStation: func(airport) { if (size(airport) == 3 or size(airport) == 4) { - if (size(findAirportsByICAO(airport)) == 0) { - return 2; - } else { - me.station = airport; - return 0; - } + me.station = airport; } else { return 1; } @@ -123,9 +117,18 @@ var AOC = { } me.sent = 1; me.received = 0; + var sentTime = left(getprop("/sim/time/gmt-string"), 5); me.sentTime = split(":", sentTime)[0] ~ "." ~ split(":", sentTime)[1] ~ "Z"; + if (size(findAirportsByICAO(me.station)) == 0) { + me.received = 1; + me.receivedTime = me.sentTime; + var message = mcdu.ACARSMessage.new(me.receivedTime, "INVALID STATION " ~ me.station); + mcdu.ReceivedMessagesDatabase.addMessage(message); + return 0; + } + if (me.selectedType == "HOURLY WX") { var result = me.fetchMETAR(atsu.AOC.station, i); if (result == 0) { @@ -148,8 +151,13 @@ var AOC = { } } }, + downloadFail: func(i, r = nil) { + mcdu.mcdu_message(i,"NO ANSWER TO REQUEST"); + debug.dump("HTTP failure " ~ r.status); + me.sent = 0; + }, fetchMETAR: func(airport, i) { - if (!ATSU.working) { + if (!ATSU.working or !fmgc.FMGCInternal.flightNumSet) { me.sent = 0; return 2; } @@ -158,23 +166,29 @@ var AOC = { return 1; } - serverString = ""; - - if (me.server == 0) { - serverString = defaultServer; - } elsif (me.server == 1) { + var serverString = ""; + if (me.server.getValue() == "vatsim") { serverString = "https://api.flybywiresim.com/metar?source=vatsim&icao="; - } else { # fall back to NOAA silently + } else { serverString = defaultServer; } http.load(serverString ~ airport) - .fail(func(r) print("Download failed; try changing your server to NOAA")) - .done(func(r) me.processMETAR(r, i)); + .fail(func(r) me.downloadFail(i, r)) + .done(func(r) { + var errs = []; + call(me.processMETAR, [r, i], me, {}, errs); + if (size(errs) > 0) { + print("Failed to parse METAR for " ~ airport); + debug.dump(r.response); + debug.printerror(errs); + mcdu.mcdu_message(i, "BAD SERVER RESPONSE"); + } + }); return 0; }, fetchTAF: func(airport, i) { - if (!ATSU.working) { + if (!ATSU.working or !fmgc.FMGCInternal.flightNumSet) { me.sent = 0; return 2; } @@ -183,15 +197,33 @@ var AOC = { return 1; } http.load("https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=tafs&requestType=retrieve&format=xml&timeType=issue&mostRecent=true&hoursBeforeNow=12&stationString=" ~ airport) - .fail(func print("Download failed!")) - .done(func(r) me.processTAF(r, i)); + .fail(func(r) me.downloadFail(i)) + .done(func(r) { + var errs = []; + call(me.processTAF, [r, i], me, {}, errs); + if (size(errs) > 0) { + print("Failed to parse TAF for " ~ airport); + debug.dump(r.response); + debug.printerror(errs); + mcdu.mcdu_message(i, "BAD SERVER RESPONSE"); + } + }); return 0; }, processMETAR: func(r, i) { var raw = r.response; - raw = split("", raw)[1]; - raw = split("", raw)[0]; - me.lastMETAR = raw; + if (me.server.getValue() == "vatsim") { + me.lastMETAR = raw; + } else if (find("", raw) != -1) { + raw = split("", raw)[1]; + raw = split("", raw)[0]; + me.lastMETAR = raw; + } else { + me.received = 0; + me.sent = 0; + mcdu.mcdu_message(i, "BAD SERVER RESPONSE"); + return; + } settimer(func() { me.received = 1; mcdu.mcdu_message(i, "WX UPLINK"); @@ -204,8 +236,16 @@ var AOC = { }, processTAF: func(r, i) { var raw = r.response; - raw = split("", raw)[1]; - raw = split("", raw)[0]; + if (find("", raw) != -1) { + raw = split("", raw)[1]; + raw = split("", raw)[0]; + me.lastTAF = raw; + } else { + me.received = 0; + me.sent = 0; + mcdu.mcdu_message(i, "BAD SERVER RESPONSE"); + return; + } me.lastTAF = raw; settimer(func() { me.received = 1; @@ -220,14 +260,21 @@ var AOC = { }; var ATIS = { - station: nil, - lastATIS: nil, - sent: 0, - sentTime: nil, - received: 0, - receivedTime: nil, - server: 0, + serverSel: props.globals.getNode("/systems/atsu/atis-server"), + new: func() { + var ATIS = { parents: [ATIS] }; + ATIS.station = nil; + ATIS.lastATIS = nil; + ATIS.sent = 0; + ATIS.received = 0; + ATIS.receivedTime = nil; + ATIS.receivedCode = nil; + ATIS.type = 0; # 0 = arr, 1 = dep + return ATIS; + }, newStation: func(airport) { + me.sent = 0; + me.received = 0; if (size(airport) == 3 or size(airport) == 4) { if (size(findAirportsByICAO(airport)) == 0) { return 2; @@ -245,10 +292,8 @@ var ATIS = { } me.sent = 1; me.received = 0; - var sentTime = left(getprop("/sim/time/gmt-string"), 5); - me.sentTime = split(":", sentTime)[0] ~ "." ~ split(":", sentTime)[1] ~ "Z"; - result = me.fetchATIS(atsu.ATIS.station, i); + result = me.fetchATIS(me.station, i); if (result == 0) { return 0; } elsif (result == 1) { @@ -267,39 +312,139 @@ var ATIS = { return 1; } - serverString = ""; - - if (me.server == 0) { - serverString = "https://api.flybywiresim.com/atis?source=faa&icao="; - } elsif (me.server == 1) { - serverString = "https://api.flybywiresim.com/atis?source=vatsim&icao="; - } else { # fall back to FAA silently - serverString = "https://api.flybywiresim.com/atis?source=faa&icao="; - } + var serverString = "https://api.flybywiresim.com/atis?source=" ~ me.serverSel.getValue() ~ "&icao="; http.load(serverString ~ airport) .fail(func(r) return 3) - .done(func(r) me.processATIS(r, i)); + .done(func(r) { + var errs = []; + call(me.processATIS, [r, i], me, {}, errs); + if (size(errs) > 0) { + print("Failed to parse ATIS for " ~ airport); + debug.dump(r.response); + debug.printerror(errs); + mcdu.mcdu_message(i, "BAD SERVER RESPONSE"); + } + }); return 0; }, processATIS: func(r, i) { var raw = r.response; - if (find("combined", raw)) { + 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"); + return; + } + if (find("combined", raw) != -1) { raw = split('{"combined":"', raw)[1]; raw = split('"}', raw)[0]; } else { - raw = split('{"arr":"', raw)[1]; - raw = split('","dep":', raw)[0]; + if (me.type == 0) { + raw = split('{"arr":"', raw)[1]; + raw = split('","dep":', raw)[0]; + } else { + raw = split('","dep":"', raw)[1]; + raw = split('"}', raw)[0]; + } } - me.lastATIS = raw; + + var code = ""; + if (find("INFO ", raw) != -1) { + code = split("INFO ", raw)[1]; + code = split(" ", code)[0]; + } else if (find("information ", raw) != -1) { + code = split("information ", raw)[1]; + code = split(" ", code)[0]; + } else if (find("INFORMATION ", raw) != -1) { + code = split("INFORMATION ", raw)[1]; + code = split(" ", code)[0]; + } else if (find("ATIS ", raw) != -1) { + code = split("ATIS ", raw)[1]; + code = split(" ", code)[0]; + } else if (find("info ", raw) != -1) { + code = split("info ", raw)[1]; + code = split(" ", code)[0]; + } else { + print("Failed to find a valid ATIS code for " ~ me.station); + debug.dump(raw); + } + + if (find(".", code) != -1) { + code = split(".", code)[0]; + } + + me.receivedCode = code; + + var time = ""; + if (find("Time ", raw) != -1) { + time = split("Time ", raw)[1]; + time = split(" ", time)[0]; + } else if (find("time ", raw) != -1) { + time = split("time ", raw)[1]; + time = split(" ", time)[0]; + } else if (find("TIME ", raw) != -1) { + time = split("TIME ", raw)[1]; + time = split(" ", time)[0]; + } else if (find("Z.", raw) != -1) { + time = split("Z.", raw)[0]; + time = right(time, 4); + } else if (find("Z SPECIAL", raw) != -1) { + time = split("Z SPECIAL", raw)[0]; + time = right(time, 4); + } else if (find("metreport", raw) != -1) { + time = split("metreport", raw)[0]; + time = right(time, 4); + } else if (find((code ~ " "), raw) != -1) { + if (size(split(" ",split(code ~ " ", raw)[1])[0]) == 4) { + time = split(" ",split(code ~ " ", raw)[1])[0]; + } + } else { + print("Failed to find a valid ATIS time for " ~ me.station); + debug.dump(raw); + } + + if (size(time) == 3) { + time ~= " "; + } + + raw = string.uc(raw); + raw = string.replace(raw, ",", ""); + settimer(func() { + me.sent = 0; me.received = 1; - mcdu.mcdu_message(i, "WX UPLINK"); - - var receivedTime = left(getprop("/sim/time/gmt-string"), 5); - me.receivedTime = split(":", receivedTime)[0] ~ "." ~ split(":", receivedTime)[1] ~ "Z"; - var message = mcdu.ACARSMessage.new(me.receivedTime, me.lastATIS); - mcdu.ReceivedMessagesDatabase.addMessage(message); - }, math.max(rand()*10, 2.25)); + me.receivedTime = time; + me.lastATIS = raw; + }, math.max(rand()*10, 4.5)); }, -}; \ No newline at end of file +}; + +makeNewDictionaryString("A", "ALPHA"); +makeNewDictionaryString("B", "BRAVO"); +makeNewDictionaryString("C", "CHARLIE"); +makeNewDictionaryString("D", "DELTA"); +makeNewDictionaryString("E", "ECHO"); +makeNewDictionaryString("F", "FOXTROT"); +makeNewDictionaryString("G", "GOLF"); +makeNewDictionaryString("H", "HOTEL"); +makeNewDictionaryString("I", "INDIA"); +makeNewDictionaryString("J", "JULIET"); +makeNewDictionaryString("K", "KILO"); +makeNewDictionaryString("L", "LIMA"); +makeNewDictionaryString("M", "MIKE"); +makeNewDictionaryString("N", "NOVEMBER"); +makeNewDictionaryString("O", "OSCAR"); +makeNewDictionaryString("P", "PAPA"); +makeNewDictionaryString("Q", "QUEBEC"); +makeNewDictionaryString("R", "ROMEO"); +makeNewDictionaryString("S", "SIERRA"); +makeNewDictionaryString("T", "TANGO"); +makeNewDictionaryString("U", "UNIFORM"); +makeNewDictionaryString("V", "VICTOR"); +makeNewDictionaryString("W", "WHISKEY"); +makeNewDictionaryString("X", "XRAY"); +makeNewDictionaryString("Y", "YANKEE"); +makeNewDictionaryString("Z", "ZULU"); + +var ATISInstances = [ATIS.new(), ATIS.new(), ATIS.new(), ATIS.new()]; \ 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) { diff --git a/Nasal/emesary/M_frame_notification.nas b/Nasal/emesary/M_frame_notification.nas new file mode 100644 index 00000000..95716a51 --- /dev/null +++ b/Nasal/emesary/M_frame_notification.nas @@ -0,0 +1,98 @@ + #--------------------------------------------------------------------------- + # + # 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; + + 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..885e2447 --- /dev/null +++ b/Nasal/emesary/exec.nas @@ -0,0 +1,71 @@ + #--------------------------------------------------------------------------- + # + # 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 + # + #---------------------------------------------------------------------------*/ + +# +# 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; + + 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.02;#50 Hz + } + + 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 = { +frame_rate : "/sim/frame-rate", +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); + +setlistener("/sim/signals/fdm-initialized", func() { + execLoop(); +}, 0, 0); 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-electrical.xml b/Systems/a320-electrical.xml index 3cd7cffb..ff21dced 100644 --- a/Systems/a320-electrical.xml +++ b/Systems/a320-electrical.xml @@ -772,6 +772,7 @@ + /systems/acconfig/autoconfig-running ne 1 /systems/electrical/sources/idg-1/gcu-1-voltage-trip eq 1 /controls/electrical/switches/gen-1 eq 1 @@ -787,6 +788,7 @@ + /systems/acconfig/autoconfig-running ne 1 /systems/electrical/sources/idg-1/gcu-1-frequency-trip eq 1 /controls/electrical/switches/gen-1 eq 1 @@ -845,6 +847,7 @@ + /systems/acconfig/autoconfig-running ne 1 /systems/electrical/sources/idg-2/gcu-2-voltage-trip eq 1 /controls/electrical/switches/gen-2 eq 1 @@ -860,6 +863,7 @@ + /systems/acconfig/autoconfig-running ne 1 /systems/electrical/sources/idg-2/gcu-2-frequency-trip eq 1 /controls/electrical/switches/gen-2 eq 1 @@ -934,6 +938,7 @@ + /systems/acconfig/autoconfig-running ne 1 /systems/electrical/sources/apu/gcu-voltage-trip eq 1 /controls/electrical/switches/apu eq 1 @@ -949,6 +954,7 @@ + /systems/acconfig/autoconfig-running ne 1 /systems/electrical/sources/apu/gcu-frequency-trip eq 1 /controls/electrical/switches/apu eq 1 @@ -1079,7 +1085,7 @@ /systems/electrical/relay/ac-ess-feed-1/auto-switch - 100 + 120 0.33333333333 @@ -1600,13 +1606,6 @@ - - - - /systems/electrical/relay/dc-ess-shed-switch/contact-pos eq 1 - - - @@ -1806,7 +1805,7 @@ /systems/electrical/bus/dc-ess - 1 + /systems/electrical/relay/dc-ess-shed-switch/contact-pos @@ -1880,7 +1879,7 @@ /systems/electrical/relay/ac-ess-feed-inverter/contact-pos - 100 + 120 0.1 diff --git a/Systems/a320-fuel.xml b/Systems/a320-fuel.xml index 04e8d88a..76648294 100644 --- a/Systems/a320-fuel.xml +++ b/Systems/a320-fuel.xml @@ -188,7 +188,7 @@ Timer for the Fuel Center pumps /systems/fuel/quantity/center-low - 100 + 120 0.00333 @@ -767,7 +767,9 @@ /consumables/fuel/tank[3]/level-norm lt 0.9999 - + + + /systems/fuel/internal/left-outer-wing-tank-refuel -/systems/fuel/internal/left-wing-outer-to-inner-tank diff --git a/Systems/a320-fwc-phases.xml b/Systems/a320-fwc-phases.xml index 33d5a6b1..f2e78d6a 100644 --- a/Systems/a320-fwc-phases.xml +++ b/Systems/a320-fwc-phases.xml @@ -9,9 +9,22 @@ Timer for the ECAM phase system /ECAM/ground-calc-immediate - 100 + 120 1 + + + /ECAM/phases/phase-calculation/one-engine-running + 120 + 0.03333333333 + + + + /ECAM/phases/monostable/phase-1-300 + 0.00333333333 + 120 + + @@ -80,6 +93,142 @@ + + + + /ECAM/phases/monostable/phase-1-300-output ne 1 + /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 8a63074c..d3467929 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -9,259 +9,252 @@ Timer for the ECAM system /ECAM/phases/timer/eng1idle - 100 + 120 0.033 Timer for the ECAM system /ECAM/phases/timer/eng2idle - 100 - 0.033 - - - - Timer for the ECAM system - /ECAM/phases/timer/eng1or2 - 100 + 120 0.033 Timer for the ECAM system /ECAM/phases/timer/to-inhibit - 100 + 120 0.33 Timer for the ECAM system /ECAM/phases/timer/ldg-inhibit - 100 + 120 0.33 Timer for the ECAM system /ECAM/warnings/timer/bleed-1-fault - 100 + 120 0.2 Timer for the ECAM system /ECAM/warnings/timer/bleed-2-fault - 100 + 120 0.2 Timer for the ECAM system /ECAM/warnings/logic/apu-bleed-fault - 100 + 120 0.1 Timer for the ECAM system /systems/pneumatics/warnings/crossbleed-disag - 100 + 120 0.1 Timer for the ECAM system /ECAM/warnings/logic/prv-1-not-shut-apu - 100 + 120 1 Timer for the ECAM system /ECAM/warnings/logic/prv-2-not-shut-apu - 100 + 120 1 Timer for the ECAM system /ECAM/warnings/logic/prv-1-not-shut - 100 + 120 1 Timer for the ECAM system /ECAM/warnings/logic/prv-2-not-shut - 100 + 120 1 Timer for the ECAM system /ECAM/warnings/timer/bleed-1-and-2-low-temp - 100 + 120 0.00185185 Timer for the ECAM system /systems/pneumatics/warnings/lowtemp-1-mem - 100 + 120 0.016666 Timer for the ECAM system /systems/pneumatics/warnings/lowtemp-2-mem - 100 + 120 0.016666 Timer for the ECAM system /ECAM/warnings/logic/bleed-1-off-60 - 100 + 120 0.016666 Timer for the ECAM system /ECAM/warnings/logic/bleed-2-off-60 - 100 + 120 0.016666 Timer for the ECAM system /ECAM/warnings/logic/bleed-1-off-5 - 100 + 120 0.2 Timer for the ECAM system /ECAM/warnings/logic/bleed-2-off-5 - 100 + 120 0.2 Timer for the ECAM system /ECAM/warnings/logic/eng-aice-1-open - 100 + 120 0.2 Timer for the ECAM system /ECAM/warnings/logic/eng-aice-2-open - 100 + 120 0.2 Timer for the ECAM system /ECAM/warnings/logic/eng-aice-1-closed - 100 + 120 0.1 Timer for the ECAM system /ECAM/warnings/logic/eng-aice-2-closed - 100 + 120 0.1 Timer for the ECAM system /ECAM/warnings/logic/wing-anti-ice-flipflop-set-input - 100 + 120 0.0285714 Timer for the ECAM system /ECAM/warnings/timer/phase-1-input - 100 + 120 0.5 Timer for the ECAM system /controls/ice-protection/wing - 100 + 120 0.04 Timer for the ECAM system /ECAM/warnings/logic/wing-anti-ice-left-closed-set-input - 100 + 120 0.066666 Timer for the ECAM system /ECAM/warnings/logic/wing-anti-ice-right-closed-set-input - 100 + 120 0.066666 Timer for the ECAM system /ECAM/warnings/logic/proc-wai-shutdown-flipflop - 100 + 120 0.1 Timer for the ECAM system /ECAM/warnings/logic/wing-hi-pr-left-input - 100 + 120 0.025 Timer for the ECAM system /ECAM/warnings/logic/wing-hi-pr-right-input - 100 + 120 0.025 Timer for the ECAM system /ECAM/warnings/logic/cranking-35-sec-input - 100 + 120 0.028571 Timer for the ECAM system /ECAM/warnings/logic/pack-1-fault-closed-input - 100 + 120 0.1 Timer for the ECAM system /ECAM/warnings/logic/pack-2-fault-closed-input - 100 + 120 0.1 Timer for the ECAM system /ECAM/warnings/logic/pack-1-disagree-input - 100 + 120 0.1 Timer for the ECAM system /ECAM/warnings/logic/pack-2-disagree-input - 100 + 120 0.1 @@ -275,98 +268,98 @@ Timer for the ECAM system /ECAM/warnings/logic/pack-1-fault-input - 100 + 120 0.20 Timer for the ECAM system /ECAM/warnings/logic/pack-2-fault-input - 100 + 120 0.20 Timer for the ECAM system /ECAM/warnings/logic/pack-1-fault-warning-input - 100 + 120 0.50 Timer for the ECAM system /ECAM/warnings/logic/pack-2-fault-warning-input - 100 + 120 0.50 Timer for the ECAM system /ECAM/warnings/logic/pack-1-off-input - 100 + 120 0.0166666 Timer for the ECAM system /ECAM/warnings/logic/pack-2-off-input - 100 + 120 0.0166666 Timer for the ECAM system /ECAM/warnings/logic/trim-air-fault-input - 100 + 120 0.2 Timer for the ECAM system /ECAM/warnings/logic/yaw-damper-1-fault - 100 + 120 0.2 Timer for the ECAM system /ECAM/warnings/logic/yaw-damper-2-fault - 100 + 120 0.2 Timer for the ECAM system /ECAM/warnings/logic/nav-gpws-terr-fault - 100 + 120 1.0 Timer for the ECAM system /ECAM/warnings/logic/gen-1-fault-set - 100 + 120 0.1818 Timer for the ECAM system /ECAM/warnings/logic/gen-2-fault-set - 100 + 120 0.1818 Timer for the ECAM system /ECAM/warnings/logic/apu-gen-fault-set - 100 + 120 0.2 Timer for the ECAM system /ECAM/warnings/logic/apu-gen-fault-reset - 100 + 120 0.5 @@ -1343,7 +1336,8 @@ /systems/navigation/adr/operating-1 eq 1 /systems/navigation/adr/operating-3 eq 1 /systems/electrical/bus/dc-ess-shed ge 25 - /systems/electrical/bus/ac-1 ge 110 + /systems/electrical/bus/dc-ess ge 25 + /systems/electrical/bus/ac-ess ge 110 /systems/fctl/fac1-healthy-signal eq 0 /systems/fctl/fac2-healthy-signal eq 1 @@ -1370,14 +1364,6 @@ - - - - /systems/hydraulic/green-psi lt 1500 - /ECAM/warning-phase ne 1 - - - @@ -1398,7 +1384,7 @@ /systems/electrical/bus/dc-ess-shed ge 25 /systems/electrical/bus/ac-1 ge 110 /ECAM/warnings/logic/yaw-damper-1-fault-eng-start eq 0 - /ECAM/warnings/logic/yaw-damper-1-fault-green eq 0 + /systems/hydraulic/green-psi ge 1500 /ECAM/warnings/logic/yaw-damper-1-fault-adr eq 0 /ECAM/irs-in-align eq 0 /systems/fctl/yawdamper-1-active eq 0 @@ -1415,14 +1401,6 @@ - - - - /systems/hydraulic/yellow-psi lt 1500 - /ECAM/warning-phase ne 1 - - - @@ -1443,7 +1421,7 @@ /systems/electrical/bus/dc-2 ge 25 /systems/electrical/bus/ac-2 ge 110 /ECAM/warnings/logic/yaw-damper-2-fault-eng-start eq 0 - /ECAM/warnings/logic/yaw-damper-2-fault-yellow eq 0 + /systems/hydraulic/yellow-psi ge 1500 /ECAM/warnings/logic/yaw-damper-2-fault-adr eq 0 /ECAM/irs-in-align eq 0 /systems/fctl/yawdamper-2-active eq 0 @@ -1451,23 +1429,43 @@ + + + + /systems/navigation/adr/operating-1 eq 1 + /systems/navigation/adr/operating-2 eq 1 + /systems/navigation/adr/operating-3 eq 1 + + + + + /ECAM/warnings/logic/adr-off-input + 120 + 0.5 + + + + + + /systems/hydraulics/warnings/green-lo-pr eq 0 + /systems/hydraulics/warnings/yellow-lo-pr eq 0 + + + /ECAM/irs-in-align eq 0 - - /systems/navigation/adr/operating-1 eq 1 - /systems/navigation/adr/operating-2 eq 1 - /systems/navigation/adr/operating-3 eq 1 - + /ECAM/warnings/logic/adr-off ne 1 /systems/electrical/bus/dc-ess-shed ge 25 /systems/electrical/bus/ac-1 ge 110 /systems/electrical/bus/dc-2 ge 25 /systems/electrical/bus/ac-2 ge 110 - /ECAM/warnings/logic/yaw-damper-1-fault-green eq 0 - /ECAM/warnings/logic/yaw-damper-2-fault-yellow eq 0 + /ECAM/warnings/logic/green-yellow-press-on-monostable eq 0 + /systems/hydraulic/green-psi ge 1500 + /systems/hydraulic/yellow-psi ge 1500 /ECAM/warnings/logic/yaw-damper-1-fault eq 1 /ECAM/warnings/logic/yaw-damper-2-fault eq 1 @@ -1515,7 +1513,7 @@ /systems/electrical/relay/gen-1-glc/contact-pos - 100 + 120 0.5 @@ -1576,7 +1574,7 @@ /systems/electrical/relay/gen-2-glc/contact-pos - 100 + 120 0.5 @@ -1773,7 +1771,7 @@ /ECAM/warnings/logic/eng/ground-spoilers - 100 + 120 2 @@ -1799,19 +1797,19 @@ /controls/engines/engine[0]/throttle-lever ge 0.13333333333 - /ECAM/phases/to-power-set eq 0 + /ECAM/phases/phase-calculation/takeoff-power eq 0 /ECAM/warnings/logic/eng/eng-1-tla-abv-6 - 100 + 120 1 /ECAM/warnings/logic/eng/eng-1-tla-abv-6-2 - 100 + 120 1 @@ -1824,7 +1822,7 @@ /ECAM/warnings/logic/eng/eng-1-tla-idle - 100 + 120 1 @@ -1837,7 +1835,7 @@ /ECAM/warnings/logic/eng/eng-1-reverse - 100 + 120 1 @@ -1852,19 +1850,19 @@ /controls/engines/engine[1]/throttle-lever ge 0.13333333333 - /ECAM/phases/to-power-set eq 0 + /ECAM/phases/phase-calculation/takeoff-power eq 0 /ECAM/warnings/logic/eng/eng-2-tla-abv-6 - 100 + 120 1 /ECAM/warnings/logic/eng/eng-2-tla-abv-6-2 - 100 + 120 1 @@ -1877,7 +1875,7 @@ /ECAM/warnings/logic/eng/eng-2-tla-idle - 100 + 120 1 @@ -1890,7 +1888,7 @@ /ECAM/warnings/logic/eng/eng-2-reverse - 100 + 120 1 @@ -2046,7 +2044,7 @@ /ECAM/warnings/fctl/lrElevFault - 100 + 120 3.33333333333 @@ -2057,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 @@ -2093,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 @@ -2147,7 +2145,7 @@ /ECAM/warnings/fctl/gear-not-down-locked-set-input - 100 + 120 0.03333333333 @@ -2180,7 +2178,7 @@ /ECAM/warnings/hyd/engines-2-online - 100 + 120 1 @@ -2195,7 +2193,7 @@ /ECAM/warnings/hyd/engines-2-off-in-air - 100 + 120 0.2 @@ -2214,7 +2212,7 @@ /ECAM/warnings/hyd/engine-1-start - 100 + 120 1 @@ -2233,7 +2231,7 @@ /ECAM/warnings/hyd/engine-2-start - 100 + 120 1 @@ -2373,4 +2371,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/a320-hydraulic.xml b/Systems/a320-hydraulic.xml index f4d0ed26..89113580 100644 --- a/Systems/a320-hydraulic.xml +++ b/Systems/a320-hydraulic.xml @@ -477,7 +477,7 @@ /systems/hydraulic/sources/ptu/ptu-loop-sound-cmd 1 - 100 + 120 diff --git a/Systems/a320-misc.xml b/Systems/a320-misc.xml index 119da28e..22dddba9 100644 --- a/Systems/a320-misc.xml +++ b/Systems/a320-misc.xml @@ -2,7 +2,7 @@ - + @@ -28,5 +28,15 @@ + + + + + /instrumentation/iesi/att-reset-cmd + 0.5 + 100 + + + diff --git a/Systems/a320-pneumatic.xml b/Systems/a320-pneumatic.xml index 345575d0..bfe656d7 100644 --- a/Systems/a320-pneumatic.xml +++ b/Systems/a320-pneumatic.xml @@ -214,7 +214,7 @@ /systems/pneumatics/valves/engine-1-prv-valve-autoclose-psi-cmd - 100 + 120 0.0666 @@ -294,7 +294,7 @@ /systems/pneumatics/valves/engine-2-prv-valve-autoclose-psi-cmd - 100 + 120 0.0666 @@ -438,7 +438,7 @@ /systems/pneumatics/valves/wing-ice-gnd-cmd 0.033333 - 100 + 120 @@ -981,19 +981,19 @@ /systems/pneumatics/precooler/calc/ovht-5-true 0.2 - 100 + 120 /systems/pneumatics/precooler/calc/ovht-15-true 0.06666 - 100 + 120 /systems/pneumatics/precooler/calc/ovht-55-true 0.018182 - 100 + 120 @@ -1094,19 +1094,19 @@ /systems/pneumatics/precooler/calc/ovht-5-true-2 0.2 - 100 + 120 /systems/pneumatics/precooler/calc/ovht-15-true-2 0.06666 - 100 + 120 /systems/pneumatics/precooler/calc/ovht-55-true-2 0.018182 - 100 + 120 @@ -1180,7 +1180,7 @@ /systems/pneumatics/warnings/apu-bleed-not-on-cmd 0.1 - 100 + 120 diff --git a/Systems/ecam-proprules.xml b/Systems/ecam-proprules.xml index 1e1bd8c9..ac9e1af3 100644 --- a/Systems/ecam-proprules.xml +++ b/Systems/ecam-proprules.xml @@ -203,16 +203,15 @@ ECAM/phases/monostable/gnd-output - monostable - ECAM/phases/monostable/phase-1-300 + /ECAM/ground-calc-immediate - ECAM/phases/monostable/phase-1-output + ECAM/phases/monostable/gnd-output-2 @@ -251,44 +250,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 @@ -304,10 +265,12 @@ it-autoflight/input/alt-is-changing - ECAM/alt-is-changing + ECAM/warnings/altitude-alert/alt-is-changing + gain + 1 @@ -326,7 +289,7 @@ 0 - ECAM/gear-downlocked-set + ECAM/warnings/altitude-alert/gear-downlocked-set @@ -335,67 +298,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 @@ -478,7 +383,7 @@ 1.0 - ECAM/phases/to-power-set + ECAM/phases/phase-calculation/takeoff-power ECAM/phases/monostable/to-power-set-output @@ -1070,4 +975,58 @@ /ECAM/warnings/fctl/gear-not-down-locked + + monostable + + + /ECAM/warnings/logic/green-yellow-press-on-monostable-input + + /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 + + + + RS + + /ECAM/phases/phase-calculation/altitude-flipflop-set + + + /ECAM/phases/phase-calculation/altitude-flipflop-reset + + /ECAM/phases/phase-calculation/altitude-ge-800 + diff --git a/Systems/pfd.xml b/Systems/pfd.xml index a11265d7..00b3ee6b 100644 --- a/Systems/pfd.xml +++ b/Systems/pfd.xml @@ -309,6 +309,33 @@ 0.32 + + Pitch PFD + gain + 1 + + + + /orientation/pitch-deg + -90.0-57.50 + -80.0-47.50 + -50.0-32.50 + -30.0-22.50 + -20.0-17.50 + -15.0-13.75 + -10.0-10.00 + 0.0 0.00 + 27.5 27.50 + 30.0 28.75 + 50.0 38.75 + 80.0 53.75 + 90.0 63.75 +
+
+ + /instrumentation/pfd/pitch-deg-non-linear +
+ Ground Horizon gain @@ -464,5 +491,45 @@ /instrumentation/pfd/slip-skid 0.16 + + + IESI Slip/Skid Indicator + false + gain + 1 + + + + /fdm/jsbsim/accelerations/Ny + -0.20-105 + -0.01 0 + 0.00 0 + 0.01 0 + 0.20 105 +
+
+ + /instrumentation/iesi/slip-skid +
+ + + IESI Pitch + false + gain + 1 + + + + /orientation/pitch-deg + -80-65 + -50-50 + 0 0 + 50 50 + 80 65 +
+
+ + /instrumentation/iesi/pitch-deg +