From 8d55eda2d4fb109273c4a59126d16c06b752a043 Mon Sep 17 00:00:00 2001 From: Josh Davidson Date: Fri, 27 Nov 2020 21:17:59 -0500 Subject: [PATCH 01/38] Sim: Fix the view ordering, the walker now is properly again --- A320-100-CFM-set.xml | 3 ++- A320-200-CFM-set.xml | 3 ++- A320-200-IAE-set.xml | 3 ++- A320neo-CFM-set.xml | 3 ++- A320neo-PW-set.xml | 3 ++- Nasal/Libraries/custom-views.nas | 2 +- revision.txt | 2 +- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/A320-100-CFM-set.xml b/A320-100-CFM-set.xml index 67418f9a..3ab703be 100644 --- a/A320-100-CFM-set.xml +++ b/A320-100-CFM-set.xml @@ -185,7 +185,8 @@ 0 - + + Right Aft View lookfrom false diff --git a/A320-200-CFM-set.xml b/A320-200-CFM-set.xml index abdf47b8..f6d90a03 100644 --- a/A320-200-CFM-set.xml +++ b/A320-200-CFM-set.xml @@ -185,7 +185,8 @@ 0 - + + Right Aft View lookfrom false diff --git a/A320-200-IAE-set.xml b/A320-200-IAE-set.xml index 677bda7c..98fa97d7 100644 --- a/A320-200-IAE-set.xml +++ b/A320-200-IAE-set.xml @@ -185,7 +185,8 @@ 0 - + + Right Aft View lookfrom false diff --git a/A320neo-CFM-set.xml b/A320neo-CFM-set.xml index b6137f45..68a08ae9 100644 --- a/A320neo-CFM-set.xml +++ b/A320neo-CFM-set.xml @@ -185,7 +185,8 @@ 0 - + + Right Aft View lookfrom false diff --git a/A320neo-PW-set.xml b/A320neo-PW-set.xml index 5631d3a0..bd628100 100644 --- a/A320neo-PW-set.xml +++ b/A320neo-PW-set.xml @@ -185,7 +185,8 @@ 0 - + + Right Aft View lookfrom false diff --git a/Nasal/Libraries/custom-views.nas b/Nasal/Libraries/custom-views.nas index 8443915d..0b90fcc6 100644 --- a/Nasal/Libraries/custom-views.nas +++ b/Nasal/Libraries/custom-views.nas @@ -8,7 +8,7 @@ var viewNumberRaw = 0; var shakeFlag = 0; var resetView = func() { viewNumberRaw = pts.Sim.CurrentView.viewNumberRaw.getValue(); - if (viewNumberRaw == 0 or (viewNumberRaw >= 100 and viewNumberRaw <= 110)) { + if (viewNumberRaw == 0 or (viewNumberRaw >= 100 and viewNumberRaw <= 109) or viewNumberRaw == 112) { if (pts.Sim.Rendering.Headshake.enabled.getBoolValue()) { shakeFlag = 1; pts.Sim.Rendering.Headshake.enabled.setBoolValue(0); diff --git a/revision.txt b/revision.txt index ac4213d6..d2e1cefe 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -43 \ No newline at end of file +44 \ No newline at end of file From 98378f45eadda2e22228122bedbb5d70e53bcdeb Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 28 Nov 2020 12:24:24 +0000 Subject: [PATCH 02/38] Prevent excess garbage collection in FGMC.nas; correction for bug in PTS --- Nasal/FMGC/FMGC.nas | 7 +++---- Nasal/Libraries/property-tree-setup.nas | 5 +++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 6c2868ce..56bc2ecd 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -62,6 +62,7 @@ var altsel = 0; var crzFl = 0; var windHdg = 0; var windSpeed = 0; +var windsDidChange = 0; setprop("position/gear-agl-ft", 0); setprop("/it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway setprop("/it-autoflight/internal/vert-speed-fpm", 0); @@ -683,7 +684,7 @@ var masterFMGC = maketimer(0.2, func { windHdg = pts.Environment.windFromHdg.getValue(); windSpeed = pts.Environment.windSpeedKt.getValue(); if (FMGCInternal.phase == 3 or FMGCInternal.phase == 4 or FMGCInternal.phase == 6) { - var windsDidChange = 0; + windsDidChange = 0; if (FMGCInternal.crzFt > 5000 and alt > 4980 and alt < 5020) { if (sprintf("%03d", windHdg) != fmgc.windController.fl50_wind[0] or sprintf("%03d", windSpeed) != fmgc.windController.fl50_wind[1]) { fmgc.windController.fl50_wind[0] = sprintf("%03d", windHdg); @@ -1020,9 +1021,7 @@ var ManagedSPD = maketimer(0.25, func { if (mach > mng_alt_mach and (FMGCInternal.phase == 2 or FMGCInternal.phase == 3)) { FMGCInternal.machSwitchover = 1; - } - - if (ias > mng_alt_spd and (FMGCInternal.phase == 4 or FMGCInternal.phase == 5)) { + } elsif (ias > mng_alt_spd and (FMGCInternal.phase == 4 or FMGCInternal.phase == 5)) { FMGCInternal.machSwitchover = 0; } diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 4ff7ff9e..8df88d20 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -248,6 +248,11 @@ var Sim = { }, }, Version: props.globals.getNode("/sim/version/flightgear"), + View: { + Config: { + defaultFieldOfViewDeg: props.globals.getNode("/sim/view/config/default-field-of-view-deg", 1), + }, + }, }; var Systems = { From bc445a1eaafcd01d4ee89a1bd0037540645eb548 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 28 Nov 2020 13:40:33 +0000 Subject: [PATCH 03/38] Optimization of the systems loop. Remove most of the excess code in libraries.nas, replaced with jsb / updateManager --- A320-main.xml | 1 + AircraftConfig/groundservices.xml | 62 +------- Models/Instruments/MCDU/MCDU.nas | 6 +- Nasal/Libraries/libraries.nas | 252 ++++++++++-------------------- Nasal/Libraries/shake.nas | 9 +- Nasal/Libraries/sounds.nas | 119 ++++++++++++++ Systems/a320-misc.xml | 38 +++++ 7 files changed, 250 insertions(+), 237 deletions(-) create mode 100644 Nasal/Libraries/sounds.nas diff --git a/A320-main.xml b/A320-main.xml index 489f2d47..735e4844 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -4394,6 +4394,7 @@ Aircraft/A320-family/Nasal/Libraries/libraries.nas + Aircraft/A320-family/Nasal/Libraries/sounds.nas Aircraft/A320-family/Nasal/Libraries/buttons.nas Aircraft/A320-family/Nasal/Libraries/shake.nas Aircraft/A320-family/Nasal/Libraries/zoom-views.nas diff --git a/AircraftConfig/groundservices.xml b/AircraftConfig/groundservices.xml index 0bce5733..c92062a9 100644 --- a/AircraftConfig/groundservices.xml +++ b/AircraftConfig/groundservices.xml @@ -124,16 +124,10 @@ 0 - - - /controls/gear/brake-parking - /services/chocks/enable - - - /velocities/groundspeed-kt - 2 - - + + /velocities/groundspeed-kt + 2 + dialog-apply @@ -150,50 +144,10 @@ /controls/pneumatics/switches/groundair - - - /controls/gear/brake-parking - /services/chocks/enable - - - /velocities/groundspeed-kt - 2 - - - - - dialog-apply - - true - - - - - left - /controls/hydraulic/hand-pump-yellow - - property-toggle - /controls/hydraulic/hand-pump-yellow - - - - - /controls/gear/brake-parking - /services/chocks/enable - - - /velocities/groundspeed-kt - 2 - - - /systems/electrical/bus/ac-2 - 115 - - - /controls/electrical/switches/ext-pwr - 0 - - + + /velocities/groundspeed-kt + 2 + dialog-apply diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index bb12d326..b04c2835 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -74,6 +74,7 @@ var MAGENTA = [0.6902,0.3333,0.7541]; var mcdu_keyboard_left = props.globals.getNode("/FMGC/keyboard-left", 0); var mcdu_keyboard_right = props.globals.getNode("/FMGC/keyboard-right", 0); var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); +var engRdy = props.globals.getNode("/engines/ready"); #ACCONFIG var mcdu1_lgt = props.globals.getNode("/controls/lighting/DU/mcdu1", 1); @@ -115,7 +116,6 @@ var align_set = props.globals.getNode("/FMGC/internal/align-set", 1); # FUELPRED var state1 = props.globals.getNode("/engines/engine[0]/state", 1); var state2 = props.globals.getNode("/engines/engine[1]/state", 1); -var engrdy = props.globals.getNode("/engines/ready", 1); # PERF var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1); @@ -3009,12 +3009,12 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (!engrdy.getBoolValue() or !fmgc.FMGCInternal.toFromSet) { + if (!engRdy.getBoolValue() or !fmgc.FMGCInternal.toFromSet) { me["Simple_L1"].setText("NONE"); } else { me["Simple_L1"].setText(fmgc.FMGCInternal.arrApt); } - if (!engrdy.getBoolValue() or !fmgc.FMGCInternal.altAirportSet) { + if (!engRdy.getBoolValue() or !fmgc.FMGCInternal.altAirportSet) { me["Simple_L2"].setText("NONE"); } else { me["Simple_L2"].setText(fmgc.FMGCInternal.altAirport); diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index 2e93c670..dfaf8938 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -7,6 +7,7 @@ print("------------------------------------------------"); print("Copyright (c) 2016-2020 Josh Davidson (Octal450)"); print("------------------------------------------------"); +# Disable specific menubar items setprop("/sim/menubar/default/menu[0]/item[0]/enabled", 0); setprop("/sim/menubar/default/menu[2]/item[0]/enabled", 0); setprop("/sim/menubar/default/menu[2]/item[2]/enabled", 0); @@ -28,9 +29,6 @@ var beacon = aircraft.light.new("/sim/model/lights/beacon", [0.1, 1], "/controls var strobe = aircraft.light.new("/sim/model/lights/strobe", [0.05, 0.06, 0.05, 1], "/controls/lighting/strobe"); var tail_strobe = aircraft.light.new("/sim/model/lights/tailstrobe", [0.1, 1], "/controls/lighting/strobe"); -var stateL = 0; -var stateR = 0; - ########### # Effects # ########### @@ -40,121 +38,6 @@ aircraft.rain.init(); aircraft.livery.init(getprop("/sim/model/livery-dir")); -########## -# Sounds # -########## - -setlistener("/sim/sounde/btn1", func { - if (!getprop("/sim/sounde/btn1")) { - return; - } - settimer(func { - props.globals.getNode("/sim/sounde/btn1").setBoolValue(0); - }, 0.05); -}); - -setlistener("/sim/sounde/oh-btn", func { - if (!getprop("/sim/sounde/oh-btn")) { - return; - } - settimer(func { - props.globals.getNode("/sim/sounde/oh-btn").setBoolValue(0); - }, 0.05); -}); - -setlistener("/sim/sounde/btn3", func { - if (!getprop("/sim/sounde/btn3")) { - return; - } - settimer(func { - props.globals.getNode("/sim/sounde/btn3").setBoolValue(0); - }, 0.05); -}); - -setlistener("/sim/sounde/knb1", func { - if (!getprop("/sim/sounde/knb1")) { - return; - } - settimer(func { - props.globals.getNode("/sim/sounde/knb1").setBoolValue(0); - }, 0.05); -}); - -setlistener("/sim/sounde/switch1", func { - if (!getprop("/sim/sounde/switch1")) { - return; - } - settimer(func { - props.globals.getNode("/sim/sounde/switch1").setBoolValue(0); - }, 0.05); -}); - -setlistener("/controls/lighting/seatbelt-sign", func { - props.globals.getNode("/sim/sounde/seatbelt-sign").setBoolValue(1); - settimer(func { - props.globals.getNode("/sim/sounde/seatbelt-sign").setBoolValue(0); - }, 2); -}, 0, 0); - -setlistener("/controls/lighting/no-smoking-sign", func { - props.globals.getNode("/sim/sounde/no-smoking-sign").setBoolValue(1); - settimer(func { - props.globals.getNode("/sim/sounde/no-smoking-sign").setBoolValue(0); - }, 1); -}, 0, 0); - -var flaps_click = props.globals.getNode("/sim/sounde/flaps-click"); - -setlistener("/controls/flight/flaps-input", func { - flaps_click.setBoolValue(1); -}, 0, 0); - -setlistener("/sim/sounde/flaps-click", func { - if (!flaps_click.getValue()) { - return; - } - settimer(func { - flaps_click.setBoolValue(0); - }, 0.4); -}); - -var spdbrk_click = props.globals.getNode("/sim/sounde/spdbrk-click"); - -setlistener("/controls/flight/speedbrake", func { - spdbrk_click.setBoolValue(1); -}, 0, 0); - -setlistener("/sim/sounde/spdbrk-click", func { - if (!spdbrk_click.getValue()) { - return; - } - settimer(func { - spdbrk_click.setBoolValue(0); - }, 0.4); -}); - -var relayBatt1 = func { - setprop("/sim/sounde/relay-batt-1",1); - settimer(func {setprop("/sim/sounde/relay-batt-1",0);},0.35); -} -var relayBatt2 = func { - setprop("/sim/sounde/relay-batt-2",1); - settimer(func {setprop("/sim/sounde/relay-batt-2",0);},0.35); -} -var relayApu = func { - setprop("/sim/sounde/relay-apu",1); - settimer(func {setprop("/sim/sounde/relay-apu",0);},0.35); -} -var relayExt = func { - setprop("/sim/sounde/relay-ext",1); - settimer(func {setprop("/sim/sounde/relay-ext",0);},0.35); -} - -setlistener("/systems/electrical/sources/bat-1/contact", relayBatt1, nil, 0); -setlistener("/systems/electrical/sources/bat-2/contact", relayBatt2, nil, 0); -setlistener("/systems/electrical/relay/apu-glc/contact-pos", relayApu, nil, 0); -setlistener("/systems/electrical/relay/ext-epc/contact-pos", relayExt, nil, 0); - ######### # Doors # ######### @@ -199,7 +82,11 @@ var triggerDoor = func(door, doorName, doorDesc) { ########### # Systems # ########### +var systemsInitialized = 0; +var A320Libraries = nil; + var systemsInit = func { + systemsInitialized = 0; fbw.FBW.init(); effects.light_manager.init(); systems.ELEC.init(); @@ -221,9 +108,7 @@ var systemsInit = func { mcdu.MCDU_init(1); mcdu_scratchpad.mcduMsgtimer1.start(); mcdu_scratchpad.mcduMsgtimer2.start(); - systemsLoop.start(); effects.icingInit(); - lightsLoop.start(); ecam.ECAM.init(); libraries.variousReset(); rmp.init(); @@ -235,6 +120,7 @@ var systemsInit = func { fmgc.flightPlanController.init(); fmgc.windController.init(); atsu.CompanyCall.init(); + systemsInitialized = 1; } setlistener("/sim/signals/fdm-initialized", func { @@ -242,6 +128,9 @@ setlistener("/sim/signals/fdm-initialized", func { fmgc.postInit(); fmgc.flightPlanTimer.start(); fmgc.WaypointDatabase.read(); + + A320Libraries = LibrariesRecipient.new("A320 Libraries"); + emesary.GlobalTransmitter.Register(A320Libraries); }); var collectorTankL = props.globals.getNode("/fdm/jsbsim/propulsion/tank[5]/contents-lbs"); @@ -249,10 +138,42 @@ var collectorTankR = props.globals.getNode("/fdm/jsbsim/propulsion/tank[6]/conte var groundAir = props.globals.getNode("/controls/pneumatics/switches/groundair"); var groundCart = props.globals.getNode("/controls/electrical/ground-cart"); var chocks = props.globals.getNode("/services/chocks/enable"); -var engRdy = props.globals.getNode("/engines/ready"); var groundspeed = 0; +var stateL = 0; +var stateR = 0; -var systemsLoop = maketimer(0.1, func { +var seatbeltLight = props.globals.getNode("/controls/lighting/seatbelt-sign"); +var noSmokingLight = props.globals.getNode("/controls/lighting/no-smoking-sign"); + +var update_items = [ + props.UpdateManager.FromHashValue("seatbelt", nil, func(val) { + if (val) { + if (!seatbeltLight.getBoolValue()) { + seatbeltLight.setValue(1); + } + } else { + if (seatbeltLight.getBoolValue()) { + seatbeltLight.setValue(0); + } + } + }), + props.UpdateManager.FromHashList(["noSmoking","gearPosNorm"], nil, func(val) { + if (val.noSmoking) { + if (!noSmokingLight.getBoolValue()) { + noSmokingLight.setBoolValue(1); + } + } elsif (val.noSmoking == 0.5 and val.gearPosNorm != 0) { # todo: should be when uplocks not engaged + if (!noSmokingLight.getBoolValue()) { + noSmokingLight.setBoolValue(1); + } + } else { + noSmokingLight.setBoolValue(0); # sign stays on in cabin but sound still occurs + } + }), +]; + +var systemsLoop = func(notification) { + if (!systemsInitialized) { return; } systems.ELEC.loop(); systems.PNEU.loop(); systems.HYD.loop(); @@ -267,34 +188,20 @@ var systemsLoop = maketimer(0.1, func { libraries.BUTTONS.update(); systems.HFLoop(); - groundspeed = pts.Velocities.groundspeed.getValue(); - if ((groundAir.getBoolValue() or groundCart.getBoolValue()) and ((groundspeed > 2) or (!pts.Controls.Gear.parkingBrake.getBoolValue() and !chocks.getBoolValue()))) { - groundAir.setBoolValue(0); - groundCart.setBoolValue(0); - } - - if (groundspeed > 15) { - shakeEffectA3XX.setBoolValue(1); - } else { - shakeEffectA3XX.setBoolValue(0); - } - stateL = pts.Engines.Engine.state[0].getValue(); stateR = pts.Engines.Engine.state[1].getValue(); - if (stateL == 3 and stateR == 3) { - engRdy.setBoolValue(1); - } else { - engRdy.setBoolValue(0); - } - if ((stateL == 2 or stateL == 3) and collectorTankL.getValue() < 1) { systems.cutoff_one(); } if ((stateR == 2 or stateR == 3) and collectorTankR.getValue() < 1) { systems.cutoff_two(); } -}); + + foreach (var update_item; update_items) { + update_item.update(notification); + } +} # GPWS var GPWS = { @@ -482,37 +389,6 @@ var slewPitchWheel = func(d) { # Lights # ########## -var lightsLoop = maketimer(0.2, func { - # signs - - if (getprop("/systems/pressurization/cabinalt-norm") > 11300) { - setprop("/controls/lighting/seatbelt-sign", 1); - setprop("/controls/lighting/no-smoking-sign", 1); - } else { - if (getprop("/controls/switches/seatbelt-sign") == 1) { - if (getprop("/controls/lighting/seatbelt-sign") == 0) { - setprop("/controls/lighting/seatbelt-sign", 1); - } - } elsif (getprop("/controls/switches/seatbelt-sign") == 0) { - if (getprop("/controls/lighting/seatbelt-sign") == 1) { - setprop("/controls/lighting/seatbelt-sign", 0); - } - } - - if (getprop("/controls/switches/no-smoking-sign") == 1) { - if (getprop("/controls/lighting/no-smoking-sign") == 0) { - setprop("/controls/lighting/no-smoking-sign", 1); - } - } elsif (getprop("/controls/switches/no-smoking-sign") == 0.5 and getprop("/gear/gear[0]/position-norm") != 0) { # todo: should be when uplocks not engaged - if (getprop("/controls/lighting/no-smoking-sign") == 0) { - setprop("/controls/lighting/no-smoking-sign", 1); - } - } else { - setprop("/controls/lighting/no-smoking-sign", 0); # sign stays on in cabin but sound still occurs - } - } -}); - var pilotComfortTwoPos = func(prop) { var item = getprop(prop); if (item < 0.5) { @@ -584,4 +460,36 @@ var APPanel = { }, }; + +# Emesary +var LibrariesRecipient = +{ + new: func(_ident) + { + var NewLibrariesRecipient = emesary.Recipient.new(_ident); + NewLibrariesRecipient.Receive = func(notification) + { + if (notification.NotificationType == "FrameNotification") + { + if (math.mod(notifications.frameNotification.FrameCount,4) == 0) { + systemsLoop(notification); + } + return emesary.Transmitter.ReceiptStatus_OK; + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + return NewLibrariesRecipient; + }, +}; + +var input = { + "seatbelt": "/controls/switches/seatbelt-sign", + "noSmoking": "/controls/switches/no-smoking-sign", + "gearPosNorm": "/gear/gear[0]/position-norm", +}; + +foreach (var name; keys(input)) { + emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Libraries", name, input[name])); +} + setprop("/systems/acconfig/libraries-loaded", 1); diff --git a/Nasal/Libraries/shake.nas b/Nasal/Libraries/shake.nas index d861590f..eb9e8091 100644 --- a/Nasal/Libraries/shake.nas +++ b/Nasal/Libraries/shake.nas @@ -5,16 +5,9 @@ var shakeEffectA3XX = props.globals.initNode("/systems/shake/effect", 0, "BOOL"); var shakeA3XX = props.globals.initNode("/systems/shake/shaking", 0, "DOUBLE"); var sf = 0; -var n_g_c = 0; -var n_g_l = 0; -var n_g_r = 0; var theShakeEffect = func { - n_g_c = pts.Gear.compression[0].getValue() or 0; - n_g_l = pts.Gear.compression[1].getValue() or 0; - n_g_r = pts.Gear.compression[2].getValue() or 0; - - if (shakeEffectA3XX.getBoolValue() and (n_g_c > 0 or n_g_l > 0 or n_g_r > 0)) { + if (shakeEffectA3XX.getBoolValue()) { sf = pts.Gear.rollspeed[0].getValue() / 94000; interpolate("/systems/shake/shaking", sf, 0.03); settimer(func { diff --git a/Nasal/Libraries/sounds.nas b/Nasal/Libraries/sounds.nas new file mode 100644 index 00000000..e3350c31 --- /dev/null +++ b/Nasal/Libraries/sounds.nas @@ -0,0 +1,119 @@ +# A320 Main Libraries +# Joshua Davidson (Octal450) + +# Copyright (c) 2020 Josh Davidson (Octal450) + +########## +# Sounds # +########## + +setlistener("/sim/sounde/btn1", func { + if (!getprop("/sim/sounde/btn1")) { + return; + } + settimer(func { + props.globals.getNode("/sim/sounde/btn1").setBoolValue(0); + }, 0.05); +}); + +setlistener("/sim/sounde/oh-btn", func { + if (!getprop("/sim/sounde/oh-btn")) { + return; + } + settimer(func { + props.globals.getNode("/sim/sounde/oh-btn").setBoolValue(0); + }, 0.05); +}); + +setlistener("/sim/sounde/btn3", func { + if (!getprop("/sim/sounde/btn3")) { + return; + } + settimer(func { + props.globals.getNode("/sim/sounde/btn3").setBoolValue(0); + }, 0.05); +}); + +setlistener("/sim/sounde/knb1", func { + if (!getprop("/sim/sounde/knb1")) { + return; + } + settimer(func { + props.globals.getNode("/sim/sounde/knb1").setBoolValue(0); + }, 0.05); +}); + +setlistener("/sim/sounde/switch1", func { + if (!getprop("/sim/sounde/switch1")) { + return; + } + settimer(func { + props.globals.getNode("/sim/sounde/switch1").setBoolValue(0); + }, 0.05); +}); + +setlistener("/controls/lighting/seatbelt-sign", func { + props.globals.getNode("/sim/sounde/seatbelt-sign").setBoolValue(1); + settimer(func { + props.globals.getNode("/sim/sounde/seatbelt-sign").setBoolValue(0); + }, 2); +}, 0, 0); + +setlistener("/controls/lighting/no-smoking-sign", func { + props.globals.getNode("/sim/sounde/no-smoking-sign").setBoolValue(1); + settimer(func { + props.globals.getNode("/sim/sounde/no-smoking-sign").setBoolValue(0); + }, 1); +}, 0, 0); + +var flaps_click = props.globals.getNode("/sim/sounde/flaps-click"); + +setlistener("/controls/flight/flaps-input", func { + flaps_click.setBoolValue(1); +}, 0, 0); + +setlistener("/sim/sounde/flaps-click", func { + if (!flaps_click.getValue()) { + return; + } + settimer(func { + flaps_click.setBoolValue(0); + }, 0.4); +}); + +var spdbrk_click = props.globals.getNode("/sim/sounde/spdbrk-click"); + +setlistener("/controls/flight/speedbrake", func { + spdbrk_click.setBoolValue(1); +}, 0, 0); + +setlistener("/sim/sounde/spdbrk-click", func { + if (!spdbrk_click.getValue()) { + return; + } + settimer(func { + spdbrk_click.setBoolValue(0); + }, 0.4); +}); + +var relayBatt1 = func { + setprop("/sim/sounde/relay-batt-1",1); + settimer(func {setprop("/sim/sounde/relay-batt-1",0);},0.35); +} +var relayBatt2 = func { + setprop("/sim/sounde/relay-batt-2",1); + settimer(func {setprop("/sim/sounde/relay-batt-2",0);},0.35); +} +var relayApu = func { + setprop("/sim/sounde/relay-apu",1); + settimer(func {setprop("/sim/sounde/relay-apu",0);},0.35); +} +var relayExt = func { + setprop("/sim/sounde/relay-ext",1); + settimer(func {setprop("/sim/sounde/relay-ext",0);},0.35); +} + +setlistener("/systems/electrical/sources/bat-1/contact", relayBatt1, nil, 0); +setlistener("/systems/electrical/sources/bat-2/contact", relayBatt2, nil, 0); +setlistener("/systems/electrical/relay/apu-glc/contact-pos", relayApu, nil, 0); +setlistener("/systems/electrical/relay/ext-epc/contact-pos", relayExt, nil, 0); diff --git a/Systems/a320-misc.xml b/Systems/a320-misc.xml index 22dddba9..685be99e 100644 --- a/Systems/a320-misc.xml +++ b/Systems/a320-misc.xml @@ -39,4 +39,42 @@ + + + + + + /velocities/groundspeed-kt ge 15 + + /gear/gear[0]/compression-norm ge 0 + /gear/gear[1]/compression-norm ge 0 + /gear/gear[2]/compression-norm ge 0 + + + + + + + + /engines/engine[0]/state eq 3 + /engines/engine[1]/state eq 3 + + + + + + + /velocities/groundspeed-kt ge 2 + + + + + + + /velocities/groundspeed-kt ge 2 + + + + + From a0fce7b5aa123f0bbdfc12a5377ce459e3cec1a0 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 28 Nov 2020 15:25:02 +0000 Subject: [PATCH 04/38] Bugfix shake effect, improve buttons.nas code to avoid running settimer multiple times --- Nasal/Libraries/buttons.nas | 111 ++++++++++++++++++---------------- Nasal/Libraries/libraries.nas | 4 +- Nasal/Libraries/sounds.nas | 22 ++++--- Systems/a320-misc.xml | 6 +- 4 files changed, 79 insertions(+), 64 deletions(-) diff --git a/Nasal/Libraries/buttons.nas b/Nasal/Libraries/buttons.nas index 5c6ec78e..e6907883 100644 --- a/Nasal/Libraries/buttons.nas +++ b/Nasal/Libraries/buttons.nas @@ -3,8 +3,6 @@ # Copyright (c) 2020 Josh Davidson (Octal450) -var wow = nil; -var wowr = nil; var OnLt = props.globals.getNode("/controls/switches/emerCallLtO"); var CallLt = props.globals.getNode("/controls/switches/emerCallLtC"); var EmerCall = props.globals.getNode("/controls/switches/emerCall"); @@ -13,7 +11,7 @@ var MechCall = props.globals.getNode("/controls/switches/mechCall"); var cvr_tone = props.globals.getNode("/controls/CVR/tone"); # Resets buttons to the default values -var variousReset = func { +var variousReset = func() { setprop("/modes/cpt-du-xfr", 0); setprop("/modes/fo-du-xfr", 0); setprop("/controls/fadec/n1mode1", 0); @@ -69,67 +67,84 @@ var variousReset = func { } var BUTTONS = { + storeEmerCall: 0, update: func() { - if (EmerCall.getValue()) { - EmerCallOnLight(); - EmerCallLight(); + me.storeEmerCall = EmerCall.getValue(); + if (me.storeEmerCall) { + EmerCallOnLight(me.storeEmerCall); + EmerCallLight(me.storeEmerCall); } }, }; var _OnLt = nil; -var _EmerCall = nil; - -var EmerCallOnLight = func() { +var EmerCallOnLight = func(emerCallSts) { _OnLt = OnLt.getValue(); - _EmerCall = EmerCall.getValue(); - if ((_OnLt and _EmerCall) or !_EmerCall) { + if ((_OnLt and emerCallSts) or !emerCallSts) { OnLt.setValue(0); - } else if (!_OnLt and _EmerCall) { + } else if (!_OnLt and emerCallSts) { OnLt.setValue(1); } } var _CallLt = nil; -var _EmerCall2 = nil; - -var EmerCallLight = func() { +var EmerCallLight = func(emerCallSts) { _CallLt = CallLt.getValue(); - _EmerCall2 = EmerCall.getValue(); - if ((_CallLt and _EmerCall2) or !_EmerCall2) { + _EmerCall2 = emerCallSts; + if ((_CallLt and emerCallSts) or !emerCallSts) { CallLt.setValue(0); - } else if (!_CallLt and _EmerCall2) { + } else if (!_CallLt and emerCallSts) { CallLt.setValue(1); } } -var EmerCallFunc = func { - EmerCall.setValue(1); - settimer(func() { - EmerCall.setValue(0); - }, 10); -} - -var CabinCallFunc = func { - CabinCall.setValue(1); - settimer(func() { - CabinCall.setValue(0); - }, 15); -} - -var MechCallFunc = func { - MechCall.setValue(1); - settimer(func() { - MechCall.setValue(0); - }, 15); -} - -var CVR_test = func { - if (pts.Controls.Gear.parkingBrake.getValue()) { - cvr_tone.setValue(1); +var _EmerCallRunning = 0; +var EmerCallFunc = func() { + if (!_EmerCallRunning) { + _EmerCallRunning = 1; + EmerCall.setValue(1); settimer(func() { - cvr_tone.setValue(0); - }, 15); + EmerCall.setValue(0); + _EmerCallRunning = 0; + }, 7); + } +} + +var _CabinCallRunning = 0; +var CabinCallFunc = func() { + if (!_CabinCallRunning) { + _CabinCallRunning = 1; + CabinCall.setValue(1); + settimer(func() { + CabinCall.setValue(0); + _CabinCallRunning = 0; + }, 2); + } +} + +var _MechCallRunning = 0; +var MechCallFunc = func() { + if (!_MechCallRunning) { + _MechCallRunning = 1; + MechCall.setValue(1); + settimer(func() { + MechCall.setValue(0); + _MechCallRunning = 0; + }, 6); + } +} + +var _CVRtestRunning = 0; +var CVR_test = func() { + if (pts.Controls.Gear.parkingBrake.getValue()) { + if (!_CVRtestRunning) { + _CVRtestRunning = 1; + cvr_tone.setValue(1); + settimer(func() { + _CVRtestRunning = 0; + cvr_tone.setValue(0); + }, 15); + } } } @@ -140,7 +155,7 @@ setlistener("/controls/apu/master", func() { # poor mans set-reset latch } }, 0, 0); -var toggleSTD = func { +var toggleSTD = func() { if (pts.Instrumentation.Altimeter.std.getBoolValue()) { pts.Instrumentation.Altimeter.settingInhg.setValue(pts.Instrumentation.Altimeter.oldQnh.getValue()); pts.Instrumentation.Altimeter.std.setBoolValue(0); @@ -149,10 +164,4 @@ var toggleSTD = func { pts.Instrumentation.Altimeter.settingInhg.setValue(29.92); pts.Instrumentation.Altimeter.std.setBoolValue(1); } -} - -var pushbuttonSound = props.globals.getNode("/sim/sounde/pushbutton"); -var pushbutton = func { - pushbuttonSound.setValue(1); - settimer(func {pushbuttonSound.setValue(0);},0.20); } \ No newline at end of file diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index dfaf8938..954531ee 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -158,7 +158,7 @@ var update_items = [ } }), props.UpdateManager.FromHashList(["noSmoking","gearPosNorm"], nil, func(val) { - if (val.noSmoking) { + if (val.noSmoking == 1) { if (!noSmokingLight.getBoolValue()) { noSmokingLight.setBoolValue(1); } @@ -171,7 +171,7 @@ var update_items = [ } }), ]; - + var systemsLoop = func(notification) { if (!systemsInitialized) { return; } systems.ELEC.loop(); diff --git a/Nasal/Libraries/sounds.nas b/Nasal/Libraries/sounds.nas index e3350c31..fabe002d 100644 --- a/Nasal/Libraries/sounds.nas +++ b/Nasal/Libraries/sounds.nas @@ -97,23 +97,29 @@ setlistener("/sim/sounde/spdbrk-click", func { }); var relayBatt1 = func { - setprop("/sim/sounde/relay-batt-1",1); - settimer(func {setprop("/sim/sounde/relay-batt-1",0);},0.35); + setprop("/sim/sounde/relay-batt-1",1); + settimer(func {setprop("/sim/sounde/relay-batt-1",0);},0.35); } var relayBatt2 = func { - setprop("/sim/sounde/relay-batt-2",1); - settimer(func {setprop("/sim/sounde/relay-batt-2",0);},0.35); + setprop("/sim/sounde/relay-batt-2",1); + settimer(func {setprop("/sim/sounde/relay-batt-2",0);},0.35); } var relayApu = func { - setprop("/sim/sounde/relay-apu",1); - settimer(func {setprop("/sim/sounde/relay-apu",0);},0.35); + setprop("/sim/sounde/relay-apu",1); + settimer(func {setprop("/sim/sounde/relay-apu",0);},0.35); } var relayExt = func { - setprop("/sim/sounde/relay-ext",1); - settimer(func {setprop("/sim/sounde/relay-ext",0);},0.35); + setprop("/sim/sounde/relay-ext",1); + settimer(func {setprop("/sim/sounde/relay-ext",0);},0.35); } setlistener("/systems/electrical/sources/bat-1/contact", relayBatt1, nil, 0); setlistener("/systems/electrical/sources/bat-2/contact", relayBatt2, nil, 0); setlistener("/systems/electrical/relay/apu-glc/contact-pos", relayApu, nil, 0); setlistener("/systems/electrical/relay/ext-epc/contact-pos", relayExt, nil, 0); + +var pushbuttonSound = props.globals.getNode("/sim/sounde/pushbutton"); +var pushbutton = func() { + pushbuttonSound.setValue(1); + settimer(func {pushbuttonSound.setValue(0);},0.20); +} \ No newline at end of file diff --git a/Systems/a320-misc.xml b/Systems/a320-misc.xml index 685be99e..d661a80e 100644 --- a/Systems/a320-misc.xml +++ b/Systems/a320-misc.xml @@ -46,9 +46,9 @@ /velocities/groundspeed-kt ge 15 - /gear/gear[0]/compression-norm ge 0 - /gear/gear[1]/compression-norm ge 0 - /gear/gear[2]/compression-norm ge 0 + /gear/gear[0]/compression-norm gt 0 + /gear/gear[1]/compression-norm gt 0 + /gear/gear[2]/compression-norm gt 0 From 30a3d8576dc4ba0d21e80280408756f88594df01 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 28 Nov 2020 15:38:17 +0000 Subject: [PATCH 05/38] A320: more updates to libraries.nas --- A320-main.xml | 7 +- Nasal/Libraries/controls-override.nas | 110 ++++++++++++++++++++ Nasal/Libraries/libraries.nas | 143 +++----------------------- Nasal/Systems/Comm/HF.nas | 12 +-- Nasal/emesary/exec.nas | 6 ++ 5 files changed, 143 insertions(+), 135 deletions(-) create mode 100644 Nasal/Libraries/controls-override.nas diff --git a/A320-main.xml b/A320-main.xml index 735e4844..a4582358 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -4394,11 +4394,12 @@ Aircraft/A320-family/Nasal/Libraries/libraries.nas - Aircraft/A320-family/Nasal/Libraries/sounds.nas Aircraft/A320-family/Nasal/Libraries/buttons.nas - Aircraft/A320-family/Nasal/Libraries/shake.nas - Aircraft/A320-family/Nasal/Libraries/zoom-views.nas + Aircraft/A320-family/Nasal/Libraries/controls-override.nas Aircraft/A320-family/Nasal/Libraries/custom-views.nas + Aircraft/A320-family/Nasal/Libraries/shake.nas + Aircraft/A320-family/Nasal/Libraries/sounds.nas + Aircraft/A320-family/Nasal/Libraries/zoom-views.nas Aircraft/A320-family/AircraftConfig/acconfig.nas diff --git a/Nasal/Libraries/controls-override.nas b/Nasal/Libraries/controls-override.nas new file mode 100644 index 00000000..0d1ec0ed --- /dev/null +++ b/Nasal/Libraries/controls-override.nas @@ -0,0 +1,110 @@ +# A320 Main Libraries +# Joshua Davidson (Octal450) + +# Copyright (c) 2020 Josh Davidson (Octal450) + +############ +# Controls # +############ + +controls.stepSpoilers = func(step) { + pts.Controls.Flight.speedbrakeArm.setValue(0); + if (step == 1) { + deploySpeedbrake(); + } else if (step == -1) { + retractSpeedbrake(); + } +} + +var deploySpeedbrake = func() { + 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); + } + } else { + if (pts.Controls.Flight.speedbrake.getValue() < 0.5) { + pts.Controls.Flight.speedbrake.setValue(0.5); + } else if (pts.Controls.Flight.speedbrake.getValue() < 1.0) { + pts.Controls.Flight.speedbrake.setValue(1.0); + } + } +} + +var retractSpeedbrake = func() { + 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); + } + } else { + if (pts.Controls.Flight.speedbrake.getValue() > 0.5) { + pts.Controls.Flight.speedbrake.setValue(0.5); + } else if (pts.Controls.Flight.speedbrake.getValue() > 0.0) { + pts.Controls.Flight.speedbrake.setValue(0.0); + } + } +} + +var delta = 0; +var output = 0; +var slewProp = func(prop, delta) { + delta *= pts.Sim.Time.deltaRealtimeSec.getValue(); + output = props.globals.getNode(prop).getValue() + delta; + props.globals.getNode(prop).setValue(output); + return output; +} + +controls.flapsDown = func(step) { + pts.Controls.Flight.flapsTemp = pts.Controls.Flight.flaps.getValue(); + if (step == 1) { + if (pts.Controls.Flight.flapsTemp < 0.2) { + pts.Controls.Flight.flaps.setValue(0.2); + } else if (pts.Controls.Flight.flapsTemp < 0.4) { + pts.Controls.Flight.flaps.setValue(0.4); + } else if (pts.Controls.Flight.flapsTemp < 0.6) { + pts.Controls.Flight.flaps.setValue(0.6); + } else if (pts.Controls.Flight.flapsTemp < 0.8) { + pts.Controls.Flight.flaps.setValue(0.8); + } + } else if (step == -1) { + if (pts.Controls.Flight.flapsTemp > 0.6) { + pts.Controls.Flight.flaps.setValue(0.6); + } else if (pts.Controls.Flight.flapsTemp > 0.4) { + pts.Controls.Flight.flaps.setValue(0.4); + } else if (pts.Controls.Flight.flapsTemp > 0.2) { + pts.Controls.Flight.flaps.setValue(0.2); + } else if (pts.Controls.Flight.flapsTemp > 0) { + pts.Controls.Flight.flaps.setValue(0); + } + } +} + +controls.elevatorTrim = func(d) { + if (systems.HYD.Psi.green.getValue() >= 1500) { + slewProp("/controls/flight/elevator-trim", d * 0.0185); # Rate in JSB normalized (0.125 / 13.5) + } else { + slewProp("/controls/flight/elevator-trim", d * 0.0092) # Rate in JSB normalized (0.125 / 13.5) + } +} + +setlistener("/controls/flight/elevator-trim", func() { + if (pts.Controls.Flight.elevatorTrim.getValue() > 0.296296) { + pts.Controls.Flight.elevatorTrim.setValue(0.296296); + } +}, 0, 0); + +# For the cockpit rotation and anywhere else you want to use it +var cmdDegCalc = 0; +var slewPitchWheel = func(d) { + cmdDegCalc = math.round(pts.Fdm.JSBsim.Hydraulics.ElevatorTrim.cmdDeg.getValue(), 0.1); + if (d > 0) { # DN + if (cmdDegCalc < 4) { + cmdDegCalc = (cmdDegCalc + 0.1) / 13.5; # Add and normalize, NOT 4! 13.5 = 1 on either polarity + pts.Controls.Flight.elevatorTrim.setValue(cmdDegCalc); + } + } else { # UP + if (cmdDegCalc > -13.5) { + cmdDegCalc = (cmdDegCalc - 0.1) / 13.5; # Subtract and normalize + pts.Controls.Flight.elevatorTrim.setValue(cmdDegCalc); + } + } +} diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index 954531ee..190b6911 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -85,7 +85,7 @@ var triggerDoor = func(door, doorName, doorDesc) { var systemsInitialized = 0; var A320Libraries = nil; -var systemsInit = func { +var systemsInit = func() { systemsInitialized = 0; fbw.FBW.init(); effects.light_manager.init(); @@ -123,7 +123,7 @@ var systemsInit = func { systemsInitialized = 1; } -setlistener("/sim/signals/fdm-initialized", func { +setlistener("/sim/signals/fdm-initialized", func() { systemsInit(); fmgc.postInit(); fmgc.flightPlanTimer.start(); @@ -186,15 +186,12 @@ var systemsLoop = func(notification) { dmc.DMController.loop(); atsu.ATSU.loop(); libraries.BUTTONS.update(); - systems.HFLoop(); + systems.HFLoop(notification); - stateL = pts.Engines.Engine.state[0].getValue(); - stateR = pts.Engines.Engine.state[1].getValue(); - - if ((stateL == 2 or stateL == 3) and collectorTankL.getValue() < 1) { + if ((notification.engine1State == 2 or notification.engine1State == 3) and collectorTankL.getValue() < 1) { systems.cutoff_one(); } - if ((stateR == 2 or stateR == 3) and collectorTankR.getValue() < 1) { + if ((notification.engine2State == 2 or notification.engine2State == 3) and collectorTankR.getValue() < 1) { systems.cutoff_two(); } @@ -247,7 +244,7 @@ setlistener("/sim/replay/replay-state", func() { }, 0, 0); # Steep ILS -setlistener("/options/steep-ils", func { +setlistener("/options/steep-ils", func() { if (getprop("/options/steep-ils") == 1) { setprop("/instrumentation/mk-viii/inputs/discretes/steep-approach", 1); } else { @@ -263,12 +260,12 @@ canvas.Text.setText = func(text) { me.set("text", typeof(text) == 'scalar' ? text : ""); }; canvas.Element._lastVisible = nil; -canvas.Element.show = func { +canvas.Element.show = func() { if (1 == me._lastVisible) {return me;} me._lastVisible = 1; me.setBool("visible", 1); }; -canvas.Element.hide = func { +canvas.Element.hide = func() { if (0 == me._lastVisible) {return me;} me._lastVisible = 0; me.setBool("visible", 0); @@ -279,114 +276,8 @@ canvas.Element.setVisible = func(vis) { me.setBool("visible", vis); }; -############ -# Controls # -############ - -controls.stepSpoilers = func(step) { - pts.Controls.Flight.speedbrakeArm.setValue(0); - if (step == 1) { - deploySpeedbrake(); - } else if (step == -1) { - retractSpeedbrake(); - } -} - -var deploySpeedbrake = func { - 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); - } - } else { - if (pts.Controls.Flight.speedbrake.getValue() < 0.5) { - pts.Controls.Flight.speedbrake.setValue(0.5); - } else if (pts.Controls.Flight.speedbrake.getValue() < 1.0) { - pts.Controls.Flight.speedbrake.setValue(1.0); - } - } -} - -var retractSpeedbrake = func { - 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); - } - } else { - if (pts.Controls.Flight.speedbrake.getValue() > 0.5) { - pts.Controls.Flight.speedbrake.setValue(0.5); - } else if (pts.Controls.Flight.speedbrake.getValue() > 0.0) { - pts.Controls.Flight.speedbrake.setValue(0.0); - } - } -} - -var delta = 0; -var output = 0; -var slewProp = func(prop, delta) { - delta *= pts.Sim.Time.deltaRealtimeSec.getValue(); - output = props.globals.getNode(prop).getValue() + delta; - props.globals.getNode(prop).setValue(output); - return output; -} - -controls.flapsDown = func(step) { - pts.Controls.Flight.flapsTemp = pts.Controls.Flight.flaps.getValue(); - if (step == 1) { - if (pts.Controls.Flight.flapsTemp < 0.2) { - pts.Controls.Flight.flaps.setValue(0.2); - } else if (pts.Controls.Flight.flapsTemp < 0.4) { - pts.Controls.Flight.flaps.setValue(0.4); - } else if (pts.Controls.Flight.flapsTemp < 0.6) { - pts.Controls.Flight.flaps.setValue(0.6); - } else if (pts.Controls.Flight.flapsTemp < 0.8) { - pts.Controls.Flight.flaps.setValue(0.8); - } - } else if (step == -1) { - if (pts.Controls.Flight.flapsTemp > 0.6) { - pts.Controls.Flight.flaps.setValue(0.6); - } else if (pts.Controls.Flight.flapsTemp > 0.4) { - pts.Controls.Flight.flaps.setValue(0.4); - } else if (pts.Controls.Flight.flapsTemp > 0.2) { - pts.Controls.Flight.flaps.setValue(0.2); - } else if (pts.Controls.Flight.flapsTemp > 0) { - pts.Controls.Flight.flaps.setValue(0); - } - } -} - -controls.elevatorTrim = func(d) { - if (systems.HYD.Psi.green.getValue() >= 1500) { - slewProp("/controls/flight/elevator-trim", d * 0.0185); # Rate in JSB normalized (0.125 / 13.5) - } else { - slewProp("/controls/flight/elevator-trim", d * 0.0092) # Rate in JSB normalized (0.125 / 13.5) - } -} - -setlistener("/controls/flight/elevator-trim", func { - if (pts.Controls.Flight.elevatorTrim.getValue() > 0.296296) { - pts.Controls.Flight.elevatorTrim.setValue(0.296296); - } -}, 0, 0); - -# For the cockpit rotation and anywhere else you want to use it -var cmdDegCalc = 0; -var slewPitchWheel = func(d) { - cmdDegCalc = math.round(pts.Fdm.JSBsim.Hydraulics.ElevatorTrim.cmdDeg.getValue(), 0.1); - if (d > 0) { # DN - if (cmdDegCalc < 4) { - cmdDegCalc = (cmdDegCalc + 0.1) / 13.5; # Add and normalize, NOT 4! 13.5 = 1 on either polarity - pts.Controls.Flight.elevatorTrim.setValue(cmdDegCalc); - } - } else { # UP - if (cmdDegCalc > -13.5) { - cmdDegCalc = (cmdDegCalc - 0.1) / 13.5; # Subtract and normalize - pts.Controls.Flight.elevatorTrim.setValue(cmdDegCalc); - } - } -} - ########## -# Lights # +# Misc # ########## var pilotComfortTwoPos = func(prop) { @@ -409,25 +300,24 @@ var pilotComfortOnePos = func(prop) { } } -var lTray = func { +var lTray = func() { pilotComfortTwoPos("/controls/tray/lefttrayext"); } -var rTray = func { +var rTray = func() { pilotComfortTwoPos("/controls/tray/righttrayext"); } -var l1Pedal = func { +var l1Pedal = func() { pilotComfortOnePos("/controls/footrest-cpt[0]"); } -var l2Pedal = func { +var l2Pedal = func() { pilotComfortOnePos("/controls/footrest-cpt[1]"); } -var r1Pedal = func { +var r1Pedal = func() { pilotComfortOnePos("/controls/footrest-fo[0]"); } -var r2Pedal = func { - var r2PedalCMD = getprop("/controls/footrest-fo[1]"); +var r2Pedal = func() { pilotComfortOnePos("/controls/footrest-fo[1]"); } @@ -442,7 +332,7 @@ if (pts.Controls.Flight.autoCoordination.getBoolValue()) { pts.Controls.Flight.aileronDrivesTiller.setBoolValue(0); } -setlistener("/controls/flight/auto-coordination", func { +setlistener("/controls/flight/auto-coordination", func() { pts.Controls.Flight.autoCoordination.setBoolValue(0); print("System: Auto Coordination has been turned off as it is not compatible with the fly-by-wire of this aircraft."); screen.log.write("Auto Coordination has been disabled as it is not compatible with the fly-by-wire of this aircraft", 1, 0, 0); @@ -483,6 +373,7 @@ var LibrariesRecipient = }; var input = { + # Libraries "seatbelt": "/controls/switches/seatbelt-sign", "noSmoking": "/controls/switches/no-smoking-sign", "gearPosNorm": "/gear/gear[0]/position-norm", diff --git a/Nasal/Systems/Comm/HF.nas b/Nasal/Systems/Comm/HF.nas index 1a4257ff..3440d4d6 100644 --- a/Nasal/Systems/Comm/HF.nas +++ b/Nasal/Systems/Comm/HF.nas @@ -118,9 +118,9 @@ var HFS = [highFrequencyRadio.new(systems.ELEC.Bus.acEssShed, 0), highFrequencyR # Can't use setlistener on the voltage as it always gets written to by JSB (and changes according to engine rpm) var update_items_HF_radio = [ - props.UpdateManager.FromProperty("/systems/electrical/bus/ac-ess-shed", 0.1, func(notification) + props.UpdateManager.FromHashValue("elecACEssShed", 0.1, func(val) { - if (systems.ELEC.Bus.acEssShed.getValue() < 110) { + if (val < 110) { HFS[0].transmit = 0; HFS[0].receptionProp.setValue(0); toneTimer1.stop(); @@ -133,9 +133,9 @@ var update_items_HF_radio = [ } } ), - props.UpdateManager.FromProperty("/systems/electrical/bus/ac-2", 0.1, func(notification) + props.UpdateManager.FromHashValue("elecAC2", 0.1, func(val) { - if (systems.ELEC.Bus.ac2.getValue() < 110) { + if (val) { HFS[1].transmit = 0; HFS[1].receptionProp.setValue(0); toneTimer2.stop(); @@ -150,9 +150,9 @@ var update_items_HF_radio = [ ), ]; -var HFLoop = func() { +var HFLoop = func(notification) { foreach (var update_item_HF; update_items_HF_radio) { - update_item_HF.update(nil); + update_item_HF.update(notification); } } diff --git a/Nasal/emesary/exec.nas b/Nasal/emesary/exec.nas index 3ea20548..af3ad265 100644 --- a/Nasal/emesary/exec.nas +++ b/Nasal/emesary/exec.nas @@ -43,6 +43,12 @@ input = { elapsedTime: "/sim/time/elapsed-sec", FWCPhase: "/ECAM/warning-phase", gear0Wow: "/gear/gear[0]/wow", + + # Just about everything uses these properties at some stage, lets add them here! + elecAC1: "/systems/electrical/bus/ac-1", + elecAC2: "/systems/electrical/bus/ac-2", + elecACEss: "/systems/electrical/bus/ac-ess", + elecACEssShed: "/systems/electrical/bus/ac-ess-shed", engine1State: "/engines/engine[0]/state", engine2State: "/engines/engine[1]/state", }; From d2c6dc100d199fc7724025d722204887ded6905a Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 28 Nov 2020 15:39:24 +0000 Subject: [PATCH 06/38] Default value of no smoking sign to 0.5 --- Nasal/Libraries/buttons.nas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nasal/Libraries/buttons.nas b/Nasal/Libraries/buttons.nas index e6907883..289abfb2 100644 --- a/Nasal/Libraries/buttons.nas +++ b/Nasal/Libraries/buttons.nas @@ -62,7 +62,7 @@ var variousReset = func() { setprop("/modes/fcu/hdg-time", -45); setprop("/controls/navigation/switching/att-hdg", 0); setprop("/controls/navigation/switching/air-data", 0); - setprop("/controls/switches/no-smoking-sign", 1); + setprop("/controls/switches/no-smoking-sign", 0.5); setprop("/controls/switches/seatbelt-sign", 1); } From c65ab20ae45dded7242b2f74fdd4827f7a4e4c0d Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 28 Nov 2020 15:57:56 +0000 Subject: [PATCH 07/38] Un-delete CFM FADEC --- A320-200-CFM-set.xml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/A320-200-CFM-set.xml b/A320-200-CFM-set.xml index f6d90a03..3c94e222 100644 --- a/A320-200-CFM-set.xml +++ b/A320-200-CFM-set.xml @@ -201,7 +201,16 @@ 0 - + + + + Aircraft/A320-family/Systems/fadec-cfm.xml + + + Aircraft/A320-family/Systems/cfm56-sound.xml + + + From 3eec965bc33cc2c893882d9200c7eb01b1edd8bc Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 28 Nov 2020 15:58:27 +0000 Subject: [PATCH 08/38] Revision --- revision.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revision.txt b/revision.txt index d2e1cefe..7d373862 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -44 \ No newline at end of file +45 \ No newline at end of file From b16aac146ec952f597cf4ae4c9c8613267118e20 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 28 Nov 2020 17:33:44 +0000 Subject: [PATCH 09/38] FCU: fix bindings. Not all FBW failures inhibit the autoflight system. --- Nasal/FMGC/FCU.nas | 18 +++++++++--------- Nasal/FMGC/FMGC-b.nas | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index fc21405f..8a2a6a78 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -58,7 +58,7 @@ var FCU = { var FCUController = { FCU1: nil, FCU2: nil, - activeFMGC: props.globals.getNode("FMGC/active-fmgc-channel"), + activeFMGC: props.globals.getNode("/FMGC/active-fmgc-channel"), FCUworking: 0, _init: 0, init: func() { @@ -81,9 +81,8 @@ var FCUController = { FCUworkingNode.setValue(0); } - notification = nil; foreach (var update_item; me.update_items) { - update_item.update(notification); + update_item.update(nil); } }, update_items: [ @@ -99,8 +98,8 @@ var FCUController = { me.FCU2.restore(); }, AP1: func() { - if (me.FCUworking and fbw.FBW.activeLaw.getValue() == 0) { - if (!ap1.getBoolValue()) { + if (me.FCUworking) { + if (!ap1.getBoolValue() and fbw.FBW.apOff == 0) { ap1Input.setValue(1); ecam.apWarnNode.setValue(0); pts.Controls.Flight.rudderTrim.setValue(0); @@ -110,9 +109,10 @@ var FCUController = { } }, AP2: func() { - if (me.FCUworking and fbw.FBW.activeLaw.getValue() == 0) { - if (!ap2.getBoolValue()) { + if (me.FCUworking) { + if (!ap2.getBoolValue() and fbw.FBW.apOff == 0) { ap2Input.setValue(1); + ecam.apWarnNode.setValue(0); pts.Controls.Flight.rudderTrim.setValue(0); } else { apOff("hard", 2); @@ -120,8 +120,8 @@ var FCUController = { } }, ATHR: func() { - if (me.FCUworking and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.activeLaw.getValue() == 0) { - if (!athr.getBoolValue()) { + if (me.FCUworking) { + if (!athr.getBoolValue() and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0) { athrInput.setValue(1); } else { athrOff("hard"); diff --git a/Nasal/FMGC/FMGC-b.nas b/Nasal/FMGC/FMGC-b.nas index 32ab417d..b5f19f1b 100644 --- a/Nasal/FMGC/FMGC-b.nas +++ b/Nasal/FMGC/FMGC-b.nas @@ -441,7 +441,7 @@ var ITAF = { }, ap1Master: func(s) { if (s == 1) { - if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and Misc.fbwLaw.getValue() == 0 and Position.gearAglFt.getValue() >= 100) { + if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100) { me.revertBasicMode(); Output.ap1.setBoolValue(1); Output.latTemp = Output.lat.getValue(); @@ -462,7 +462,7 @@ var ITAF = { }, ap2Master: func(s) { if (s == 1) { - if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and Misc.fbwLaw.getValue() == 0 and Position.gearAglFt.getValue() >= 100) { + if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100) { me.revertBasicMode(); Output.ap2.setBoolValue(1); Output.latTemp = Output.lat.getValue(); @@ -492,7 +492,7 @@ var ITAF = { }, athrMaster: func(s) { if (s == 1) { - if (systems.ELEC.Bus.acEss.getValue() >= 110) { + if (systems.ELEC.Bus.acEss.getValue() >= 110 and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0) { Output.athr.setBoolValue(1); Custom.ThrLock.setValue(0); Custom.Sound.enableAthrOff = 1; From 05e992132deb6690233eef0bb297b82295d27aa1 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 29 Nov 2020 13:17:56 +0000 Subject: [PATCH 10/38] Add G-force indication to the SD --- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 45 +++++++----- Models/Instruments/Lower-ECAM/res/apu.svg | 12 ++++ Models/Instruments/Lower-ECAM/res/bleed.svg | 12 ++++ .../Lower-ECAM/res/bottomstatus.svg | 69 +++++++++++-------- Models/Instruments/Lower-ECAM/res/cond.svg | 12 ++++ Models/Instruments/Lower-ECAM/res/crz.svg | 12 ++++ Models/Instruments/Lower-ECAM/res/door.svg | 12 ++++ Models/Instruments/Lower-ECAM/res/elec.svg | 12 ++++ Models/Instruments/Lower-ECAM/res/eng.svg | 12 ++++ Models/Instruments/Lower-ECAM/res/fctl.svg | 12 ++++ Models/Instruments/Lower-ECAM/res/fuel.svg | 12 ++++ Models/Instruments/Lower-ECAM/res/hyd.svg | 12 ++++ Models/Instruments/Lower-ECAM/res/press.svg | 12 ++++ Models/Instruments/Lower-ECAM/res/status.svg | 12 ++++ Models/Instruments/Lower-ECAM/res/wheel.svg | 12 ++++ Nasal/Libraries/property-tree-setup.nas | 4 ++ Systems/a320-misc.xml | 21 ++++++ 17 files changed, 250 insertions(+), 45 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 100b3f89..cfc1cc34 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -78,7 +78,6 @@ var elevator_ind_right = props.globals.getNode("/ECAM/Lower/elevator-ind-right", var elevator_trim_deg = props.globals.getNode("/ECAM/Lower/elevator-trim-deg", 1); var final_deg = props.globals.getNode("/fdm/jsbsim/hydraulics/rudder/final-deg", 1); var temperature_degc = props.globals.getNode("/environment/temperature-degc", 1); -var gw = props.globals.getNode("/fdm/jsbsim/inertia/weight-lbs", 1); var tank3_content_lbs = props.globals.getNode("/fdm/jsbsim/propulsion/tank[2]/contents-lbs", 1); var ir2_knob = props.globals.getNode("/controls/adirs/ir[1]/knob", 1); var apuBleedNotOn = props.globals.getNode("/systems/pneumatics/warnings/apu-bleed-not-on", 1); @@ -118,6 +117,7 @@ var doorR4_pos = props.globals.getNode("/sim/model/door-positions/doorr4/positio var cargobulk_pos = props.globals.getNode("/sim/model/door-positions/cargobulk/position-norm", 1); var cargofwd_pos = props.globals.getNode("/sim/model/door-positions/cargofwd/position-norm", 1); var cargoaft_pos = props.globals.getNode("/sim/model/door-positions/cargoaft/position-norm", 1); +var gLoad = props.globals.getNode("/ECAM/Lower/g-force-display", 1); # Hydraulic var blue_psi = 0; @@ -479,6 +479,7 @@ var canvas_lowerECAM_base = { lowerECAM_wheel.page.hide(); } }, + displayedGForce: 0, updateBottomStatus: func() { if (dmc.DMController.DMCs[1].outputs[4] != nil) { me["SAT"].setText(sprintf("%2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); @@ -496,13 +497,25 @@ var canvas_lowerECAM_base = { me["TAT"].setColor(0.7333,0.3803,0); } + me.gloadStore = gLoad.getValue(); + if ((me.gloadStore == 1 and !me.displayedGForce) or (me.gloadStore != 0 and me.displayedGForce)) { + me.displayedGForce = 1; + me["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", pts.Accelerations.pilotGDamped.getValue())); + me["GLoad"].show(); + } else { + me.displayedGForce = 0; + me["GLoad"].hide(); + } + me["UTCh"].setText(sprintf("%02d", hour.getValue())); me["UTCm"].setText(sprintf("%02d", minute.getValue())); + + me.gwStore = pts.Fdm.JSBsim.Inertia.weightLbs.getValue(); if (acconfig_weight_kgs.getValue()) { - me["GW"].setText(sprintf("%s", math.round(math.round(gw.getValue() * LBS2KGS, 100)))); + me["GW"].setText(sprintf("%s", math.round(math.round(me.gwStore * LBS2KGS, 100)))); me["GW-weight-unit"].setText("KG"); } else { - me["GW"].setText(sprintf("%s", math.round(gw.getValue(), 100))); + me["GW"].setText(sprintf("%s", math.round(me.gwStore, 100))); me["GW-weight-unit"].setText("LBS"); } }, @@ -516,7 +529,7 @@ var canvas_lowerECAM_apu = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","APUN-needle","APUEGT-needle","APUN","APUEGT","APUAvail","APUFlapOpen","APUBleedValve","APUBleedOnline","APUGenOnline","APUGentext","APUGenLoad","APUGenbox","APUGenVolt","APUGenHz","APUBleedPSI","APUfuelLO","APU-low-oil", + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","APUN-needle","APUEGT-needle","APUN","APUEGT","APUAvail","APUFlapOpen","APUBleedValve","APUBleedOnline","APUGenOnline","APUGentext","APUGenLoad","APUGenbox","APUGenVolt","APUGenHz","APUBleedPSI","APUfuelLO","APU-low-oil", "text3724","text3728","text3732"]; }, update: func() { @@ -649,7 +662,7 @@ var canvas_lowerECAM_bleed = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit", "BLEED-XFEED", "BLEED-Ram-Air", "BLEED-APU-CIRCLE", "BLEED-HP-Valve-1", + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit", "BLEED-XFEED", "BLEED-Ram-Air", "BLEED-APU-CIRCLE", "BLEED-HP-Valve-1", "BLEED-APU-LINES","BLEED-ENG-1", "BLEED-HP-Valve-2", "BLEED-ENG-2", "BLEED-Precooler-1-Inlet-Press", "BLEED-Precooler-1-Outlet-Temp", "BLEED-Precooler-2-Inlet-Press", "BLEED-Precooler-2-Outlet-Temp", "BLEED-ENG-1-label", "BLEED-ENG-2-label", "BLEED-GND", "BLEED-Pack-1-Flow-Valve", "BLEED-Pack-2-Flow-Valve", "BLEED-Pack-1-Out-Temp","BLEED-APU-connectionTop", @@ -997,7 +1010,7 @@ var canvas_lowerECAM_cond = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","CargoCond","CONDHotAirValve","CONDFanFwdFault","CONDFanAftFault", + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","CargoCond","CONDHotAirValve","CONDFanFwdFault","CONDFanAftFault", "CONDTrimValveCKPT","CONDTrimValveAFT","CONDTrimValveFWD","CONDDuctTempCKPT","CONDDuctTempAFT","CONDDuctTempFWD","CONDTempCKPT","CONDTempAFT","CONDTempFWD"]; }, update: func() { @@ -1047,7 +1060,7 @@ var canvas_lowerECAM_crz = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","Oil1","Oil2","FUsed1","FUsed2","FUsed","VIB1N1","VIB1N2","VIB2N1","VIB2N2","deltaPSI","LDGELEV-AUTO","LDGELEV","CABVS","CABALT","VS-Arrow-UP","VS-Arrow-DN","CKPT-TEMP","FWD-TEMP","AFT-TEMP","Fused-weight-unit"]; + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","Oil1","Oil2","FUsed1","FUsed2","FUsed","VIB1N1","VIB1N2","VIB2N1","VIB2N2","deltaPSI","LDGELEV-AUTO","LDGELEV","CABVS","CABALT","VS-Arrow-UP","VS-Arrow-DN","CKPT-TEMP","FWD-TEMP","AFT-TEMP","Fused-weight-unit"]; }, update: func() { @@ -1078,7 +1091,7 @@ var canvas_lowerECAM_door = { return m; }, getKeys: func() { - return["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","Bulk","BulkLine","BulkLbl","Exit1L","Exit1R","Cabin1Left","Cabin1LeftLbl","Cabin1LeftLine","Cabin1LeftSlide","Cabin1Right","Cabin1RightLbl","Cabin1RightLine","Cabin1RightSlide","Cabin2Left","Cabin2LeftLbl", + return["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","Bulk","BulkLine","BulkLbl","Exit1L","Exit1R","Cabin1Left","Cabin1LeftLbl","Cabin1LeftLine","Cabin1LeftSlide","Cabin1Right","Cabin1RightLbl","Cabin1RightLine","Cabin1RightSlide","Cabin2Left","Cabin2LeftLbl", "Cabin2LeftLine","Cabin2LeftSlide","Cabin2Right","Cabin2RightLbl","Cabin2RightLine","Cabin2RightSlide","Cabin3Left","Cabin3LeftLbl","Cabin3LeftLine","Cabin3LeftSlide","Cabin3Right","Cabin3RightLbl","Cabin3RightLine","Cabin3RightSlide","AvionicsLine1", "AvionicsLbl1","AvionicsLine2","AvionicsLbl2","Cargo1Line","Cargo1Lbl","Cargo1Door","Cargo2Line","Cargo2Lbl","Cargo2Door","ExitLSlide","ExitLLine","ExitLLbl","ExitRSlide","ExitRLine","ExitRLbl","Cabin4Left","Cabin4LeftLbl","Cabin4LeftLine", "Cabin4LeftSlide","Cabin4Right","Cabin4RightLbl","Cabin4RightLine","Cabin4RightSlide","DOOROXY-REGUL-LO-PR"]; @@ -1223,7 +1236,7 @@ var canvas_lowerECAM_elec = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","BAT1-label","Bat1Volt","Bat1Ampere","BAT2-label","Bat2Volt","Bat2Ampere","BAT1-charge","BAT1-discharge","BAT2-charge","BAT2-discharge","ELEC-Line-DC1-DCBAT","ELEC-Line-DC1-DCESS","ELEC-Line-DC2-DCBAT", + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","BAT1-label","Bat1Volt","Bat1Ampere","BAT2-label","Bat2Volt","Bat2Ampere","BAT1-charge","BAT1-discharge","BAT2-charge","BAT2-discharge","ELEC-Line-DC1-DCBAT","ELEC-Line-DC1-DCESS","ELEC-Line-DC2-DCBAT", "ELEC-Line-DC1-DCESS_DCBAT","ELEC-Line-DC2-DCESS_DCBAT","ELEC-Line-TR1-DC1","ELEC-Line-TR2-DC2","Shed-label","ELEC-Line-ESSTR-DCESS","TR1-label","TR1Volt","TR1Ampere","TR2-label","TR2Volt","TR2Ampere","EMERGEN-group","EmergenVolt","EmergenHz", "ELEC-Line-Emergen-ESSTR","EMERGEN-Label-off","Emergen-Label","EMERGEN-out","ELEC-Line-ACESS-TRESS","ELEC-Line-AC1-TR1","ELEC-Line-AC2-TR2","ELEC-Line-AC1-ACESS","ELEC-Line-AC2-ACESS","ACESS-SHED","ACESS","AC1-in","AC2-in","ELEC-Line-GEN1-AC1","ELEC-Line-GEN2-AC2", "ELEC-Line-APU-AC1","ELEC-Line-APU-EXT","ELEC-Line-EXT-AC2","APU-out","EXT-out","EXTPWR-group","ExtVolt","ExtHz","APU-content","APU-border","APUGentext","APUGenLoad","APUGenVolt","APUGenHz","APUGEN-off","GEN1-label","Gen1Load","Gen1Volt","Gen1Hz", @@ -1895,7 +1908,7 @@ var canvas_lowerECAM_eng = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","OilQT1-needle","OilQT2-needle","OilQT1","OilQT2","OilQT1-decimal","OilQT2-decimal","OilPSI1-needle","OilPSI2-needle","OilPSI1","OilPSI2","FUEL-used-1","FUEL-used-2", "Fused-weight-unit"]; + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","OilQT1-needle","OilQT2-needle","OilQT1","OilQT2","OilQT1-decimal","OilQT2-decimal","OilPSI1-needle","OilPSI2-needle","OilPSI1","OilPSI2","FUEL-used-1","FUEL-used-2", "Fused-weight-unit"]; }, update: func() { # Oil Quantity @@ -1953,7 +1966,7 @@ var canvas_lowerECAM_fctl = { return m; }, getKeys: func() { - return["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","ailL","ailR","elevL","elevR","PTcc","PT","PTupdn","elac1","elac2","sec1","sec2","sec3","ailLblue","ailRblue","elevLblue","elevRblue","rudderblue","ailLgreen","ailRgreen","elevLgreen","ruddergreen","PTgreen", + return["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","ailL","ailR","elevL","elevR","PTcc","PT","PTupdn","elac1","elac2","sec1","sec2","sec3","ailLblue","ailRblue","elevLblue","elevRblue","rudderblue","ailLgreen","ailRgreen","elevLgreen","ruddergreen","PTgreen", "elevRyellow","rudderyellow","PTyellow","rudder","spdbrkblue","spdbrkgreen","spdbrkyellow","spoiler1Rex","spoiler1Rrt","spoiler2Rex","spoiler2Rrt","spoiler3Rex","spoiler3Rrt","spoiler4Rex","spoiler4Rrt","spoiler5Rex","spoiler5Rrt","spoiler1Lex", "spoiler1Lrt","spoiler2Lex","spoiler2Lrt","spoiler3Lex","spoiler3Lrt","spoiler4Lex","spoiler4Lrt","spoiler5Lex","spoiler5Lrt","spoiler1Rf","spoiler2Rf","spoiler3Rf","spoiler4Rf","spoiler5Rf","spoiler1Lf","spoiler2Lf","spoiler3Lf","spoiler4Lf", "spoiler5Lf","ailLscale","ailRscale","path4249","path4249-3","path4249-3-6-7","path4249-3-6-7-5","path4249-3-6","text4343"]; @@ -2383,7 +2396,7 @@ var canvas_lowerECAM_fuel = { return m; }, getKeys: func() { - return["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","FUEL-Pump-Left-1","FUEL-Pump-Left-2","FUEL-Pump-Center-1","FUEL-Pump-Center-2","FUEL-Pump-Right-1","FUEL-Pump-Right-2","FUEL-Left-blocked","FUEL-Right-blocked","FUEL-Center-blocked","FUEL-Left-Transfer", + return["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","FUEL-Pump-Left-1","FUEL-Pump-Left-2","FUEL-Pump-Center-1","FUEL-Pump-Center-2","FUEL-Pump-Right-1","FUEL-Pump-Right-2","FUEL-Left-blocked","FUEL-Right-blocked","FUEL-Center-blocked","FUEL-Left-Transfer", "FUEL-Right-Transfer","FUEL-Left-Outer-Inacc","FUEL-Left-Inner-Inacc","FUEL-Center-Inacc","FUEL-Right-Inner-Inacc","FUEL-Right-Outer-Inacc","FUEL-Left-Outer-quantity","FUEL-Left-Inner-quantity","FUEL-Center-quantity","FUEL-Right-Inner-quantity", "FUEL-Right-Outer-quantity","FUEL-On-Board","FUEL-Flow-per-min","FUEL-APU-arrow","FUEL-APU-line","FUEL-APU-label","FUEL-used-1","FUEL-used-both","FUEL-used-2","FUEL-ENG-Master-1","FUEL-ENG-Master-2","FUEL-XFEED","FUEL-XFEED-pipes","FUEL-Left-Outer-temp", "FUEL-Left-Inner-temp","FUEL-Right-Inner-temp","FUEL-Right-Outer-temp","FUEL-Pump-Left-1-Closed","FUEL-Pump-Left-1-Open","FUEL-Pump-Left-2-Closed","FUEL-Pump-Left-2-Open","FUEL-Pump-Center-1-Open","FUEL-Pump-Center-1-Closed","FUEL-Pump-Center-2-Closed", @@ -2663,7 +2676,7 @@ var canvas_lowerECAM_press = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit", "PRESS-Cab-VS", "PRESS-Cab-VS-neg", "PRESS-Cab-Alt"]; + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit", "PRESS-Cab-VS", "PRESS-Cab-VS-neg", "PRESS-Cab-Alt"]; }, update: func() { me["PRESS-Cab-VS"].setText(sprintf("%4.0f", press_vs_norm.getValue())); @@ -2682,7 +2695,7 @@ var canvas_lowerECAM_status = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit"]; + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit"]; }, update: func() { @@ -2698,7 +2711,7 @@ var canvas_lowerECAM_hyd = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","Green-Indicator","Blue-Indicator","Yellow-Indicator","Press-Green","Press-Blue","Press-Yellow","Green-Line","Blue-Line","Yellow-Line","PTU-Supply-Line","PTU-supply-yellow","PTU-supply-green","PTU-connection", + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","Green-Indicator","Blue-Indicator","Yellow-Indicator","Press-Green","Press-Blue","Press-Yellow","Green-Line","Blue-Line","Yellow-Line","PTU-Supply-Line","PTU-supply-yellow","PTU-supply-green","PTU-connection", "PTU-Auto-or-off","RAT-label","RAT-stowed","RAT-not-stowed","ELEC-Yellow-off","ELEC-Yellow-on","ELEC-Yellow-label","ELEC-OVTH-Yellow","ELEC-Blue-label","ELEC-OVHT-Blue","ELEC-OVHT-Yellow","Pump-Green-label","Pump-Yellow-label","Pump-Green", "Pump-LOPR-Green","Pump-Green-off","Pump-Green-on","Pump-Yellow","Pump-LOPR-Yellow","Pump-Yellow-off","Pump-Yellow-on","Pump-Blue", "Pump-Blue-off","Pump-Blue-on","Fire-Valve-Green","Fire-Valve-Yellow","LO-AIR-PRESS-Green", "LO-AIR-PRESS-Yellow","LO-AIR-PRESS-Blue","OVHT-Green","OVHT-Blue","OVHT-Yellow","Quantity-Indicator-Green","Quantity-Indicator-Blue","Quantity-Indicator-Yellow","Green-label","Blue-label","Yellow-label"]; @@ -2967,7 +2980,7 @@ var canvas_lowerECAM_wheel = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GW-weight-unit","lgctltext","NORMbrk","NWStext","leftdoor","rightdoor","nosegeardoorL","nosegeardoorR", + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","lgctltext","NORMbrk","NWStext","leftdoor","rightdoor","nosegeardoorL","nosegeardoorR", "autobrk","autobrkind","NWS","NWSrect","normbrk-rect","altnbrk","normbrkhyd","spoiler1Rex","spoiler1Rrt","spoiler2Rex","spoiler2Rrt","spoiler3Rex", "spoiler3Rrt","spoiler4Rex","spoiler4Rrt","spoiler5Rex","spoiler5Rrt","spoiler1Lex","spoiler1Lrt","spoiler2Lex","spoiler2Lrt", "spoiler3Lex","spoiler3Lrt","spoiler4Lex","spoiler4Lrt","spoiler5Lex","spoiler5Lrt","spoiler1Rf","spoiler2Rf","spoiler3Rf","spoiler4Rf","spoiler5Rf", diff --git a/Models/Instruments/Lower-ECAM/res/apu.svg b/Models/Instruments/Lower-ECAM/res/apu.svg index 77fff762..3f443c84 100644 --- a/Models/Instruments/Lower-ECAM/res/apu.svg +++ b/Models/Instruments/Lower-ECAM/res/apu.svg @@ -201,6 +201,18 @@ x="465.99081" id="tspan4176" sodipodi:role="line">00 + G.LOAD 0.6 00 + G.LOAD 0.6 @@ -37,14 +37,14 @@ guidetolerance="1" 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="true" - inkscape:zoom="0.70710678" - inkscape:cx="863.7473" - inkscape:cy="199.56079" - inkscape:window-x="1592" + inkscape:zoom="1.2381039" + inkscape:cx="615.56215" + inkscape:cy="75.799562" + inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="svg2"> @@ -81,8 +81,7 @@ style="font-style:normal;font-weight:normal;line-height:0%;font-family:'Liberation Sans';letter-spacing:0px;word-spacing:0px;fill:#179ab7;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" x="500.75214" y="977.31793" - id="text6232" - sodipodi:linespacing="0%">120000 °C 00 + G.LOAD 0.6 + diff --git a/Models/Instruments/Lower-ECAM/res/cond.svg b/Models/Instruments/Lower-ECAM/res/cond.svg index e00eb275..c8319978 100644 --- a/Models/Instruments/Lower-ECAM/res/cond.svg +++ b/Models/Instruments/Lower-ECAM/res/cond.svg @@ -987,6 +987,18 @@ x="560.88452" y="976.25214" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:36px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#0dc04b">00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 00 + G.LOAD 0.6 diff --git a/Models/Instruments/Lower-ECAM/res/status.svg b/Models/Instruments/Lower-ECAM/res/status.svg index 05be17ab..3efe4855 100644 --- a/Models/Instruments/Lower-ECAM/res/status.svg +++ b/Models/Instruments/Lower-ECAM/res/status.svg @@ -225,6 +225,18 @@ x="560.88452" y="976.25214" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:36px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#0dc04b">00 + G.LOAD 0.6 00 + G.LOAD 0.6 + + + + + + + + /accelerations/pilot-gdamped lt 0.7 + /accelerations/pilot-gdamped gt 1.4 + + /ECAM/warning-phase ge 4 + + + + + /ECAM/Lower/g-force-display-cmd + 0.5 + 0.2 + + + From 60969bba6e1606939c50049469fbcca9316d4d59 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 29 Nov 2020 14:39:03 +0000 Subject: [PATCH 11/38] Bugfix upper ECAM --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index cdc8609d..ae43662d 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -1,5 +1,4 @@ var flapsPos = nil; -var elapsedtime = nil; var LBS2KGS = 0.4535924; var slatLockGoing = 0; var slatLockFlash = 0; @@ -508,7 +507,7 @@ var canvas_upperECAM = { me.updatePower(); if (me.test.getVisible() == 1) { - me.updateTest(); + me.updateTest(notification); } if (me.group.getVisible() == 0) { @@ -905,8 +904,8 @@ var canvas_upperECAM = { } }, - updateTest: func() { - if (du3_test_time.getValue() + 1 >= pts.Sim.Time.elapsedSec.getValue()) { + updateTest: func(notification) { + if (du3_test_time.getValue() + 1 >= notification.elapsedTime) { me["Test_white"].show(); me["Test_text"].hide(); } else { From c9d13ca14b882151d5495c615366c3d2493092dd Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 29 Nov 2020 16:58:38 +0000 Subject: [PATCH 12/38] CPDLC: add free text page --- A320-main.xml | 1 + Models/Instruments/MCDU/MCDU.nas | 97 +++++++++++++++++++++++++++++++- Nasal/MCDU/MCDU.nas | 32 ++++++++++- Nasal/Systems/Comm/CPDLC.nas | 28 ++++++++- 4 files changed, 150 insertions(+), 8 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index a4582358..e71cfca1 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -4540,6 +4540,7 @@ Aircraft/A320-family/Nasal/Systems/Comm/Dictionary.nas Aircraft/A320-family/Nasal/Systems/Comm/Notification.nas + Aircraft/A320-family/Nasal/Systems/Comm/CPDLC.nas Aircraft/A320-family/Nasal/Displays/DMC.nas diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index b04c2835..e44fcf4a 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -922,9 +922,9 @@ var canvas_MCDU_base = { me["Simple_L0S"].hide(); me.showLeftS(-1, -1, -1, -1, -1, 1); me.showLeftArrow(1, 1, -1, 1, 1, 1); - me.showRight(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(); @@ -948,12 +948,103 @@ var canvas_MCDU_base = { me["Simple_R1"].setText("VERT REQ "); me["Simple_R2"].setText("OTHER "); me["Simple_R3"].setText("TEXT "); - me["Simple_R3"].setText("REPORTS "); + me["Simple_R4"].setText("REPORTS "); me["Simple_R5"].setText("STATUS "); me["Simple_R5S"].setText("CONNECTION "); me["Simple_R6"].setText("EMERGENCY "); pageSwitch[i].setBoolValue(1); } + } else if (page == "MCDUTEXT") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHideWithCenter(); + me["Simple_Title"].setText("TEXT"); + me["Simple_Title"].setColor(1, 1, 1); + me["Simple_PageNum"].setText("1/2"); + me["Simple_PageNum"].show(); + me["ArrowLeft"].show(); + me["ArrowRight"].show(); + + 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.showRightS(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["Simple_L4"].setFont(symbol); + + me.colorLeft("wht", "wht", "wht", "blu", "wht", "wht"); + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftArrow("blu", "blu", "blu", "wht", "wht", "wht"); + me.colorRight("wht", "wht", "wht", "wht", "wht", "blu"); + me.colorRightS("wht", "wht", "wht", "wht", "wht", "blu"); + me.colorRightArrow("blu", "blu", "blu", "wht", "wht", "blu"); + + + me["Simple_L1"].setText(" A/C PERFORM."); + me["Simple_L1S"].setText(" DUE TO"); + me["Simple_L2"].setText(" WEATHER"); + me["Simple_L2S"].setText(" DUE TO"); + me["Simple_L3"].setText(" TURBULENCE"); + me["Simple_L3S"].setText(" DUE TO"); + me["Simple_R1"].setText("MEDICAL "); + me["Simple_R1S"].setText("DUE TO "); + me["Simple_R2"].setText("TECHNICAL "); + me["Simple_R2S"].setText("DUE TO" ); + me["Simple_R3"].setText("DISCRETION "); + me["Simple_R3S"].setText("AT PILOTS "); + me["Simple_C4S"].setText("-------- FREE TEXT --------"); + me["Simple_L4"].setText("[ ]"); + me["Simple_L5"].setText(" ERASE"); + me["Simple_L5S"].setText(" ALL FIELDS"); + me["Simple_L6S"].setText(" ATC MENU"); + me["Simple_L6"].setText(" RETURN"); + me["Simple_R6S"].setText("ATC "); + me["Simple_R6"].setText("TEXT DISPL "); + pageSwitch[i].setBoolValue(1); + } + + if (atsu.freeTexts[i].selection == 0) { + pageSwitch[i].setBoolValue(0); + me["Simple_L1_Arrow"].hide(); + me["Simple_L1"].setColor(BLUE); + me["Simple_L1S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 1) { + pageSwitch[i].setBoolValue(0); + me["Simple_L2_Arrow"].hide(); + me["Simple_L2"].setColor(BLUE); + me["Simple_L2S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 2) { + pageSwitch[i].setBoolValue(0); + me["Simple_L3_Arrow"].hide(); + me["Simple_L3"].setColor(BLUE); + me["Simple_L3S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 3) { + pageSwitch[i].setBoolValue(0); + me["Simple_R1_Arrow"].hide(); + me["Simple_R1"].setColor(BLUE); + me["Simple_R1S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 4) { + pageSwitch[i].setBoolValue(0); + me["Simple_R2_Arrow"].hide(); + me["Simple_R2"].setColor(BLUE); + me["Simple_R2S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 5) { + pageSwitch[i].setBoolValue(0); + me["Simple_R3_Arrow"].hide(); + me["Simple_R3"].setColor(BLUE); + me["Simple_R3S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 9) { + pageSwitch[i].setBoolValue(0); + me["Simple_L5_Arrow"].hide(); + } } else if (page == "ATCMENU2") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 05d5d240..f4bfac92 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -354,6 +354,9 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 0; + atsu.freeTexts[i].changed = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -495,6 +498,9 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 1; + atsu.freeTexts[i].changed = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -619,6 +625,9 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 2; + atsu.freeTexts[i].changed = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -786,6 +795,9 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } else if (page == "ATCMENU") { pageNode[i].setValue("NOTIFICATION"); + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 9; + atsu.freeTexts[i].changed = 1; } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(5); } else { @@ -845,7 +857,7 @@ var lskbutton = func(btn, i) { canvas_mcdu.myClosestAirport[i].freeze(); } else if (page == "AOCMENU" or page == "ATCMENU" or page == "ATCMENU2") { pageNode[i].setValue("ATSUDLINK"); - } else if (page == "NOTIFICATION" or page == "CONNECTSTATUS") { + } else if (page == "NOTIFICATION" or page == "CONNECTSTATUS" or page == "MCDUTEXT") { pageNode[i].setValue("ATCMENU"); } else if (page == "WEATHERREQ" or page == "RECEIVEDMSGS") { pageNode[i].setValue("AOCMENU"); @@ -951,6 +963,9 @@ var rskbutton = func(btn, i) { } else { mcdu_message(i, "NOT ALLOWED"); } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 3; + atsu.freeTexts[i].changed = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -991,7 +1006,10 @@ var rskbutton = func(btn, i) { } else { mcdu_message(i, "NOT ALLOWED"); } - } else { + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 4; + atsu.freeTexts[i].changed = 1; + } else { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "3") { @@ -1037,6 +1055,11 @@ var rskbutton = func(btn, i) { } else { mcdu_message(i, "NOT ALLOWED"); } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 5; + atsu.freeTexts[i].changed = 1; + } else if (page == "ATCMENU") { + pageNode[i].setValue("MCDUTEXT"); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -1247,6 +1270,9 @@ var rskbutton = func(btn, i) { } } else if (page == "NOTIFICATION") { pageNode[i].setValue("CONNECTSTATUS"); + } else if (page == "MCDUTEXT") { + # todo transfer to DCDU + pageNode[i].setValue("ATCMENU"); } else if (page == "ATSUDLINK") { pageNode[i].setValue("COMMMENU"); } else if (page == "CONNECTSTATUS") { @@ -1406,7 +1432,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 != "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") { + 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 != "MCDUTEXT" 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/Systems/Comm/CPDLC.nas b/Nasal/Systems/Comm/CPDLC.nas index fb680947..d145e758 100644 --- a/Nasal/Systems/Comm/CPDLC.nas +++ b/Nasal/Systems/Comm/CPDLC.nas @@ -3,11 +3,35 @@ # Copyright (c) 2020 Josh Davidson (Octal450) var CPDLCmessage = { - new: func(text) { + new: func(text, response = 0) { var cpdlcMessage = {parents: [CPDLCmessage] }; cpdlcMessage.text = text; + cpdlcMessage.response = response; return cpdlcMessage; }, }; -makeNewDictionaryItem(CPDLCmessage.new("CONNECT"), "CONNECT"); \ No newline at end of file +makeNewDictionaryItem(CPDLCmessage.new("CONNECT",0), "CONNECT"); + + +makeNewDictionaryItem(CPDLCmessage.new("WILCO",0), "WILCO"); +makeNewDictionaryItem(CPDLCmessage.new("UNABLE",0), "UNABLE"); +makeNewDictionaryItem(CPDLCmessage.new("STANDBY",0), "STANDBY"); +makeNewDictionaryItem(CPDLCmessage.new("ROGER",0), "ROGER"); +makeNewDictionaryItem(CPDLCmessage.new("AFFIRM",0), "AFFIRM"); +makeNewDictionaryItem(CPDLCmessage.new("NEGATIVE",0), "NEGATIVE"); + + +makeNewDictionaryItem(CPDLCmessage.new("REQUEST ALTITUDE",0), "REQUEST ALTITUDE"); + +var freeText = { + new: func(index) { + var freeTextObj = {parents: [freeText]}; + freeTextObj.index = index; + return freeTextObj; + }, + selection: 9, + changed: 0, +}; + +var freeTexts = [freeText.new(0), freeText.new(1)]; \ No newline at end of file From 879deba025a54d3a9e3fe0b1a7b4875ee6315aa1 Mon Sep 17 00:00:00 2001 From: vezza Date: Mon, 30 Nov 2020 00:08:21 +0100 Subject: [PATCH 13/38] Hydraulic and brake system improvements - loss of braking if no hydraulic pressure; - code restyling; --- Models/FlightDeck/a320.flightdeck.xml | 2 +- Nasal/Systems/hydraulics.nas | 42 +++++++++++++++------------ Systems/a320-fcs.xml | 12 ++++---- Systems/a320-hydraulic.xml | 32 ++++++++++++++++++-- 4 files changed, 62 insertions(+), 26 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 2d6e31c2..8e1cd12a 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -428,7 +428,7 @@ rotate brakes_accum_psi - systems/hydraulic/brakes/accumulator-pressure-psi + systems/hydraulic/yellow-accumulator-psi 00 700-20 diff --git a/Nasal/Systems/hydraulics.nas b/Nasal/Systems/hydraulics.nas index 5d40f9fc..cd9e5779 100644 --- a/Nasal/Systems/hydraulics.nas +++ b/Nasal/Systems/hydraulics.nas @@ -7,7 +7,7 @@ var rcont = 0; var HYD = { Brakes: { - accumPressPsi: props.globals.initNode("/systems/hydraulic/brakes/accumulator-pressure-psi", 0, "INT"), + accumPressPsi: props.globals.initNode("/systems/hydraulic/yellow-accumulator-psi-cmd", 0, "INT"), leftPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-left-psi", 0, "INT"), rightPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-right-psi", 0, "INT"), askidSw: props.globals.initNode("/systems/hydraulic/brakes/askidnwssw", 1, "BOOL"), @@ -91,9 +91,6 @@ var HYD = { } else { me.Brakes.askidSw.setBoolValue(0); #false } - if (me.Psi.yellow.getValue() > 0 and me.Brakes.accumPressPsi.getValue() < 3000 and me.Psi.yellow.getValue() > me.Brakes.accumPressPsi.getValue()) { - me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() + 50); - } # Decrease accumPressPsi when green and yellow hydraulic's aren't pressurized if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { @@ -106,13 +103,11 @@ var HYD = { } else { rcont = 0; } - if ((me.Psi.green.getValue() == 0) and (me.Psi.yellow.getValue() == 0) and (me.Brakes.accumPressPsi.getValue()) > 0) { + if (me.Psi.yellow.getValue() < me.Brakes.accumPressPsi.getValue() and me.Brakes.accumPressPsi.getValue() > 0) { if (lcont == 1) { - #me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - (35 * me.Brakes.leftbrake.getValue())); me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - 200); } if (rcont == 1) { - #me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - (35 * me.Brakes.leftbrake.getValue())); me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - 200); } if (me.Brakes.accumPressPsi.getValue() < 0) { @@ -124,52 +119,63 @@ var HYD = { if (me.Brakes.mode.getValue() == 1 or (me.Brakes.mode.getValue() == 2 and me.Psi.green.getValue() >= 2500)) { # Normal braking - Green OK if (me.Brakes.leftbrake.getValue() > 0) { - me.Brakes.leftPressPsi.setValue(props.globals.getValue("/systems/hydraulic/green-psi-ptu")); + me.Brakes.leftPressPsi.setValue(me.Psi.green.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); } else { me.Brakes.leftPressPsi.setValue(0); } if (me.Brakes.rightbrake.getValue() > 0) { - me.Brakes.rightPressPsi.setValue(props.globals.getValue("/systems/hydraulic/green-psi-ptu")); + me.Brakes.rightPressPsi.setValue(me.Psi.green.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); } else { me.Brakes.rightPressPsi.setValue(0); } } else { if ((me.Brakes.mode.getValue() == 2 and me.Psi.green.getValue() < 2500) or me.Brakes.mode.getValue() == 0) { # Alternate Braking (Yellow OK + Antiskid ON + electric OK) - missing condition: BSCU OK-KO - if (me.Psi.yellow.getValue() >= 2500 and me.Brakes.askidSw.getValue() and props.globals.getValue("/systems/electrical/serviceable")) { + if (me.Psi.yellow.getValue() >= 2500 and me.Brakes.askidSw.getValue() and (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcess.getValue() >= 24)) { if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.leftPressPsi.setValue(props.globals.getValue("/systems/hydraulic/yellow-psi-ptu")); + me.Brakes.leftPressPsi.setValue(me.Psi.yellow.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); } else { me.Brakes.leftPressPsi.setValue(0); } if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.rightPressPsi.setValue(props.globals.getValue("/systems/hydraulic/yellow-psi-ptu")); + me.Brakes.rightPressPsi.setValue(me.Psi.yellow.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); } else { me.Brakes.rightPressPsi.setValue(0); } } else { # Alternate Braking (Yellow OK + Antiskid OFF + electric OK) - missing condition: BSCU OK-KO - if (me.Psi.yellow.getValue() >= 2500 and !me.Brakes.askidSw.getValue() and props.globals.getValue("/systems/electrical/serviceable")) { + if (me.Psi.yellow.getValue() >= 2500 and !me.Brakes.askidSw.getValue() and (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcess.getValue() >= 24)) { if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.leftPressPsi.setValue(1000); + me.Brakes.leftPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); } else { me.Brakes.leftPressPsi.setValue(0); } if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.rightPressPsi.setValue(1000); + me.Brakes.rightPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); } else { me.Brakes.rightPressPsi.setValue(0); } } else { # Alternate Braking (Yellow KO or Antiskid KO or electric KO) - missing condition: BSCU OK-KO - if (me.Psi.yellow.getValue() < 2500 or !me.Brakes.askidSw.getValue() or !props.globals.getValue("/systems/electrical/serviceable")) { + if (me.Brakes.accumPressPsi.getValue() < 1000 and (me.Psi.yellow.getValue() < 2500 or !me.Brakes.askidSw.getValue() or (systems.ELEC.Bus.dc1.getValue() < 24 and systems.ELEC.Bus.dc2.getValue() < 24 and systems.ELEC.Bus.dcess.getValue() < 24))) { if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.leftPressPsi.setValue(me.Brakes.accumPressPsi.getValue()); + me.Brakes.leftPressPsi.setValue(me.Brakes.accumPressPsi.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); } else { me.Brakes.leftPressPsi.setValue(0); } if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.rightPressPsi.setValue(me.Brakes.accumPressPsi.getValue()); + me.Brakes.rightPressPsi.setValue(me.Brakes.accumPressPsi.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); + } else { + me.Brakes.rightPressPsi.setValue(0); + } + } else { + if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { + me.Brakes.leftPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); + } else { + me.Brakes.leftPressPsi.setValue(0); + } + if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { + me.Brakes.rightPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); } else { me.Brakes.rightPressPsi.setValue(0); } diff --git a/Systems/a320-fcs.xml b/Systems/a320-fcs.xml index 76bd273b..aedce979 100644 --- a/Systems/a320-fcs.xml +++ b/Systems/a320-fcs.xml @@ -1172,11 +1172,13 @@ - - + + + /systems/hydraulic/green-psi ge 2500 + /systems/hydraulic/yellow-psi ge 1000 + /systems/hydraulic/yellow-accumulator-psi gt 0 + + fcs/brake-avail diff --git a/Systems/a320-hydraulic.xml b/Systems/a320-hydraulic.xml index 89113580..097c3c47 100644 --- a/Systems/a320-hydraulic.xml +++ b/Systems/a320-hydraulic.xml @@ -386,7 +386,7 @@ - + /systems/hydraulic/yellow-psi-cmd /systems/hydraulic/sys-incr-rate @@ -397,6 +397,34 @@ /systems/hydraulic/yellow-psi 0.9 + + + + + + + /systems/hydraulic/yellow-psi + 0 + + + /systems/hydraulic/yellow-psi + /systems/hydraulic/yellow-accumulator-psi-cmd + + + + /systems/hydraulic/yellow-psi + /systems/hydraulic/yellow-accumulator-psi-cmd + + /systems/hydraulic/yellow-accumulator-psi-cmd + + + + + + /systems/hydraulic/yellow-accumulator-psi-cmd + /systems/hydraulic/sys-incr-rate + /systems/hydraulic/sys-decr-rate + @@ -510,7 +538,7 @@ /controls/gear/brake-parking ne 1 - /systems/hydraulic/brakes/accumulator-pressure-psi ge 0 + /systems/hydraulic/yellow-accumulator-psi-cmd ge 0 From 52b853ff0683121e6360215f242f79391dabe8f6 Mon Sep 17 00:00:00 2001 From: Wesley <69126784+C-FWES@users.noreply.github.com> Date: Sun, 29 Nov 2020 19:36:15 -0500 Subject: [PATCH 14/38] Correct typo in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38206505..53eeea83 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # A320-family A very advanced simulation of the Airbus A320 Family for FlightGear. -- Flight Dyanmics: Josh Davidson (Octal450) +- Flight Dynamics: Josh Davidson (Octal450) - Systems: Josh Davidson (Octal450), Jonathan Redpath (legoboyvdlp), merspieler, Matthew Maring (mattmaring) - Displays: Josh Davidson (Octal450), Jonathan Redpath (legoboyvdlp), merspieler, Matthew Maring (mattmaring) - 3D/Textures: Thorsten Herrmann (TH-555), Semir Gebran (CaptB) From 78f4f8ff6353273277741b4cad49cec23a1f460c Mon Sep 17 00:00:00 2001 From: Josh Davidson Date: Tue, 1 Dec 2020 11:25:31 -0500 Subject: [PATCH 15/38] Control: Fix the trim --- Nasal/Libraries/controls-override.nas | 6 +++--- Systems/a320-fcs.xml | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Nasal/Libraries/controls-override.nas b/Nasal/Libraries/controls-override.nas index 0d1ec0ed..89f2b05f 100644 --- a/Nasal/Libraries/controls-override.nas +++ b/Nasal/Libraries/controls-override.nas @@ -79,10 +79,10 @@ controls.flapsDown = func(step) { } controls.elevatorTrim = func(d) { - if (systems.HYD.Psi.green.getValue() >= 1500) { - slewProp("/controls/flight/elevator-trim", d * 0.0185); # Rate in JSB normalized (0.125 / 13.5) + if (systems.HYD.Psi.green.getValue() >= 1500 or systems.HYD.Psi.yellow.getValue() >= 1500) { + slewProp("/controls/flight/elevator-trim", d * 0.0185); # Rate in JSB normalized (0.25 / 13.5) } else { - slewProp("/controls/flight/elevator-trim", d * 0.0092) # Rate in JSB normalized (0.125 / 13.5) + slewProp("/controls/flight/elevator-trim", d * 0.0092) # Handcranking? } } diff --git a/Systems/a320-fcs.xml b/Systems/a320-fcs.xml index aedce979..07f04250 100644 --- a/Systems/a320-fcs.xml +++ b/Systems/a320-fcs.xml @@ -372,12 +372,13 @@ - + /systems/failures/fctl/ths-jam eq 1 /systems/hydraulic/yellow-psi ge 1500 /systems/hydraulic/green-psi ge 1500 + /systems/acconfig/autoconfig-running eq 1 From 2477187dc7a62277bd922e7d33ff4ebc092188dd Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 4 Dec 2020 18:34:52 +0000 Subject: [PATCH 16/38] Lower ECAM: display of gross weight now comes from FMGC. So it is dashed in phase 1, and also in future will be inaccurate if you enter bad ZFW --- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index cfc1cc34..cbfddbc6 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -510,12 +510,21 @@ var canvas_lowerECAM_base = { me["UTCh"].setText(sprintf("%02d", hour.getValue())); me["UTCm"].setText(sprintf("%02d", minute.getValue())); - me.gwStore = pts.Fdm.JSBsim.Inertia.weightLbs.getValue(); + if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and ecam.phaseNode.getValue() != 1) { + if (acconfig_weight_kgs.getValue()) { + me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); + } else { + me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000, 100))); + } + me["GW"].setColor(0.0509,0.7529,0.2941); + } else { + me["GW"].setText(sprintf("%s", "-----")); + me["GW"].setColor(0.0901,0.6039,0.7176); + } + if (acconfig_weight_kgs.getValue()) { - me["GW"].setText(sprintf("%s", math.round(math.round(me.gwStore * LBS2KGS, 100)))); me["GW-weight-unit"].setText("KG"); } else { - me["GW"].setText(sprintf("%s", math.round(me.gwStore, 100))); me["GW-weight-unit"].setText("LBS"); } }, From 97cf4f8c6024614e041bef27e8b2052b1088b10f Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 5 Dec 2020 12:32:12 +0000 Subject: [PATCH 17/38] A320-main.xml --- A320-main.xml | 219 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 205 insertions(+), 14 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index e71cfca1..a7b19a40 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -2513,18 +2513,18 @@ - /FMGC/keyboard-left - /FMGC/keyboard-right - - - sim/current-view/name - Walk View - - - sim/current-view/name - Walker Orbit View - - + /FMGC/keyboard-left + /FMGC/keyboard-right + + + sim/current-view/name + Walk View + + + sim/current-view/name + Walker Orbit View + + property-assign @@ -2659,6 +2659,65 @@ SHIFT-d Autopilot Disconnect + + property-assign + + + /FMGC/keyboard-left + /FMGC/keyboard-right + + + sim/current-view/name + Walk View + + + sim/current-view/name + Walker Orbit View + + + + + sim/walker/key-triggers/slide + 1 + + + property-assign + + /FMGC/keyboard-left + /FMGC/keyboard-right + + sim/walker/key-triggers/speed + sim/walker/speed-mps + + + property-multiply + + /FMGC/keyboard-left + /FMGC/keyboard-right + + sim/walker/key-triggers/speed + 2.5 + + + + property-assign + + /FMGC/keyboard-left + /FMGC/keyboard-right + + sim/walker/key-triggers/slide + 0 + + + property-assign + + /FMGC/keyboard-left + /FMGC/keyboard-right + + sim/walker/key-triggers/speed + sim/walker/speed-mps + + /FMGC/keyboard-left @@ -2675,8 +2734,22 @@ - /FMGC/keyboard-left - /FMGC/keyboard-right + + /FMGC/keyboard-left + /FMGC/keyboard-right + + + sim/current-view/name + Walk View + + + + + sim/current-view/name + Walker Orbit View + + + nasal - - - - property-assign - /controls/adirs/skip - 1 - - From fe8877c5c1f137b5abaad6c111615e6fabe7a33a Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 6 Dec 2020 14:59:58 +0000 Subject: [PATCH 19/38] Typo fix --- Nasal/Systems/hydraulics.nas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Nasal/Systems/hydraulics.nas b/Nasal/Systems/hydraulics.nas index cd9e5779..c3cb02c2 100644 --- a/Nasal/Systems/hydraulics.nas +++ b/Nasal/Systems/hydraulics.nas @@ -131,7 +131,7 @@ var HYD = { } else { if ((me.Brakes.mode.getValue() == 2 and me.Psi.green.getValue() < 2500) or me.Brakes.mode.getValue() == 0) { # Alternate Braking (Yellow OK + Antiskid ON + electric OK) - missing condition: BSCU OK-KO - if (me.Psi.yellow.getValue() >= 2500 and me.Brakes.askidSw.getValue() and (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcess.getValue() >= 24)) { + if (me.Psi.yellow.getValue() >= 2500 and me.Brakes.askidSw.getValue() and (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcEss.getValue() >= 24)) { if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { me.Brakes.leftPressPsi.setValue(me.Psi.yellow.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); } else { @@ -144,7 +144,7 @@ var HYD = { } } else { # Alternate Braking (Yellow OK + Antiskid OFF + electric OK) - missing condition: BSCU OK-KO - if (me.Psi.yellow.getValue() >= 2500 and !me.Brakes.askidSw.getValue() and (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcess.getValue() >= 24)) { + if (me.Psi.yellow.getValue() >= 2500 and !me.Brakes.askidSw.getValue() and (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcEss.getValue() >= 24)) { if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { me.Brakes.leftPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); } else { @@ -157,7 +157,7 @@ var HYD = { } } else { # Alternate Braking (Yellow KO or Antiskid KO or electric KO) - missing condition: BSCU OK-KO - if (me.Brakes.accumPressPsi.getValue() < 1000 and (me.Psi.yellow.getValue() < 2500 or !me.Brakes.askidSw.getValue() or (systems.ELEC.Bus.dc1.getValue() < 24 and systems.ELEC.Bus.dc2.getValue() < 24 and systems.ELEC.Bus.dcess.getValue() < 24))) { + if (me.Brakes.accumPressPsi.getValue() < 1000 and (me.Psi.yellow.getValue() < 2500 or !me.Brakes.askidSw.getValue() or (systems.ELEC.Bus.dc1.getValue() < 24 and systems.ELEC.Bus.dc2.getValue() < 24 and systems.ELEC.Bus.dcEss.getValue() < 24))) { if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { me.Brakes.leftPressPsi.setValue(me.Brakes.accumPressPsi.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); } else { From 830108dc8cb4af287b00367ffa911156841ec49a Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 6 Dec 2020 15:16:18 +0000 Subject: [PATCH 20/38] What was this --- Models/Instruments/IESI/IESI.nas | 2 -- 1 file changed, 2 deletions(-) diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index b0432cc8..4ad0a965 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -282,8 +282,6 @@ var showIESI = func { dlg.setCanvas(A320IESI.MainScreen.canvas); } -setlistener("", func() { if (A320IESI.MainScreen != nil) { A320IESI.MainScreen.updateQNH(notification); } }, 0, 0); - var roundabout = func(x) { var y = x - int(x); return y < 0.5 ? int(x) : 1 + int(x); From 72cebd9077a9995954ef306298301561e66bed76 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 9 Dec 2020 19:16:17 +0000 Subject: [PATCH 21/38] bugfix for simbrief parser --- Nasal/FMGC/SimbriefParser.nas | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 47b2b640..c563d9aa 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -59,9 +59,9 @@ var SimbriefParser = { } 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; + forindex (var test; result) { + if (math.abs(result[test].lat - coords.lat()) < 0.01666666666 and math.abs(result[test].lon - coords.lon()) < 0.01666666666) { + return result[test]; } } return nil; @@ -170,11 +170,13 @@ var SimbriefParser = { 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 = me.tryFindByCoord(coords,ident,"fix"); + #if (wp == nil) { + # wp = me.tryFindByCoord(coords,ident,"nav"); + #} + #if (wp == nil) { wp = createWP(coords, ident); - } + #} append(wps, wp); } From b4fee1995b94f3770619ff2bb6656c7ae3e9cbaf Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 20 Dec 2020 13:19:18 +0000 Subject: [PATCH 22/38] Bugfix chocks (with lack of hydraulic power) --- Systems/a320-fcs.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/Systems/a320-fcs.xml b/Systems/a320-fcs.xml index 07f04250..9efc0ea5 100644 --- a/Systems/a320-fcs.xml +++ b/Systems/a320-fcs.xml @@ -1175,6 +1175,7 @@ + /services/chocks/enable eq 1 /systems/hydraulic/green-psi ge 2500 /systems/hydraulic/yellow-psi ge 1000 /systems/hydraulic/yellow-accumulator-psi gt 0 From 2298a87e4b12e978337f7c7f8aa44cab0d8882c7 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 31 Dec 2020 20:03:47 +0000 Subject: [PATCH 23/38] Manual merge of work completed by inuyaksa: - long pressing CLR button (keyboard/MCDU panel) clears scratchpad - abort button for panel state dialog, when error occurs on state script, you can't close panel - fix MCDU starting page, arrow color and REQ state (https://youtu.be/twwUjHXdNVU?t=57) - PERFTO, validation on insert of V1/Vr/V2 values and type II error messages - PERFTO, basic validation of THRRED/ACC --- A320-main.xml | 21 ++++- AircraftConfig/acconfig.nas | 18 +++- AircraftConfig/psload.xml | 10 +++ Models/Instruments/MCDU/MCDU.nas | 143 ++++++++++++++++++------------ Models/Instruments/MCDU/MCDU1.xml | 20 ++++- Models/Instruments/MCDU/MCDU2.xml | 20 ++++- Nasal/FMGC/FMGC.nas | 3 + Nasal/FMGC/SimbriefParser.nas | 39 +++++++- Nasal/FMGC/mcdu-messages.nas | 7 ++ Nasal/MCDU/F-PLN.nas | 36 +++++--- Nasal/MCDU/INITA.nas | 40 ++++++++- Nasal/MCDU/PERFTO.nas | 38 +++++++- 12 files changed, 313 insertions(+), 82 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index af12a503..499d15b2 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -1918,20 +1918,37 @@ Del CLR + true /FMGC/keyboard-left nasal - + /FMGC/keyboard-right nasal - + + + + + /FMGC/keyboard-left + + nasal + + + + + /FMGC/keyboard-right + + nasal + + + Disable MCDU keyboard mode diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 9eca731c..72b5dfaf 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -196,10 +196,10 @@ var renderingSettings = { check: func() { var rembrandt = getprop("/sim/rendering/rembrandt/enabled"); var ALS = getprop("/sim/rendering/shaders/skydome"); - var customSettings = getprop("/sim/rendering/shaders/custom-settings") == 1; + var landmass = getprop("/sim/rendering/shaders/landmass") >= 4; var model = getprop("/sim/rendering/shaders/model") >= 2; - if (!rembrandt and (!ALS or !customSettings or !landmass or !model)) { + if (!rembrandt and (!ALS or !landmass or !model)) { rendering_dlg.open(); } }, @@ -255,6 +255,15 @@ var writeSettings = func { # Panel States # ################ +# Abort auto-config and close dialog +var abortPanelStates = func { + if (getprop("/systems/acconfig/autoconfig-running") == 1) { + setprop("/systems/acconfig/autoconfig-running", 0); + } + ps_load_dlg.close(); + spinning.stop(); +} + # Cold and Dark var colddark = func { if (getprop("/systems/acconfig/mismatch-code") == "0x000") { @@ -301,6 +310,7 @@ var colddark = func { } } var colddark_b = func { + if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted # Continues the Cold and Dark script, after engines fully shutdown. setprop("/controls/apu/master", 0); settimer(func { @@ -351,6 +361,7 @@ var beforestart = func { } } var beforestart_b = func { + if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted # Continue with engine start prep. systems.FUEL.Switches.pumpLeft1.setValue(1); systems.FUEL.Switches.pumpLeft2.setValue(1); @@ -438,6 +449,7 @@ var taxi = func { } } var taxi_b = func { + if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted # Continue with engine start prep, and start engines. systems.FUEL.Switches.pumpLeft1.setValue(1); systems.FUEL.Switches.pumpLeft2.setValue(1); @@ -491,6 +503,7 @@ var taxi_b = func { settimer(taxi_c, 2); } var taxi_c = func { + if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted setprop("/controls/engines/engine-start-switch", 2); setprop("/controls/engines/engine[0]/cutoff-switch", 0); setprop("/controls/engines/engine[1]/cutoff-switch", 0); @@ -499,6 +512,7 @@ var taxi_c = func { }, 10); } var taxi_d = func { + if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted # After Start items. setprop("/controls/engines/engine-start-switch", 1); setprop("/controls/apu/master", 0); diff --git a/AircraftConfig/psload.xml b/AircraftConfig/psload.xml index 8245b84e..fd7f9e19 100644 --- a/AircraftConfig/psload.xml +++ b/AircraftConfig/psload.xml @@ -37,6 +37,16 @@ /systems/acconfig/spin 1 + diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index e44fcf4a..b90bd043 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -155,6 +155,8 @@ var pageProp = [props.globals.getNode("/MCDU[0]/page", 1), props.globals.getNode var active = [props.globals.getNode("/MCDU[0]/active", 1), props.globals.getNode("/MCDU[1]/active", 1)]; var activeAtsu = [props.globals.getNode("/MCDU[0]/atsu-active", 1), props.globals.getNode("/MCDU[1]/atsu-active", 1)]; +var reqFMGC = [0,0]; # flag = 1 when REQ is show + # Conversion factor pounds to kilogram var LBS2KGS = 0.4535924; @@ -198,23 +200,23 @@ var canvas_MCDU_base = { me["PERFTO_FE"].setFont(symbol); me["PERFTO_SE"].setFont(symbol); me["PERFTO_OE"].setFont(symbol); - me["PERFTO_FE"].setColor(0.8078,0.8039,0.8078); - me["PERFTO_SE"].setColor(0.8078,0.8039,0.8078); - me["PERFTO_OE"].setColor(0.8078,0.8039,0.8078); + me["PERFTO_FE"].setColor(BLUE); + me["PERFTO_SE"].setColor(BLUE); + me["PERFTO_OE"].setColor(BLUE); me["PERFAPPR_FE"].setFont(symbol); me["PERFAPPR_SE"].setFont(symbol); me["PERFAPPR_OE"].setFont(symbol); - me["PERFAPPR_FE"].setColor(0.8078,0.8039,0.8078); - me["PERFAPPR_SE"].setColor(0.8078,0.8039,0.8078); - me["PERFAPPR_OE"].setColor(0.8078,0.8039,0.8078); + me["PERFAPPR_FE"].setColor(BLUE); + me["PERFAPPR_SE"].setColor(BLUE); + me["PERFAPPR_OE"].setColor(BLUE); me["PERFGA_FE"].setFont(symbol); me["PERFGA_SE"].setFont(symbol); me["PERFGA_OE"].setFont(symbol); - me["PERFGA_FE"].setColor(0.8078,0.8039,0.8078); - me["PERFGA_SE"].setColor(0.8078,0.8039,0.8078); - me["PERFGA_OE"].setColor(0.8078,0.8039,0.8078); + me["PERFGA_FE"].setColor(BLUE); + me["PERFGA_SE"].setColor(BLUE); + me["PERFGA_OE"].setColor(BLUE); me.page = canvas_group; @@ -280,7 +282,7 @@ var canvas_MCDU_base = { me["PERFTO"].hide(); }, defaultPageNumbers: func() { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].hide(); @@ -497,29 +499,42 @@ var canvas_MCDU_base = { me.standardFontColour(); me["Simple_L3"].setText(" AIDS"); me["Simple_L4"].setText(" CFDS"); + pageSwitch[i].setBoolValue(1); } - if (active[i].getValue() == 0) { + if (active[i].getValue() == 0 and reqFMGC[i] == 0) { me["Simple_L1"].setText(" FMGC"); - me["Simple_L1"].setColor(1,1,1); + me["Simple_L1"].setColor(GREEN); + me["Simple_L1_Arrow"].setColor(GREEN); + reqFMGC[i] = 1; + settimer(func { + if (active[i].getValue() == 0) { + me["Simple_L1"].setText(" FMGC (REQ)"); + } + },1.4); #delay estimated } else if (active[i].getValue() == 1) { - me["Simple_L1"].setText(" FMGC(SEL)"); - me["Simple_L1"].setColor(0.0901,0.6039,0.7176); + me["Simple_L1"].setText(" FMGC (SEL)"); + me["Simple_L1"].setColor(BLUE); + me["Simple_L1_Arrow"].setColor(BLUE); } else if (active[i].getValue() == 2) { me["Simple_L1"].setText(" FMGC"); - me["Simple_L1"].setColor(0.0509,0.7529,0.2941); + me["Simple_L1"].setColor(GREEN); + me["Simple_L1_Arrow"].setColor(GREEN); } if (activeAtsu[i].getValue() == 0) { me["Simple_L2"].setText(" ATSU"); - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); + me["Simple_L2_Arrow"].setColor(WHITE); } else if (activeAtsu[i].getValue() == 1) { - me["Simple_L2"].setText(" ATSU(SEL)"); - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setText(" ATSU (SEL)"); + me["Simple_L2"].setColor(BLUE); + me["Simple_L2_Arrow"].setColor(BLUE); } else if (activeAtsu[i].getValue() == 2) { me["Simple_L2"].setText(" ATSU"); - me["Simple_L2"].setColor(0.0509,0.7529,0.2941); + me["Simple_L2"].setColor(GREEN); + me["Simple_L2_Arrow"].setColor(GREEN); } } else if (page == "ATSUDLINK") { if (!pageSwitch[i].getBoolValue()) { @@ -912,7 +927,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("ATC MENU"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("1/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -958,7 +973,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); me["Simple_Title"].setText("TEXT"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("1/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -1049,7 +1064,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); me["Simple_Title"].setText("ATC MENU"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("2/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -1146,7 +1161,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); me["Simple_Title"].setText("ATS623 ATIS MENU"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].hide(); me["ArrowLeft"].hide(); me["ArrowRight"].hide(); @@ -1907,7 +1922,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("DATA INDEX"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("1/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -1947,7 +1962,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("DATA INDEX"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("2/2"); me["Simple_PageNum"].show(); me["ArrowLeft"].show(); @@ -2228,7 +2243,7 @@ var canvas_MCDU_base = { me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("INIT"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].show(); @@ -2272,12 +2287,12 @@ var canvas_MCDU_base = { if (!fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.costIndexSet) { me["INITA_CostIndex"].hide(); - me["Simple_L5"].setColor(1,1,1); + me["Simple_L5"].setColor(WHITE); me["Simple_L5"].show(); me["Simple_L5"].setText("---"); } else if (fmgc.FMGCInternal.costIndexSet) { me["INITA_CostIndex"].hide(); - me["Simple_L5"].setColor(0.0901,0.6039,0.7176); + me["Simple_L5"].setColor(BLUE); me["Simple_L5"].show(); me["Simple_L5"].setText(sprintf("%s", fmgc.FMGCInternal.costIndex)); } else { @@ -2286,28 +2301,40 @@ var canvas_MCDU_base = { } if (!fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.crzSet) { me["INITA_CruiseFLTemp"].hide(); - me["Simple_L6"].setColor(1,1,1); + me["Simple_L6"].setColor(WHITE); me["Simple_L6"].setText("-----/---g"); } else if (fmgc.FMGCInternal.crzSet and fmgc.FMGCInternal.crzTempSet) { me["INITA_CruiseFLTemp"].hide(); - me["Simple_L6"].setColor(0.0901,0.6039,0.7176); + me["Simple_L6"].setColor(BLUE); me["Simple_L6"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzFl) ~ sprintf("/%sg", fmgc.FMGCInternal.crzTemp)); } else if (fmgc.FMGCInternal.crzSet) { me["INITA_CruiseFLTemp"].hide(); - me["Simple_L6"].setColor(0.0901,0.6039,0.7176); + me["Simple_L6"].setColor(BLUE); fmgc.FMGCInternal.crzTemp = 15 - (2 * fmgc.FMGCInternal.crzFl / 10); fmgc.FMGCInternal.crzTempSet = 1; me["Simple_L6"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzFl) ~ sprintf("/%sg", fmgc.FMGCInternal.crzTemp)); } else { me["INITA_CruiseFLTemp"].show(); - me["Simple_L6"].setColor(0.7333,0.3803,0); + me["Simple_L6"].setColor(AMBER); me["Simple_L6"].setText(" g"); } + + if (fmgc.FMGCInternal.coRouteSet) { # show coRoute when valid + me["INITA_CoRoute"].hide(); + me["Simple_L1"].setText(fmgc.FMGCInternal.coRoute); + me["Simple_L1"].setColor(BLUE); + me["Simple_L1"].show(); + } else { + me["Simple_L1"].hide(); + me["INITA_CoRoute"].show(); + me["Simple_L1"].setText("NONE"); + } + if (fmgc.FMGCInternal.toFromSet) { me["INITA_CoRoute"].hide(); me["INITA_FromTo"].hide(); me["Simple_L1"].show(); - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setColor(BLUE); if (fmgc.FMGCInternal.altAirportSet) { me["Simple_L2"].setText(fmgc.FMGCInternal.altAirport); } else { @@ -2320,7 +2347,7 @@ var canvas_MCDU_base = { me["INITA_CoRoute"].show(); me["INITA_FromTo"].show(); me["Simple_L1"].hide(); - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); me["Simple_L2"].setText("----/----------"); me.showRight(-1, 1, 0, 0, 0, 0); me["Simple_R2S"].show(); @@ -2364,7 +2391,7 @@ var canvas_MCDU_base = { me["Simple_L3S"].setText("FLT NBR"); me["Simple_L5S"].setText("COST INDEX"); me["Simple_L6S"].setText("CRZ FL/TEMP"); - me["Simple_L1"].setText("NONE"); + #me["Simple_L1"].setText("NONE"); # manage before (coRoute) me["Simple_L3"].setText(sprintf("%s", fmgc.FMGCInternal.flightNum)); me["Simple_R1S"].setText("FROM/TO "); me["Simple_R2S"].setText("INIT "); @@ -2666,7 +2693,7 @@ var canvas_MCDU_base = { me["Simple_R5"].setText(fmgc.FMGCInternal.tripWind); me["Simple_R6S"].setText("EXTRA/TIME"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); if (!fmgc.FMGCInternal.fuelRequest) { me["Simple_L2"].setText("---.-/----"); @@ -2706,7 +2733,7 @@ var canvas_MCDU_base = { me["Simple_R6"].setText("---.-/----"); me["Simple_Title"].setText("INIT"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me.colorLeft("ack", "wht", "wht", "wht", "wht", "wht"); me.colorRight("ack", "blu", "amb", "wht", "ack", "wht"); @@ -3059,7 +3086,7 @@ var canvas_MCDU_base = { me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("FUEL PRED"); - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].show(); @@ -3387,7 +3414,7 @@ var canvas_MCDU_base = { } me["Simple_Title"].show(); - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].hide(); @@ -3570,9 +3597,9 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 1) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); } if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) { @@ -3701,7 +3728,7 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 2) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); me.showLeft(0, 0, 0, 0, 1, 0); me.showLeftS(0, 0, 0, 0, 1, 0); me.showLeftArrow(0, 0, 0, 0, 1, 1); @@ -3742,7 +3769,7 @@ var canvas_MCDU_base = { setprop("/FMGC/internal/activate-twice", 0); } } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me.showLeft(0, 0, 0, 0, -1, 0); me.showLeftS(0, 0, 0, 0, -1, 0); me.showLeftArrow(0, 0, 0, 0, -1, 0); @@ -3776,10 +3803,10 @@ var canvas_MCDU_base = { me["Simple_L2S"].setText(" CI"); if (fmgc.FMGCInternal.costIndexSet) { - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setColor(BLUE); me["Simple_L2"].setText(sprintf(" %s", fmgc.FMGCInternal.costIndex)); } else { - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); me["Simple_L2"].setText(" ---"); } @@ -3854,7 +3881,7 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 3) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); if (managedSpeed.getValue() == 1) { me.showLeft(0, 0, 0, -1, 0, 0); @@ -3889,7 +3916,7 @@ var canvas_MCDU_base = { setprop("/FMGC/internal/activate-twice", 0); } } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me.colorLeft("ack", "ack", "ack", "ack", "ack", "wht"); me.colorLeftS("ack", "ack", "ack", "ack", "ack", "wht"); @@ -3916,10 +3943,10 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.costIndexSet) { - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setColor(BLUE); me["Simple_L2"].setText(sprintf(" %s", fmgc.FMGCInternal.costIndex)); } else { - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); me["Simple_L2"].setText(" ---"); } @@ -3992,7 +4019,7 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 4) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); me.showLeft(0, 0, 0, 0, 1, 0); me.showRight(0, 1, 0, 1, 0, 0); me.showRightS(0, 0, 1, 0, 0, 0); @@ -4032,7 +4059,7 @@ var canvas_MCDU_base = { setprop("/FMGC/internal/activate-twice", 0); } } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); me.showLeft(0, 0, 0, 0, -1, 0); me.showRight(0, -1, 0, -1, 0, 0); me.showRightS(0, 0, -1, 0, 0, 0); @@ -4064,10 +4091,10 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.costIndexSet) { - me["Simple_L2"].setColor(0.0901,0.6039,0.7176); + me["Simple_L2"].setColor(BLUE); me["Simple_L2"].setText(sprintf(" %2.0f", fmgc.FMGCInternal.costIndex)); } else { - me["Simple_L2"].setColor(1,1,1); + me["Simple_L2"].setColor(WHITE); me["Simple_L2"].setText(" ---"); } @@ -4148,9 +4175,9 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 5) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); } me["Simple_L0S"].setText("DEST"); @@ -4331,9 +4358,9 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 6) { - me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me["Simple_Title"].setColor(GREEN); } else { - me["Simple_Title"].setColor(1, 1, 1); + me["Simple_Title"].setColor(WHITE); } if (thrAccSet.getValue() == 1) { @@ -5967,6 +5994,8 @@ setlistener("sim/signals/fdm-initialized", func { mcdu.mcdu_message(0, "SELECT DESIRED SYSTEM"); mcdu.mcdu_message(1, "SELECT DESIRED SYSTEM"); + + reqFMGC = [0,0]; # reset FMGC REQ status - on MCDU restart MCDU_update.start(); }); diff --git a/Models/Instruments/MCDU/MCDU1.xml b/Models/Instruments/MCDU/MCDU1.xml index 51439c6d..1b7c9182 100644 --- a/Models/Instruments/MCDU/MCDU1.xml +++ b/Models/Instruments/MCDU/MCDU1.xml @@ -1705,7 +1705,7 @@ true nasal - + @@ -1719,6 +1719,24 @@ + + + nasal + + + + + systems/electrical/bus/ac-1 + 110 + + + controls/lighting/DU/mcdu1 + 0.01 + + + + + diff --git a/Models/Instruments/MCDU/MCDU2.xml b/Models/Instruments/MCDU/MCDU2.xml index 38324cf0..78516b3e 100644 --- a/Models/Instruments/MCDU/MCDU2.xml +++ b/Models/Instruments/MCDU/MCDU2.xml @@ -1705,7 +1705,7 @@ true nasal - + @@ -1719,6 +1719,24 @@ + + + nasal + + + + + systems/electrical/bus/ac-2 + 110 + + + controls/lighting/DU/mcdu2 + 0.01 + + + + + diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 56bc2ecd..1ca929bb 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -169,6 +169,8 @@ var FMGCInternal = { altAirportSet: 0, altSelected: 0, arrApt: "", + coRoute: "", + coRouteSet: 0, costIndex: 0, costIndexSet: 0, crzFt: 10000, @@ -309,6 +311,7 @@ var updateArptLatLon = func { updateRouteManagerAlt = func() { setprop("autopilot/route-manager/cruise/altitude-ft", FMGCInternal.crzFt); + # TODO - update FMGCInternal.phase when DES to re-enter in CLIMB/CRUIZE }; ######## diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index c563d9aa..1c2a0d07 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -1,5 +1,6 @@ # A3XX Simbrief Parser # Copyright (c) 2020 Jonathan Redpath (legoboyvdlp) +# enhanceded 12/2020 - parse TOD & TOC psedo waypoints, set computer speeds on fix wps, fake coRoute name var LBS2KGS = 0.4535924; @@ -157,12 +158,16 @@ var SimbriefParser = { if (ident == "TOC") { _foundTOC = 1; - continue; + #setprop("/autopilot/route-manager/vnav/tc/latitude-deg",ofpFix.getNode("pos_lat").getValue()); + #setprop("/autopilot/route-manager/vnav/tc/longitude-deg",ofpFix.getNode("pos_long").getValue()); + #ident = "(T/C)"; } if (ident == "TOD") { _foundTOD = 1; - continue; + #setprop("/autopilot/route-manager/vnav/td/latitude-deg",ofpFix.getNode("pos_lat").getValue()); + #setprop("/autopilot/route-manager/vnav/td/longitude-deg",ofpFix.getNode("pos_long").getValue()); + #ident = "(T/D)"; } coords = geo.Coord.new(); @@ -189,6 +194,34 @@ var SimbriefParser = { fmgc.flightPlanController.flightplans[3].star = _star; } fmgc.flightPlanController.destroyTemporaryFlightPlan(3, 1); + + #var idx = 1; + #var plan = fmgc.flightPlanController.flightplans[2]; + #var altitude = ""; + #var speed = ""; + #var wpname = ""; + + #foreach (var ofpFix; ofpFixes) { + # ident = ofpFix.getNode("ident").getValue(); + + # if (ident == "TOC") wpname = "(T/C)"; + # else if (ident == "TOD") wpname = "(T/D)"; + # else wpname = ident; + + # wp = plan.getWP(idx); # get leg + # if (wp != nil) { + # if (wp.wp_name == wpname) { + # altitude = ofpFix.getNode("altitude_feet").getValue(); + # speed = ofpFix.getNode("ind_airspeed").getValue(); + + # if (speed>0) wp.setSpeed(speed, "computed"); + # if (altitude>0) wp.setAltitude(math.round(altitude, 10), "computed"); +# +# idx = idx + 1; +# } +# } +# } + fmgc.windController.updatePlans(); fmgc.updateRouteManagerAlt(); @@ -199,6 +232,8 @@ var SimbriefParser = { if (me.buildFlightplan() == nil) { return nil; } + fmgc.FMGCInternal.coRoute = "SB" ~ me.OFP.getNode("origin/iata_code").getValue() ~ me.OFP.getNode("destination/iata_code").getValue() ~ "00"; + fmgc.FMGCInternal.coRouteSet = 1; 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.OFP.getNode("general/costindex").getValue(); diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index 8ac87b43..f741725c 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -69,6 +69,7 @@ var scratchpadController = { sp.scratchpadColour = "wht"; sp.showTypeIMsg = 0; sp.showTypeIIMsg = 0; + sp.clrmode = 0; # 1 = CLR mode sp.mcdu = mcdu; return sp; }, @@ -88,6 +89,11 @@ var scratchpadController = { me.clearTypeI(); } + if (me.clrmode == 1) { # prevent add chars in CLR mode + me.clear(); + } + else if (character == "CLR") me.clrmode = 1; + me.scratchpad = me.scratchpad ~ character; me.scratchpadColour = "wht"; me.update(); @@ -140,6 +146,7 @@ var scratchpadController = { }, empty: func() { me.scratchpad = ""; + me.clrmode = 0; me.update(); }, clear: func() { diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index f086d6fd..f3cab9a5 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -68,9 +68,21 @@ var fplnItem = { me.spd = me.getSpd(); me.alt = me.getAlt(); me.dist = me.getDist(); - me._colour = "wht"; - if (me.spd[1] != "wht" or me.alt[1] != "wht") { - me._colour = "mag"; + if (me.colour != "yel") { # not temporary flightplan + me._colour = "wht"; + #if (me.spd[1] != "wht" or me.alt[1] != "wht") { + if (me.spd[1] == me.alt[1]) { + me._colour = me.spd[1]; + } + else if (me.spd[1] == "mag" or me.alt[1] == "mag") { + me._colour = "mag"; + } + else if (me.spd[1] == "grn" or me.alt[1] == "grn") { + me._colour = "grn"; + } + + } else { # temporary flightplan + me._colour = "yel"; } return [me.spd[0] ~ "/" ~ me.alt[0], " " ~ me.dist ~ "NM ", me._colour]; } else { @@ -95,23 +107,25 @@ var fplnItem = { }, getSpd: func() { if (me.index == 0 and left(me.wp.wp_name, 4) == fmgc.FMGCInternal.depApt and fmgc.FMGCInternal.v1set) { - return [sprintf("%3.0f", math.round(fmgc.FMGCInternal.v1)), "mag"]; - } elsif (me.wp.speed_cstr != nil and me.wp.speed_cstr != 0) { - return [sprintf("%3.0f", me.wp.speed_cstr), "mag"]; + return [sprintf("%3.0f", math.round(fmgc.FMGCInternal.v1)), "grn"]; # why "mag"? I think "grn" + } elsif (me.wp.speed_cstr != nil and me.wp.speed_cstr > 0) { + var tcol = (me.wp.speed_cstr_type == "computed" or me.wp.speed_cstr_type == "computed_mach") ? "grn" : "mag"; # TODO - check if only computed + return [sprintf("%3.0f", me.wp.speed_cstr), tcol]; } else { return ["---", "wht"]; } }, getAlt: func() { if (me.index == 0 and left(me.wp.wp_name, 4) == fmgc.FMGCInternal.depApt and fmgc.flightPlanController.flightplans[me.plan].departure != nil) { - return [" " ~ sprintf("%-5.0f", math.round(fmgc.flightPlanController.flightplans[me.plan].departure.elevation * M2FT)), "mag"]; + return [" " ~ sprintf("%5.0f", math.round(fmgc.flightPlanController.flightplans[me.plan].departure.elevation * M2FT)), "grn"]; #fixed - aligned to right } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1) and fmgc.flightPlanController.fromWptAlt != nil) { return [" " ~ fmgc.flightPlanController.fromWptAlt, "mag"]; - } elsif (me.wp.alt_cstr != nil and me.wp.alt_cstr != 0) { + } elsif (me.wp.alt_cstr != nil and me.wp.alt_cstr > 0) { + var tcol = (me.wp.alt_cstr_type == "computed" or me.wp.alt_cstr_type == "computed_mach") ? "grn" : "mag"; # TODO - check if only computed if (me.wp.alt_cstr > fmgc.FMGCInternal.transAlt) { - return [" " ~ sprintf("%-5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)), "mag"]; + return [" " ~ sprintf("%5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)), tcol]; #fixed - aligned to right } else { - return [" " ~ sprintf("%-5.0f", me.wp.alt_cstr), "mag"]; + return [" " ~ sprintf("%5.0f", me.wp.alt_cstr), tcol]; #fixed - aligned to right } } else { return ["------", "wht"]; @@ -337,7 +351,7 @@ var fplnPage = { # this one is only created once, and then updated - remember th if (size(me.outputList) >= 1) { me.L1 = me.outputList[0].updateLeftText(); me.C1 = me.outputList[0].updateCenterText(); - me.C1[1] = "TIME "; + me.C1[1] = (fmgc.flightPlanController.fromWptTime != nil) ? "UTC " : "TIME "; # since TO change to UTC time (1 space left to center) me.R1 = me.outputList[0].updateRightText(); me.R1[1] = "SPD/ALT "; } else { diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index e734af23..00e02637 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -5,7 +5,40 @@ var initInputA = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (key == "L2") { + if (key == "L1") { #clear coRoute if set + if (scratchpad == "CLR") { + if (fmgc.FMGCInternal.coRouteSet == 1) { + fmgc.FMGCInternal.coRouteSet = 0; + fmgc.FMGCInternal.coRoute = ""; + fmgc.FMGCInternal.depApt = ""; + fmgc.FMGCInternal.arrApt = ""; + fmgc.FMGCInternal.toFromSet = 0; + fmgc.FMGCNodes.toFromSet.setValue(0); + fmgc.windController.resetDesWinds(); + setprop("/FMGC/internal/align-ref-lat", 0); + setprop("/FMGC/internal/align-ref-long", 0); + setprop("/FMGC/internal/align-ref-lat-edit", 0); + setprop("/FMGC/internal/align-ref-long-edit", 0); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.fuelCalculating.setValue(0); + fmgc.FMGCInternal.fuelCalculating = 1; + fmgc.fuelCalculating.setValue(1); + } + fmgc.flightPlanController.reset(2); + fmgc.flightPlanController.init(); + Simbrief.SimbriefParser.inhibit = 0; + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + var len = size(scratchpad); + if (fmgc.FMGCInternal.coRouteSet == 1 or len != 10) { + mcdu_message(i, "NOT ALLOWED"); + } else { + mcdu_message(i, "NOT IN DATA BASE"); # fake message - TODO flightplan loader + } + } + } else if (key == "L2") { if (scratchpad == "CLR") { fmgc.FMGCInternal.altAirport = ""; fmgc.FMGCInternal.altAirportSet = 0; @@ -183,7 +216,10 @@ var initInputA = func(key, i) { } } } else if (key == "R1") { - if (scratchpad == "CLR") { + if (fmgc.FMGCInternal.coRouteSet == 1) { + mcdu_message(i, "NOT ALLOWED"); + } + else if (scratchpad == "CLR") { fmgc.FMGCInternal.depApt = ""; fmgc.FMGCInternal.arrApt = ""; fmgc.FMGCInternal.toFromSet = 0; diff --git a/Nasal/MCDU/PERFTO.nas b/Nasal/MCDU/PERFTO.nas index fc0d92dc..d4cdcd29 100644 --- a/Nasal/MCDU/PERFTO.nas +++ b/Nasal/MCDU/PERFTO.nas @@ -3,6 +3,22 @@ # Copyright (c) 2020 Josh Davidson (Octal450) # Copyright (c) 2020 Matthew Maring (mattmaring) +# VMCA 109.5 at 0ft +# VMCG 106.5 at 0ft all conf + +var standard_VMCA = 109.5; # TODO calculate VMCA/VMCG on altitude (ft) of departure airport (read below) +var standard_VMCG = 106.5; + +# TODO - DepArp elevation or current elevation (on ground only!!) -> math.round(fmgc.flightPlanController.flightplans[2].departure.elevation * M2FT)) + +var perfTOCheckVSpeeds = func(i) { + if (fmgc.FMGCInternal.v1set == 1 and fmgc.FMGCInternal.vrset == 1 and fmgc.FMGCInternal.v2set == 1) { # only when v1/vr/v2 all sets + if (fmgc.FMGCInternal.v1>fmgc.FMGCInternal.vr or fmgc.FMGCInternal.vr > fmgc.FMGCInternal.v2) mcdu_messageTypeII(i,"V1/VR/V2 DISAGREE"); + else if (fmgc.FMGCInternal.v1= 3 and thrreds <= 5) and thrred >= 400 and thrred <= 39000 and int(acc) != nil and (accs == 3 or accs == 4 or accs == 5) and acc >= 400 and acc <= 39000) { - setprop("/systems/thrust/clbreduc-ft", int(thrred / 10) * 10); - setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); - setprop("MCDUC/thracc-set", 1); - mcdu_scratchpad.scratchpads[i].empty(); + + if (thrred<=acc) { # validation + setprop("/systems/thrust/clbreduc-ft", int(thrred / 10) * 10); + setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); + setprop("MCDUC/thracc-set", 1); + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else if (thrreds == 0 and int(acc) != nil and (accs >= 3 and accs <= 5) and acc >= 400 and acc <= 39000) { setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10); mcdu_scratchpad.scratchpads[i].empty(); From 6a5ce3bf7d1e980a5fba55643fd5020d4f1592c6 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 31 Dec 2020 20:12:40 +0000 Subject: [PATCH 24/38] Improve abort button: move to a better location; always set cold + dark --- AircraftConfig/acconfig.nas | 21 ++++++++++++++++----- AircraftConfig/psload.xml | 22 +++++++++++----------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 72b5dfaf..c4c12d7a 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -310,7 +310,6 @@ var colddark = func { } } var colddark_b = func { - if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted # Continues the Cold and Dark script, after engines fully shutdown. setprop("/controls/apu/master", 0); settimer(func { @@ -361,7 +360,10 @@ var beforestart = func { } } var beforestart_b = func { - if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted + if (getprop("/systems/acconfig/autoconfig-running") == 0) { + colddark(); + return 0; # auto-config aborted + } # Continue with engine start prep. systems.FUEL.Switches.pumpLeft1.setValue(1); systems.FUEL.Switches.pumpLeft2.setValue(1); @@ -449,7 +451,10 @@ var taxi = func { } } var taxi_b = func { - if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted + if (getprop("/systems/acconfig/autoconfig-running") == 0) { + colddark(); + return 0; # auto-config aborted + } # Continue with engine start prep, and start engines. systems.FUEL.Switches.pumpLeft1.setValue(1); systems.FUEL.Switches.pumpLeft2.setValue(1); @@ -503,7 +508,10 @@ var taxi_b = func { settimer(taxi_c, 2); } var taxi_c = func { - if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted + if (getprop("/systems/acconfig/autoconfig-running") == 0) { + colddark(); + return 0; # auto-config aborted + } setprop("/controls/engines/engine-start-switch", 2); setprop("/controls/engines/engine[0]/cutoff-switch", 0); setprop("/controls/engines/engine[1]/cutoff-switch", 0); @@ -512,7 +520,10 @@ var taxi_c = func { }, 10); } var taxi_d = func { - if (getprop("/systems/acconfig/autoconfig-running") == 0) return 0; # auto-config aborted + if (getprop("/systems/acconfig/autoconfig-running") == 0) { + colddark(); + return 0; # auto-config aborted + } # After Start items. setprop("/controls/engines/engine-start-switch", 1); setprop("/controls/apu/master", 0); diff --git a/AircraftConfig/psload.xml b/AircraftConfig/psload.xml index fd7f9e19..64cb9823 100644 --- a/AircraftConfig/psload.xml +++ b/AircraftConfig/psload.xml @@ -15,6 +15,16 @@ left + @@ -36,17 +46,7 @@ center /systems/acconfig/spin 1 - - + From 0161ebf9406b1649145cc8b5abfa7b94114b95bd Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 31 Dec 2020 20:29:04 +0000 Subject: [PATCH 25/38] As the Simbrief element is representing the AOC rather than CO RTE, its not correct to set a CO RTE. But I'll leave the code there for future CO RTE support. --- Nasal/FMGC/SimbriefParser.nas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 1c2a0d07..1dc01602 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -232,8 +232,8 @@ var SimbriefParser = { if (me.buildFlightplan() == nil) { return nil; } - fmgc.FMGCInternal.coRoute = "SB" ~ me.OFP.getNode("origin/iata_code").getValue() ~ me.OFP.getNode("destination/iata_code").getValue() ~ "00"; - fmgc.FMGCInternal.coRouteSet = 1; + #fmgc.FMGCInternal.coRoute = "SB" ~ me.OFP.getNode("origin/iata_code").getValue() ~ me.OFP.getNode("destination/iata_code").getValue() ~ "00"; + #fmgc.FMGCInternal.coRouteSet = 1; 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.OFP.getNode("general/costindex").getValue(); From 79b8a8fc749a1455a3635482d261b509428fba1b Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 31 Dec 2020 20:44:26 +0000 Subject: [PATCH 26/38] Restore missing file. Correct per pilot reference -- the Thales behaves slightly differently --- Models/Instruments/MCDU/MCDU.nas | 16 +++------------ Nasal/MCDU/MCDU.nas | 35 ++++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index b90bd043..c9949948 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -155,8 +155,6 @@ var pageProp = [props.globals.getNode("/MCDU[0]/page", 1), props.globals.getNode var active = [props.globals.getNode("/MCDU[0]/active", 1), props.globals.getNode("/MCDU[1]/active", 1)]; var activeAtsu = [props.globals.getNode("/MCDU[0]/atsu-active", 1), props.globals.getNode("/MCDU[1]/atsu-active", 1)]; -var reqFMGC = [0,0]; # flag = 1 when REQ is show - # Conversion factor pounds to kilogram var LBS2KGS = 0.4535924; @@ -503,16 +501,10 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (active[i].getValue() == 0 and reqFMGC[i] == 0) { + if (active[i].getValue() == 0) { me["Simple_L1"].setText(" FMGC"); - me["Simple_L1"].setColor(GREEN); - me["Simple_L1_Arrow"].setColor(GREEN); - reqFMGC[i] = 1; - settimer(func { - if (active[i].getValue() == 0) { - me["Simple_L1"].setText(" FMGC (REQ)"); - } - },1.4); #delay estimated + me["Simple_L1"].setColor(WHITE); + me["Simple_L1_Arrow"].setColor(WHITE); } else if (active[i].getValue() == 1) { me["Simple_L1"].setText(" FMGC (SEL)"); me["Simple_L1"].setColor(BLUE); @@ -5994,8 +5986,6 @@ setlistener("sim/signals/fdm-initialized", func { mcdu.mcdu_message(0, "SELECT DESIRED SYSTEM"); mcdu.mcdu_message(1, "SELECT DESIRED SYSTEM"); - - reqFMGC = [0,0]; # reset FMGC REQ status - on MCDU restart MCDU_update.start(); }); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index f4bfac92..7650653f 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -75,6 +75,8 @@ var MCDU_reset = func(i) { fmgc.FMGCInternal.gndTempSet = 0; fmgc.FMGCInternal.toFromSet = 0; fmgc.FMGCNodes.toFromSet.setValue(0); + fmgc.FMGCInternal.coRoute = ""; + fmgc.FMGCInternal.coRouteSet = 0; fmgc.FMGCInternal.tropo = 36090; fmgc.FMGCInternal.tropoSet = 0; @@ -1484,7 +1486,9 @@ var pagebutton = func(btn, i) { } } -var button = func(btn, i) { +var buttonCLRDown = [0,0]; # counter for down event + +var button = func(btn, i, event = "") { page = pageNode[i].getValue(); if (page != "MCDU") { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; @@ -1493,11 +1497,24 @@ var button = func(btn, i) { } else if (btn == "SP") { mcdu_scratchpad.scratchpads[i].addChar(" "); } else if (btn == "CLR") { - var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (size(scratchpad) == 0) { - mcdu_scratchpad.scratchpads[i].addChar("CLR"); - } else { - mcdu_scratchpad.scratchpads[i].clear(); + if (event == "down") { + if (size(scratchpad) > 0) { + if (buttonCLRDown[i] > 4) { + mcdu_scratchpad.scratchpads[i].empty(); + } + buttonCLRDown[i] = buttonCLRDown[i] + 1; + } + } + else if (event == "" or buttonCLRDown[i]<=4) { + buttonCLRDown[i] = 0; + #var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; <- useless?? + if (size(scratchpad) == 0) { + mcdu_scratchpad.scratchpads[i].addChar("CLR"); + } else { + mcdu_scratchpad.scratchpads[i].clear(); + } + } else { # up with buttonCLRDown[i]>4 + buttonCLRDown[i] = 0; } } else if (btn == "DOT") { mcdu_scratchpad.scratchpads[i].addChar("."); @@ -1514,6 +1531,12 @@ var mcdu_message = func(i, string, overrideStr = "") { mcdu_scratchpad.scratchpads[i].override(overrideStr); } +# Messagge Type II - TODO 5 messages queue - remove only on resolve +var mcdu_messageTypeII = func(i, string, overrideStr = "") { + mcdu_scratchpad.scratchpads[i].showTypeII(mcdu_scratchpad.MessageController.getTypeIIMsgByText(string)); + mcdu_scratchpad.scratchpads[i].override(overrideStr); +} + var screenFlash = func(time, i) { page = pageNode[i].getValue(); pageNode[i].setValue("NONE"); From 06aff90ec183ae4851751d5facab0e8f7fb3963b Mon Sep 17 00:00:00 2001 From: vezza Date: Thu, 14 Jan 2021 01:20:23 +0100 Subject: [PATCH 27/38] DDRMI flags animation bugfix + knobs animation improvements --- Models/FlightDeck/a320.flightdeck.xml | 119 ++++++++++---------------- 1 file changed, 46 insertions(+), 73 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 8e1cd12a..df18e859 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -1,4 +1,4 @@ - + @@ -138,86 +138,68 @@ - pick + knob ddrmi_vor_adf_select_1 + instrumentation/ddrmi/vor-adf-1 + + ddrmi_vor_adf_select_1.axis + - - false - property-cycle + property-adjust instrumentation/ddrmi/vor-adf-1 - 0 - 1 - -1 - - - - - false - - property-cycle - instrumentation/ddrmi/vor-adf-1 - -1 - 1 - 0 + -1 + 1 + - Knob 1 rotate - ddrmi_vor_adf_select_1 + DDRMI vor-adf knob 1 rotate + ddrmi_vor_adf_select_1 instrumentation/ddrmi/vor-adf-1 - -190 - 045 - 1 0 + -190 + 045 + 1 0 ddrmi_vor_adf_select_1.axis - + - pick + knob ddrmi_vor_adf_select_2 + instrumentation/ddrmi/vor-adf-2 + + ddrmi_vor_adf_select_2.axis + - - false - property-cycle + property-adjust instrumentation/ddrmi/vor-adf-2 - 0 - 1 - -1 - - - - - false - - property-cycle - instrumentation/ddrmi/vor-adf-2 - -1 - 1 - 0 + -1 + 1 + - Knob 2 rotate - ddrmi_vor_adf_select_2 + DDRMI vor-adf knob 2 rotate + ddrmi_vor_adf_select_2 instrumentation/ddrmi/vor-adf-2 - -1-90 - 0-45 - 1 0 + -1-90 + 0-45 + 1 0 ddrmi_vor_adf_select_2.axis - + @@ -227,7 +209,7 @@ rotate instrumentation/ddrmi/flag-1 - 045 + 0-45 1 0 @@ -241,7 +223,7 @@ rotate instrumentation/ddrmi/flag-2 - 0-45 + 045 1 0 @@ -8339,30 +8321,21 @@ + - UTC selector rotate - pick + UTC selector animation + knob clock_knob + instrumentation/clock/utc-selector + + clock_knob.axis + - - false - property-cycle + property-adjust instrumentation/clock/utc-selector - 0 - 1 - 2 - - - - - false - - property-cycle - instrumentation/clock/utc-selector - 2 - 1 - 0 + 0 + 2 @@ -8373,9 +8346,9 @@ clock_knob instrumentation/clock/utc-selector - 00 - 145 - 290 + 290 + 145 + 0 0 clock_knob.axis From a559b17d1c487314eb2ac61a93dccb60860206ea Mon Sep 17 00:00:00 2001 From: legoboyvdlp Date: Thu, 14 Jan 2021 14:22:12 +0000 Subject: [PATCH 28/38] Modifications by inuyaksa (#204) * Addition of AOC page FLIGHT LOG * Improvements to ATSU * Add OOOI system (ACARS) --- A320-main.xml | 5 +- Models/Instruments/MCDU/MCDU.nas | 213 ++++++++++++++++++++++++++++++- Nasal/FMGC/FMGC.nas | 1 + Nasal/FMGC/mcdu-messages.nas | 6 +- Nasal/MCDU/FLIGHTLOG.nas | 161 +++++++++++++++++++++++ Nasal/MCDU/MCDU.nas | 41 ++++-- 6 files changed, 407 insertions(+), 20 deletions(-) create mode 100644 Nasal/MCDU/FLIGHTLOG.nas diff --git a/A320-main.xml b/A320-main.xml index 499d15b2..370ad3db 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -4660,7 +4660,7 @@ 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/RECEIVEDMESSAGES.nas Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas Aircraft/A320-family/Nasal/MCDU/HOLD.nas Aircraft/A320-family/Nasal/MCDU/F-PLN.nas @@ -4668,7 +4668,8 @@ 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/ATIS.nas + Aircraft/A320-family/Nasal/MCDU/FLIGHTLOG.nas Aircraft/A320-family/Nasal/MCDU/MCDU.nas Aircraft/A320-family/Nasal/MCDU/INITA.nas Aircraft/A320-family/Nasal/MCDU/IRSINIT.nas diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index c9949948..71b97409 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -150,10 +150,20 @@ var baro = props.globals.getNode("/FMGC/internal/baro", 1); # GA PERF +# AOC - SENSORS +var parking_brake = props.globals.getNode("/controls/gear/brake-parking", 1); +var gear0_wow = props.globals.getNode("/gear/gear[0]/wow", 1); +var doorL1_pos = props.globals.getNode("/sim/model/door-positions/doorl1/position-norm", 1); #FWD door +var doorR1_pos = props.globals.getNode("/sim/model/door-positions/doorr1/position-norm", 1); #FWD door +var doorL4_pos = props.globals.getNode("/sim/model/door-positions/doorl4/position-norm", 1); #AFT door +var doorR4_pos = props.globals.getNode("/sim/model/door-positions/doorr4/position-norm", 1); #AFT door + # Fetch nodes into vectors var pageProp = [props.globals.getNode("/MCDU[0]/page", 1), props.globals.getNode("/MCDU[1]/page", 1)]; var active = [props.globals.getNode("/MCDU[0]/active", 1), props.globals.getNode("/MCDU[1]/active", 1)]; var activeAtsu = [props.globals.getNode("/MCDU[0]/atsu-active", 1), props.globals.getNode("/MCDU[1]/atsu-active", 1)]; +props.globals.initNode("/MCDU[0]/active-system", "", "STRING"); +props.globals.initNode("/MCDU[1]/active-system", "", "STRING"); # Conversion factor pounds to kilogram var LBS2KGS = 0.4535924; @@ -286,6 +296,19 @@ var canvas_MCDU_base = { me["ArrowLeft"].hide(); me["ArrowRight"].hide(); }, + showPageNumbers: func(pagno=0,pagcnt=0) { + if (pagno == 0) return me.defaultPageNumbers(); + me["Simple_PageNum"].show(); + me["Simple_PageNum"].setText((pagcnt>0) ? pagno ~ "/" ~ pagcnt : pagno); + me["ArrowLeft"].show(); + me["ArrowRight"].show(); + }, + showPageNumbersOnly: func(pagno,pagcnt) { + me["Simple_PageNum"].show(); + me["Simple_PageNum"].setText(sprintf("%9s",pagno ~ "/" ~ pagcnt)); + me["ArrowLeft"].hide(); + me["ArrowRight"].hide(); + }, hideAllArrows: func() { me["Simple_L1_Arrow"].hide(); me["Simple_L2_Arrow"].hide(); @@ -419,7 +442,7 @@ var canvas_MCDU_base = { } else { me["FPLN_Callsign"].hide(); } - + me.dynamicPageFunc(myFpln[i].L1, "Simple_L1"); me.dynamicPageFunc(myFpln[i].L2, "Simple_L2"); me.dynamicPageFunc(myFpln[i].L3, "Simple_L3"); @@ -595,6 +618,178 @@ var canvas_MCDU_base = { me["Simple_R6"].hide(); me["Simple_R6_Arrow"].hide(); } + } else if (page == "FLTLOG") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHideWithCenter(); + + me["Simple_L0S"].hide(); + me["ArrowLeft"].hide(); + me["ArrowRight"].hide(); + + me.showLeft(1, 1, 1, 1, 1, -1); + 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.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorCenter("wht", "wht", "wht", "wht", "wht", "wht"); + + #me["PRINTPAGE"] - TODO missing asterisk at 5L - only useful when printing available + + me["Simple_L1S"].setText(" FLT NUM-DATE"); + me["Simple_R1S"].setText("ORIG-DEST "); + me["Simple_L1"].setFontSize(small); + me["Simple_R1"].setFontSize(small); + me["Simple_L2"].setFontSize(small); + me["Simple_C2"].setFontSize(small); + me["Simple_R2"].setFontSize(small); + me["Simple_L3"].setFontSize(small); + me["Simple_C3"].setFontSize(small); + me["Simple_R3"].setFontSize(small); + + me["Simple_L5"].setText(" PRINT"); + me["Simple_L5"].setColor(BLUE); + + me["Simple_R5"].setText("SENSORS "); + me["Simple_R5"].setColor(WHITE); + + me["Simple_L4"].setFontSize(small); + me["Simple_L4"].setText(" FLIGHT"); + me["Simple_C4"].setFontSize(small); + me["Simple_C4"].setText("--TIMES--"); + me["Simple_R4"].setFontSize(small); + me["Simple_R4"].setText("BLOCK "); + + me["Simple_C2S"].setText("TIME"); + me["Simple_R2S"].setText("FOB "); + + me["Simple_L2"].setText( " OUT -"); + me["Simple_L3S"].setText(" OFF -"); + me["Simple_L3"].setText( " ON -"); + me["Simple_L4S"].setText(" IN -"); + + me["Simple_C5"].setFontSize(small); + + pageSwitch[i].setBoolValue(1); + } + + var logid = 1; #mcdu.FlightLogDatabase.getPageSize(); - one page only - TODO: multi pages + if (logid == 0) logid = 1; + + me.showPageNumbersOnly(1,1); + me["Simple_Title"].setText(sprintf("FLT LOG.%04d",logid)); + + me["Simple_C2"].setText( "--.--"); #TODO - missing ":" char on fontset + me["Simple_C3S"].setText("--.--"); + me["Simple_C3"].setText( "--.--"); + me["Simple_C4S"].setText("--.--"); + me["Simple_R2"].setText( "---.- "); + me["Simple_R3S"].setText("---.- "); + me["Simple_R3"].setText( "---.- "); + me["Simple_R4S"].setText("---.- "); + me.colorCenter("wht", "grn", "grn", "wht", "wht", "wht"); + me.colorRight("wht", "grn", "grn", "wht", "wht", "wht"); + me.colorLeftS("wht", "wht", "wht", "wht", "grn", "wht"); + me.colorCenterS("wht", "wht", "grn", "grn", "grn", "wht"); + me.colorRightS("wht", "wht", "grn", "grn", "grn", "wht"); + + var rowsC = ["Simple_C2","Simple_C3S","Simple_C3","Simple_C4S"]; + var rowsR = ["Simple_R2","Simple_R3S","Simple_R3","Simple_R4S"]; + var logs = mcdu.FlightLogDatabase.getLogByPage(logid); + var len = size(logs); + var flgtime = 0; + var blktime = 0; + for ( var i = 0; i < len; i = i + 1 ) { + if (logs[i] != nil) { # only valid reports + var p = logs[i].state; + if (p == 4) p = 3; # RETURN-IN + me[rowsC[p]].setText(logs[i].time); + me[rowsR[p]].setText(sprintf("%3.1f ",logs[i].fob)); + } + } + + var logpage = mcdu.FlightLogDatabase.getPage(logid); + + me["Simple_L1"].setText(sprintf("%8s - ",logpage.fltnum) ~ logpage.date); + me["Simple_R1"].setText(logpage.tofrom ~ " "); + + me["Simple_L5S"].setText( " " ~ logpage.flttime ); + me["Simple_C5S"].setText(sprintf("%02.0f", getprop("/sim/time/utc/hour")) ~ "." ~ sprintf("%02.0f", getprop("/sim/time/utc/minute")) ~ "." ~ sprintf("%02.0f", getprop("/sim/time/utc/second"))); + me["Simple_R5S"].setText( logpage.blktime ~ " " ); + + var fltstate = logpage.fltstate; + if (fltstate == "") { + fltstate = (fmgc.FMGCInternal.toFromSet) ? "BEGIN" : "RESET"; #CHECKME - my best guess, only ready when plan inserted + #TODO Pushback detection -> WPUSH state??? + } + me["Simple_C5"].setText(fltstate); + + } else if (page == "SENSORS") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHide(); + me["Simple_Title"].setText("SENSORS "); + me.defaultPageNumbers(); + me["Simple_L0S"].hide(); + + me.showLeft(1, 1, 1, 1, 1, 1); + me.showLeftS(1, 1, 1, 1, -1, -1); + me.showLeftArrow(-1, -1, -1, -1, -1, 1); + me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); + 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["PRINTPAGE"] - TODO missing asterisk at 5L - only useful when printing available + + me.standardFontSize(); + me.standardFontColour(); + + me["Simple_L1"].setFontSize(small); + me["Simple_R1"].setFontSize(small); + me["Simple_L2"].setFontSize(small); + me["Simple_R2"].setFontSize(small); + me["Simple_L3"].setFontSize(small); + me["Simple_R3"].setFontSize(small); + me["Simple_L4"].setFontSize(small); + me["Simple_R4"].setFontSize(small); + + me.colorRight("grn", "grn", "grn", "grn", "grn", "grn"); + me.colorRightS("grn", "grn", "grn", "grn", "grn", "grn"); + + me["Simple_L1S"].setText(" PARK BRAKE"); + me["Simple_L1"].setText( " NOSE STRUT"); + me["Simple_L2S"].setText( " L FWD DOOR"); + me["Simple_L2"].setText( " R FWD DOOR"); + me["Simple_L3S"].setText( " L AFT DOOR"); + me["Simple_L3"].setText( " R AFT DOOR"); + me["Simple_L4S"].setText( " GND SPEED"); + me["Simple_L4"].setText( " FOB"); + + me["Simple_L5"].setText(" PRINT"); + me["Simple_L5"].setColor(BLUE); + + me["Simple_L6"].setText(" RETURN"); + + pageSwitch[i].setBoolValue(1); + } + + me["Simple_R1S"].setText(sprintf("%-10s",(parking_brake.getValue() == 1) ? "SET" : "RELEASED")); + me["Simple_R1"].setText(sprintf("%-10s",(gear0_wow.getValue() == 1) ? "GROUND" : "FLIGHT")); + me["Simple_R2S"].setText(sprintf("%-10s",(doorL1_pos.getValue() > 0.1) ? "OPEN" : "CLOSED")); + me["Simple_R2"].setText(sprintf("%-10s",(doorR1_pos.getValue() > 0.1) ? "OPEN" : "CLOSED")); + me["Simple_R3S"].setText(sprintf("%-10s",(doorL4_pos.getValue() > 0.1) ? "OPEN" : "CLOSED")); + me["Simple_R3"].setText(sprintf("%-10s",(doorR4_pos.getValue() > 0.1) ? "OPEN" : "CLOSED")); + me["Simple_R4S"].setText(sprintf("%-10s",sprintf("%03.3f",pts.Velocities.groundspeed.getValue()))); + me["Simple_R4"].setText(sprintf("%-10s",sprintf("%03.1f",fmgc.FMGCInternal.fob))); + } else if (page == "AOCCONFIG") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); @@ -1832,9 +2027,9 @@ var canvas_MCDU_base = { me["Simple_Title"].setText(sprintf("%s", " " ~ acType.getValue())); me.defaultPageNumbers(); - me.showLeft(1, 1, 1, -1, 1, 1); + me.showLeft(1, 1, 1, -1, -1, 1); me["Simple_L0S"].hide(); - me.showLeftS(1, 1, 1, -1, 1, 1); + me.showLeftS(1, 1, 1, -1, -1, 1); me.showLeftArrow(-1, -1, 1, -1, -1, -1); me.showRight(-1, 1, -1, 1, 1, 1); me.showRightS(-1, -1, -1, 1, 1, 1); @@ -1857,13 +2052,17 @@ var canvas_MCDU_base = { me.colorRightS("wht", "wht", "wht", "wht", "grn", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - - me["Simple_L5"].setText("[ ]"); + if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 7) { # only on preflight and done phases + me["Simple_L5S"].setText("CHG CODE"); + me["Simple_L5S"].show(); + me["Simple_L5"].setText("[ ]"); + me["Simple_L5"].show(); + } + me["Simple_L6"].setText("+0.0/+1.0"); me["Simple_L1S"].setText(" ENG"); me["Simple_L2S"].setText(" ACTIVE NAV DATA BASE"); - me["Simple_L3S"].setText(" SECOND NAV DATA BASE"); - me["Simple_L5S"].setText("CHG CODE"); + me["Simple_L3S"].setText(" SECOND NAV DATA BASE"); me["Simple_L6S"].setText("IDLE/PERF"); me["Simple_R6"].setText("STATUS/XLOAD "); me["Simple_R6S"].setText("SOFTWARE "); diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 1ca929bb..0281b084 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -973,6 +973,7 @@ var reset_FMGC = func { mcdu.MCDU_reset(0); mcdu.MCDU_reset(1); mcdu.ReceivedMessagesDatabase.clearDatabase(); + mcdu.FlightLogDatabase.clearDatabase(); Input.fd1.setValue(fd1); Input.fd2.setValue(fd2); diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index f741725c..3c036d2c 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -180,12 +180,16 @@ 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") + TypeIMessage.new("NO ANSWER TO REQUEST"),TypeIMessage.new("NO D-ATIS AVAILABLE"),TypeIMessage.new("BAD SERVER RESPONSE"), + TypeIMessage.new("WIND DATA UPLINK"),TypeIMessage.new("CHECK ALT WIND"),TypeIMessage.new("INVALID WIND UPLINK"),TypeIMessage.new("WIND UPLINK EXISTS"), #p.533 + TypeIMessage.new("FM DATALINK UNAVAIL"),TypeIMessage.new("NOT XMITTED TO ACARS"), #p.559 + TypeIMessage.new("PRINTER NOT AVAILABLE"), ]), 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"), TypeIIMessage.new("STEP NOW"),TypeIIMessage.new("TIME TO EXIT", "amb", 0),TypeIIMessage.new("V1/VR/V2 DISAGREE", "amb", 0), TypeIIMessage.new("TO SPEED TOO LOW", "amb", 0), + TypeIIMessage.new("CHECK DEST DATA", "amb", 0), #p.533 ]), # to speed to low - new on a320, margin against vmcg / vs1g diff --git a/Nasal/MCDU/FLIGHTLOG.nas b/Nasal/MCDU/FLIGHTLOG.nas new file mode 100644 index 00000000..81af304e --- /dev/null +++ b/Nasal/MCDU/FLIGHTLOG.nas @@ -0,0 +1,161 @@ +# AOC Flight Log system +# Basic OOOI system implementation + +var OOOIReport = { + new: func(state,fob="",time="") { + var report = {parents:[OOOIReport]}; + report.state = state; + report.fob = (fob != "") ? fob : fmgc.FMGCInternal.fob; + report.time = (time != "") ? time : sprintf("%02d.%02d", getprop("/sim/time/utc/hour"), getprop("/sim/time/utc/minute")); + report.elapsed = int(getprop("/sim/time/elapsed-sec")); + report.gmt = getprop("/sim/time/gmt-string"); + report.date = getprop("/sim/time/utc/day"); + report.fltnum = (fmgc.FMGCInternal.flightNumSet == 1) ? fmgc.FMGCInternal.flightNum : "----"; + report.tofrom = (fmgc.FMGCInternal.toFromSet) ? fmgc.FMGCInternal.depApt ~ "-" ~ fmgc.FMGCInternal.arrApt : "----/----"; + return report; + }, +}; + +# Flight phase states: RESET, BEGIN, WPUSH, OUT, OFF, ON, END + +var OOOIReportPage = { + new: func(index) { + var page = {parents:[OOOIReportPage]}; + page.index = index; + page.fltstate = ""; #UNDEF state RESET/BEGIN/WPUSH + page.fltnum = (fmgc.FMGCInternal.flightNumSet == 1) ? fmgc.FMGCInternal.flightNum : ""; + page.date = getprop("/sim/time/utc/day"); + page.tofrom = (fmgc.FMGCInternal.toFromSet) ? fmgc.FMGCInternal.depApt ~ "-" ~ fmgc.FMGCInternal.arrApt : ""; + page.fltstart = 0; + page.blkstart = 0; + page.flttime = "--.--"; + page.blktime = "--.--"; + return page; + }, +}; + +var formatSecToHHMM = func(sec) { + var mn = int(sec / 60); + return sprintf("%02d.%02d",int(mn/60),math.mod(mn,60)); +} + +var FlightLogDatabase = { + database: std.Vector.new(), + pages: std.Vector.new(), + addReport: func(report) { + if (report.state == 0) me.pages.append( OOOIReportPage.new(me.getSize()) ); + me.database.append(report); + var pg = me.pages.vector[me.pages.size()-1]; + pg.fltnum = report.fltnum; + pg.tofrom = report.tofrom; + if (report.state == 0) { + pg.fltstate = "OUT"; + pg.blkstart = report.elapsed; + } + else if (report.state == 1) { + pg.fltstate = "OFF"; + pg.fltstart = report.elapsed; + } + else if (report.state == 2) { + pg.fltstate = "ON"; + if (pg.fltstart > 0) pg.flttime = formatSecToHHMM(report.elapsed - pg.fltstart); + } + else if (report.state > 2) { + pg.fltstate = "END"; + if (pg.blkstart > 0) pg.blktime = formatSecToHHMM(report.elapsed - pg.blkstart); + } + }, + getSize: func() { + return me.database.size(); + }, + getPageSize: func() { + return me.pages.size(); + }, + clearDatabase: func() { + me.database.clear(); + me.pages.clear(); + }, + getLogs: func() { + var lst = []; + foreach (var log; me.database) { + append(lst,log); + } + return lst; + }, + getPage: func(pg) { + return (pg<=me.getPageSize()) ? me.pages.vector[pg-1] : OOOIReportPage.new(0); + }, + getLogByPage: func(no) { + var lst = [nil,nil,nil,nil]; + if (me.getPageSize() == 0) return lst; + var i = (me.getPageSize()>=no) ? me.pages.vector[no-1].index : 0; + var len = me.getSize(); + var v = 0; + var p = 0; + while (i9) { # imho - it's useful few speed tollerance, 10kts min speed on taxiways - CHECKME - better with pushback detection? + FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); + expectedOOOIState = 1; + } + } + } else if (expectedOOOIState == 1) { # OFF + if (!gear0) { + FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); + expectedOOOIState = 2; + } + else if (gs < 1) { # RETURN-IN ?? - rejected takeoff, A/C back to apron - CHECKME + if (doorL1_pos.getValue()>0 or doorR1_pos.getValue()>0 or doorL4_pos.getValue()>0 or doorR4_pos.getValue()>0) { + FlightLogDatabase.addReport(OOOIReport.new(4)); # RETURN-IN + expectedOOOIState = 0; + } + } + } else if (expectedOOOIState == 2) { # ON + if (gear0 and (phase == 7 or phase == 0)) { #done or preflight + FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); + expectedOOOIState = 3; + } + } else if (expectedOOOIState == 3) { # IN + if (gear0 and gs < 1) { + if (doorL1_pos.getValue()>0 or doorR1_pos.getValue()>0 or doorL4_pos.getValue()>0 or doorR4_pos.getValue()>0) { + FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); + expectedOOOIState = 0; + } + } + } + +}); + +var engine_one_chk_OOOI = setlistener("/engines/engine[0]/state", func { + if (getprop("/engines/engine[0]/state") == 3) { + removelistener(engine_one_chk_OOOI); + waitingOOOIChange.start(); + } +},0,0); \ No newline at end of file diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 7650653f..81a8b18d 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -18,6 +18,7 @@ var MCDU_reset = func(i) { setprop("it-autoflight/settings/togaspd", 157); #aka v2 clone setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", "STATUS"); setprop("/MCDU[" ~ i ~ "]/last-atsu-page", "ATSUDLINK"); + setprop("/MCDU[" ~ i ~ "]/active-system",""); pageNode[i].setValue("MCDU"); setprop("/FMGC/keyboard-left", 0); @@ -218,9 +219,11 @@ var lskbutton = func(btn, i) { pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); mcdu_scratchpad.scratchpads[i].empty(); setprop("/MCDU[" ~ i ~ "]/active", 2); + setprop("/MCDU[" ~ i ~ "]/active-system","fmgc"); }, 2); - } else { + } else { pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); + setprop("/MCDU[" ~ i ~ "]/active-system","fmgc"); mcdu_scratchpad.scratchpads[i].empty(); } } @@ -374,9 +377,11 @@ var lskbutton = func(btn, i) { pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-atsu-page")); mcdu_scratchpad.scratchpads[i].empty(); setprop("/MCDU[" ~ i ~ "]/atsu-active", 2); + setprop("/MCDU[" ~ i ~ "]/active-system","atsu"); }, 2); } else { pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-atsu-page")); + setprop("/MCDU[" ~ i ~ "]/active-system","atsu"); mcdu_scratchpad.scratchpads[i].empty(); } } @@ -797,6 +802,8 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } else if (page == "ATCMENU") { pageNode[i].setValue("NOTIFICATION"); + } else if (page == "FLTLOG") { + mcdu_message(i, "NOT ALLOWED"); } else if (page == "MCDUTEXT") { atsu.freeTexts[i].selection = 9; atsu.freeTexts[i].changed = 1; @@ -859,6 +866,8 @@ var lskbutton = func(btn, i) { canvas_mcdu.myClosestAirport[i].freeze(); } else if (page == "AOCMENU" or page == "ATCMENU" or page == "ATCMENU2") { pageNode[i].setValue("ATSUDLINK"); + } else if (page == "SENSORS") { + pageNode[i].setValue("FLTLOG"); } else if (page == "NOTIFICATION" or page == "CONNECTSTATUS" or page == "MCDUTEXT") { pageNode[i].setValue("ATCMENU"); } else if (page == "WEATHERREQ" or page == "RECEIVEDMSGS") { @@ -945,6 +954,8 @@ var rskbutton = func(btn, i) { } } else if (page == "ATSUDLINK") { pageNode[i].setValue("AOCMENU"); + } else if (page == "AOCMENU") { + pageNode[i].setValue("FLTLOG"); } else if (page == "WEATHERREQ") { var result = atsu.AOC.newStation(mcdu_scratchpad.scratchpads[i].scratchpad, i); if (result == 1) { @@ -1205,6 +1216,8 @@ var rskbutton = func(btn, i) { } } else if (page == "ATCMENU") { pageNode[i].setValue("CONNECTSTATUS"); + } else if (page == "FLTLOG") { + pageNode[i].setValue("SENSORS"); } else if (page == "WEATHERREQ") { var result = atsu.AOC.sendReq(i); if (result == 1) { @@ -1397,8 +1410,15 @@ var pagebutton = func(btn, i) { page = pageNode[i].getValue(); setprop("/MCDU[" ~ i ~ "]/scratchpad-color", "wht"); if (page != "MCDU") { + + # A more flexible system/page tracking for future system expansion + if (getprop("/MCDU[" ~ i ~ "]/active-system") == "fmgc") setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", page); + else setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page); + if (btn == "atc") setprop("/MCDU[" ~ i ~ "]/active-system","atsu"); + else setprop("/MCDU[" ~ i ~ "]/active-system","fmgc"); + if (btn == "radnav") { - pageNode[i].setValue("RADNAV"); + pageNode[i].setValue("RADNAV"); } else if (btn == "prog") { if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { pageNode[i].setValue("PROGTO"); @@ -1433,12 +1453,13 @@ var pagebutton = func(btn, i) { } else if (btn == "data") { pageNode[i].setValue("DATA"); } else if (btn == "mcdu") { - var page = page; - 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 != "MCDUTEXT" 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); - } + #var page = page; + #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 != "MCDUTEXT" 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") { + #if (getprop("/MCDU[0]/active-system") == "fmgc") { + # setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", page); + #} else { + # #setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page); + #} mcdu_message(i, "SELECT DESIRED SYSTEM"); pageNode[i].setValue("MCDU"); } else if (btn == "f-pln" or btn == "airport") { @@ -1477,10 +1498,10 @@ var pagebutton = func(btn, i) { settimer(func(){ pageNode[i].setValue("ATCMENU"); mcdu_scratchpad.scratchpads[i].empty(); - setprop("/MCDU[" ~ i ~ "]/atsu-active", 2); + setprop("/MCDU[" ~ i ~ "]/atsu-active", 2); }, 2); } else { - pageNode[i].setValue("ATCMENU"); + pageNode[i].setValue("ATCMENU"); } } } From 533682abce1513e3c3b91a8e544327f26874e0bc Mon Sep 17 00:00:00 2001 From: Inuyaksa Date: Sat, 16 Jan 2021 14:27:55 +0100 Subject: [PATCH 29/38] little modifications to fltlog - manage MCDU reset --- Nasal/FMGC/FMGC.nas | 2 +- Nasal/MCDU/FLIGHTLOG.nas | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 0281b084..669a0685 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -973,7 +973,7 @@ var reset_FMGC = func { mcdu.MCDU_reset(0); mcdu.MCDU_reset(1); mcdu.ReceivedMessagesDatabase.clearDatabase(); - mcdu.FlightLogDatabase.clearDatabase(); + mcdu.FlightLogDatabase.reset(); # track reset events without loosing recorded data Input.fd1.setValue(fd1); Input.fd2.setValue(fd2); diff --git a/Nasal/MCDU/FLIGHTLOG.nas b/Nasal/MCDU/FLIGHTLOG.nas index 81af304e..d2127c8a 100644 --- a/Nasal/MCDU/FLIGHTLOG.nas +++ b/Nasal/MCDU/FLIGHTLOG.nas @@ -42,8 +42,9 @@ var formatSecToHHMM = func(sec) { var FlightLogDatabase = { database: std.Vector.new(), pages: std.Vector.new(), + currpageindex: 0, addReport: func(report) { - if (report.state == 0) me.pages.append( OOOIReportPage.new(me.getSize()) ); + if (report.state == 0 or me.getPageSize()==0) me.addPage(); me.database.append(report); var pg = me.pages.vector[me.pages.size()-1]; pg.fltnum = report.fltnum; @@ -65,6 +66,9 @@ var FlightLogDatabase = { if (pg.blkstart > 0) pg.blktime = formatSecToHHMM(report.elapsed - pg.blkstart); } }, + reset: func() { + if (me.getPageSize()>0 and me.currpageindex < me.getSize()) me.addPage(); + }, getSize: func() { return me.database.size(); }, @@ -82,6 +86,10 @@ var FlightLogDatabase = { } return lst; }, + addPage: func() { + me.currpageindex = me.getSize(); + me.pages.append( OOOIReportPage.new(me.getSize()) ); + }, getPage: func(pg) { return (pg<=me.getPageSize()) ? me.pages.vector[pg-1] : OOOIReportPage.new(0); }, From 26e04b47b7ed24c00a3f7e05083eef1155c70f57 Mon Sep 17 00:00:00 2001 From: Josh Davidson Date: Sun, 17 Jan 2021 15:52:23 -0500 Subject: [PATCH 30/38] Control: Tiller handle fixed --- Systems/a320-fcs.xml | 7 ++++++- revision.txt | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Systems/a320-fcs.xml b/Systems/a320-fcs.xml index 9efc0ea5..0ad34c56 100644 --- a/Systems/a320-fcs.xml +++ b/Systems/a320-fcs.xml @@ -979,8 +979,13 @@ - + fbw/tiller-handle-scheduled + 0.16 + + + + fbw/tiller-handle-cmd 20 diff --git a/revision.txt b/revision.txt index 7d373862..abc4eff6 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -45 \ No newline at end of file +46 \ No newline at end of file From 238068f9821db53b48aa598d488cc32e3fa4ff1f Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 18 Jan 2021 19:41:32 +0000 Subject: [PATCH 31/38] Simplify PFD code by merging loops --- Models/Instruments/PFD/PFD.nas | 660 ++++++++++++++++----------------- 1 file changed, 311 insertions(+), 349 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 4835a9f8..40a5b38f 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -10,9 +10,7 @@ var PFD_1_mismatch = nil; var PFD_2_mismatch = nil; var PFD1_display = nil; var PFD2_display = nil; -var updateL = 0; -var updateR = 0; -var elapsedtime = 0; +var et = 0; var altTens = 0; var track_diff = 0; var AICenter = nil; @@ -282,56 +280,40 @@ var canvas_PFD_base = { if (systems.ELEC.Bus.acEss.getValue() >= 110 and du1_lgt.getValue() > 0.01) { if (du1_test_time.getValue() + du1_test_amount.getValue() >= elapsedtime_act and cpt_du_xfr.getValue() != 1) { PFD_1_test.update(); - updateL = 0; PFD_1.page.hide(); PFD_1_test.page.show(); } else if (du2_test_time.getValue() + du2_test_amount.getValue() >= elapsedtime_act and cpt_du_xfr.getValue() == 1) { PFD_1_test.update(); - updateL = 0; PFD_1.page.hide(); PFD_1_test.page.show(); } else { - PFD_1.updateFast(); - if (!updateL) { # Update slow here once so that no flicker if timers don't perfectly align - updateL = 1; - PFD_1.update(); - } + PFD_1.update(); PFD_1_test.page.hide(); PFD_1.page.show(); } } else { - updateL = 0; PFD_1_test.page.hide(); PFD_1.page.hide(); } if (systems.ELEC.Bus.ac2.getValue() >= 110 and du6_lgt.getValue() > 0.01) { if (du6_test_time.getValue() + du6_test_amount.getValue() >= elapsedtime_act and fo_du_xfr.getValue() != 1) { PFD_2_test.update(); - updateR = 0; PFD_2.page.hide(); PFD_2_test.page.show(); } else if (du5_test_time.getValue() + du5_test_amount.getValue() >= elapsedtime_act and fo_du_xfr.getValue() == 1) { PFD_2_test.update(); - updateR = 0; PFD_2.page.hide(); PFD_2_test.page.show(); } else { - PFD_2.updateFast(); - if (!updateR) { # Update slow here once so that no flicker if timers don't perfectly align - updateR = 1; - PFD_2.update(); - } + PFD_2.update(); PFD_2_test.page.hide(); PFD_2.page.show(); } } else { - updateR = 0; PFD_2_test.page.hide(); PFD_2.page.hide(); } } else { - updateL = 0; - updateR = 0; PFD_1_test.page.hide(); PFD_1.page.hide(); PFD_2_test.page.hide(); @@ -342,14 +324,6 @@ var canvas_PFD_base = { PFD_2_mismatch.page.show(); } }, - updateSlow: func() { - if (updateL) { - PFD_1.update(); - } - if (updateR) { - PFD_2.update(); - } - }, updateCommon: func () { # FMA MAN TOGA MCT FLX THR # Set properties used a lot to a variable to avoid calling getValue() multiple times @@ -360,6 +334,310 @@ var canvas_PFD_base = { toga_lk_act = toga_lk.getValue(); thr1_act = thr1.getValue(); thr2_act = thr2.getValue(); + + # Attitude Indicator + pitch_cur = pitch.getValue(); + roll_cur = roll.getValue(); + + me.AI_horizon_trans.setTranslation(0, pitch_cur * 11.825); + me.AI_horizon_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); + me.AI_horizon_ground_trans.setTranslation(0, horizon_ground.getValue() * 11.825); + me.AI_horizon_ground_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); + me.AI_horizon_sky_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); + + me["AI_slipskid"].setTranslation(math.clamp(slip_skid.getValue(), -15, 15) * 7, 0); + me["AI_bank"].setRotation(-roll_cur * D2R); + + if (fbw_law.getValue() == 0) { + me["AI_bank_lim"].show(); + me["AI_pitch_lim"].show(); + me["AI_bank_lim_X"].hide(); + me["AI_pitch_lim_X"].hide(); + } else { + me["AI_bank_lim"].hide(); + me["AI_pitch_lim"].hide(); + me["AI_bank_lim_X"].show(); + me["AI_pitch_lim_X"].show(); + } + + fd_roll_cur = fd_roll.getValue(); + fd_pitch_cur = fd_pitch.getValue(); + if (fd_roll_cur != nil) { + me["FD_roll"].setTranslation((fd_roll_cur) * 2.2, 0); + } + if (fd_pitch_cur != nil) { + me["FD_pitch"].setTranslation(0, -(fd_pitch_cur) * 3.8); + } + + gear_agl_cur = gear_agl.getValue(); + + me["AI_agl"].setText(sprintf("%s", math.round(math.clamp(gear_agl_cur, 0, 2500)))); + + if (fmgc.FMGCInternal.phase < 3 or fmgc.flightPlanController.arrivalDist >= 250) { + me["FMA_dh_box"].hide(); + me["FMA_dh"].hide(); + me["FMA_dhn"].hide(); + me["FMA_nodh"].hide(); + #me["dhReached"].hide(); + if (gear_agl_cur <= 2500) { + me["AI_agl"].show(); + if (gear_agl_cur <= decision.getValue()) { + me["AI_agl"].setColor(0.7333,0.3803,0); + } else { + me["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } else { + me["AI_agl"].hide(); + } + } else { + if (gear_agl_cur <= 2500) { + me["AI_agl"].show(); + me["FMA_dh_box"].hide(); #not implemented + if (int(getprop("/FMGC/internal/radio")) != 99999) { + me["FMA_dh"].setText("RADIO"); + me["FMA_dh"].show(); + me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/radio"))); + me["FMA_dhn"].show(); + me["FMA_nodh"].hide(); + hundredAbove.setValue(getprop("/FMGC/internal/radio") + 100); + minimum.setValue(getprop("/FMGC/internal/radio")); + if (gear_agl_cur <= getprop("/FMGC/internal/radio") + 100) { + me["AI_agl"].setColor(0.7333,0.3803,0); + } else { + me["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } else if (int(getprop("/FMGC/internal/baro")) != 99999) { + me["FMA_dh"].setText("BARO"); + me["FMA_dh"].show(); + me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/baro"))); + me["FMA_dhn"].show(); + me["FMA_nodh"].hide(); + hundredAbove.setValue(getprop("/FMGC/internal/baro") + 100); + minimum.setValue(getprop("/FMGC/internal/baro")); + if (gear_agl_cur <= getprop("/FMGC/internal/baro") + 100) { + me["AI_agl"].setColor(0.7333,0.3803,0); + } else { + me["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } else if (fmgc.FMGCInternal.radioNo) { + me["FMA_dh"].setText("BARO"); + me["FMA_dh"].show(); + me["FMA_dhn"].setText("100"); + me["FMA_dhn"].show(); + me["FMA_nodh"].hide(); + hundredAbove.setValue(100); + minimum.setValue(0); + if (gear_agl_cur <= 100) { + me["AI_agl"].setColor(0.7333,0.3803,0); + } else { + me["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } else { + me["FMA_dh"].hide(); + me["FMA_dhn"].hide(); + me["FMA_nodh"].show(); + hundredAbove.setValue(400); + minimum.setValue(300); + if (gear_agl_cur <= 400) { + me["AI_agl"].setColor(0.7333,0.3803,0); + } else { + me["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } + } else { + me["AI_agl"].hide(); + me["FMA_nodh"].hide(); + me["FMA_dh_box"].hide(); #not implemented + if (int(getprop("/FMGC/internal/radio")) != 99999) { + me["FMA_dh"].setText("RADIO"); + me["FMA_dh"].show(); + me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/radio"))); + me["FMA_dhn"].show(); + me["FMA_nodh"].hide(); + } else if (int(getprop("/FMGC/internal/baro")) != 99999) { + me["FMA_dh"].setText("BARO"); + me["FMA_dh"].show(); + me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/baro"))); + me["FMA_dhn"].show(); + me["FMA_nodh"].hide(); + } else if (fmgc.FMGCInternal.radioNo) { + me["FMA_dh"].setText("BARO"); + me["FMA_dh"].show(); + me["FMA_dhn"].setText("100"); + me["FMA_dhn"].show(); + me["FMA_nodh"].hide(); + } else { + me["FMA_dh"].hide(); + me["FMA_dhn"].hide(); + me["FMA_nodh"].show(); + } + } + } + + me["AI_agl_g"].setRotation(-roll_cur * D2R); + + FMGCphase_act = fmgc.FMGCInternal.phase; + if ((wow1.getValue() == 1 or wow2.getValue() == 1) and FMGCphase_act != 0 and FMGCphase_act != 1) { + me["AI_stick"].show(); + me["AI_stick_pos"].show(); + + } else if ((wow1.getValue() == 1 or wow2.getValue() == 1) and (FMGCphase_act == 0 or FMGCphase_act == 1) and (eng0_state.getValue() == 3 or eng1_state.getValue() == 3)) { + me["AI_stick"].show(); + me["AI_stick_pos"].show(); + } else { + me["AI_stick"].hide(); + me["AI_stick_pos"].hide(); + } + + me["AI_stick_pos"].setTranslation(aileron_input.getValue() * 196.8, elevator_input.getValue() * 151.5); + + # Vertical Speed + me["VS_pointer"].setRotation(vs_needle.getValue() * D2R); + + me["VS_box"].setTranslation(0, vs_digit.getValue()); + + var vs_pfd_cur = ap_vs_pfd.getValue(); + if (vs_pfd_cur < 2) { + me["VS_box"].hide(); + } else { + me["VS_box"].show(); + } + + if (vs_pfd_cur < 10) { + me["VS_digit"].setText(sprintf("%02d", "0" ~ vs_pfd_cur)); + } else { + me["VS_digit"].setText(sprintf("%02d", vs_pfd_cur)); + } + + var vs_itaf = fmgc.Internal.vs.getValue(); + var gearAgl = gear_agl.getValue(); + + if (abs(vs_itaf) >= 6000 or (vs_itaf <= -2000 and gearAgl <= 2500) or (vs_itaf <= -1200 and gearAgl <= 1000)) { + me["VS_digit"].setColor(0.7333,0.3803,0); + me["VS_pointer"].setColor(0.7333,0.3803,0); + me["VS_pointer"].setColorFill(0.7333,0.3803,0); + } else { + me["VS_digit"].setColor(0.0509,0.7529,0.2941); + me["VS_pointer"].setColor(0.0509,0.7529,0.2941); + me["VS_pointer"].setColorFill(0.0509,0.7529,0.2941); + } + + # ILS + me["LOC_pointer"].setTranslation(loc.getValue() * 197, 0); + me["GS_pointer"].setTranslation(0, gs.getValue() * -197); + + # Heading + me.heading = hdg_scale.getValue(); + me.headOffset = me.heading / 10 - int(me.heading / 10); + me.middleText = roundabout(me.heading / 10); + me.middleOffset = nil; + if(me.middleText == 36) { + me.middleText = 0; + } + me.leftText1 = me.middleText == 0?35:me.middleText - 1; + me.rightText1 = me.middleText == 35?0:me.middleText + 1; + me.leftText2 = me.leftText1 == 0?35:me.leftText1 - 1; + me.rightText2 = me.rightText1 == 35?0:me.rightText1 + 1; + me.leftText3 = me.leftText2 == 0?35:me.leftText2 - 1; + me.rightText3 = me.rightText2 == 35?0:me.rightText2 + 1; + if (me.headOffset > 0.5) { + me.middleOffset = -(me.headOffset - 1) * 98.5416; + } else { + me.middleOffset = -me.headOffset * 98.5416; + } + me["HDG_scale"].setTranslation(me.middleOffset, 0); + me["HDG_scale"].update(); + me["HDG_four"].setText(sprintf("%d", me.middleText)); + me["HDG_five"].setText(sprintf("%d", me.rightText1)); + me["HDG_three"].setText(sprintf("%d", me.leftText1)); + me["HDG_six"].setText(sprintf("%d", me.rightText2)); + me["HDG_two"].setText(sprintf("%d", me.leftText2)); + me["HDG_seven"].setText(sprintf("%d", me.rightText3)); + me["HDG_one"].setText(sprintf("%d", me.leftText3)); + + me["HDG_four"].setFontSize(fontSizeHDG(me.middleText), 1); + me["HDG_five"].setFontSize(fontSizeHDG(me.rightText1), 1); + me["HDG_three"].setFontSize(fontSizeHDG(me.leftText1), 1); + me["HDG_six"].setFontSize(fontSizeHDG(me.rightText2), 1); + me["HDG_two"].setFontSize(fontSizeHDG(me.leftText2), 1); + me["HDG_seven"].setFontSize(fontSizeHDG(me.rightText3), 1); + me["HDG_one"].setFontSize(fontSizeHDG(me.leftText3), 1); + + show_hdg_act = show_hdg.getValue(); + hdg_diff_act = hdg_diff.getValue(); + if (show_hdg_act == 1 and hdg_diff_act >= -23.62 and hdg_diff_act <= 23.62) { + me["HDG_target"].setTranslation((hdg_diff_act / 10) * 98.5416, 0); + me["HDG_digit_L"].hide(); + me["HDG_digit_R"].hide(); + me["HDG_target"].show(); + } else if (show_hdg_act == 1 and hdg_diff_act < -23.62 and hdg_diff_act >= -180) { + me["HDG_digit_L"].setText(sprintf("%3.0f", ap_hdg.getValue())); + me["HDG_digit_L"].show(); + me["HDG_digit_R"].hide(); + me["HDG_target"].hide(); + } else if (show_hdg_act == 1 and hdg_diff_act > 23.62 and hdg_diff_act <= 180) { + me["HDG_digit_R"].setText(sprintf("%3.0f", ap_hdg.getValue())); + me["HDG_digit_R"].show(); + me["HDG_digit_L"].hide(); + me["HDG_target"].hide(); + } else { + me["HDG_digit_L"].hide(); + me["HDG_digit_R"].hide(); + me["HDG_target"].hide(); + } + + + 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_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(); + me["ILS_HDG_L"].hide(); + me["CRS_pointer"].show(); + } else if (magnetic_hdg_dif < -23.62 and magnetic_hdg_dif >= -180) { + if (int(magnetic_hdg) < 10) { + me["ILS_left"].setText(sprintf("00%1.0f", int(magnetic_hdg))); + } else if (int(magnetic_hdg) < 100) { + me["ILS_left"].setText(sprintf("0%2.0f", int(magnetic_hdg))); + } else { + me["ILS_left"].setText(sprintf("%3.0f", int(magnetic_hdg))); + } + me["ILS_HDG_L"].show(); + me["ILS_HDG_R"].hide(); + me["CRS_pointer"].hide(); + } else if (magnetic_hdg_dif > 23.62 and magnetic_hdg_dif <= 180) { + if (int(magnetic_hdg) < 10) { + me["ILS_right"].setText(sprintf("00%1.0f", int(magnetic_hdg))); + } else if (int(magnetic_hdg) < 100) { + me["ILS_right"].setText(sprintf("0%2.0f", int(magnetic_hdg))); + } else { + me["ILS_right"].setText(sprintf("%3.0f", int(magnetic_hdg))); + } + me["ILS_HDG_R"].show(); + me["ILS_HDG_L"].hide(); + me["CRS_pointer"].hide(); + } else { + me["ILS_HDG_R"].hide(); + me["ILS_HDG_L"].hide(); + me["CRS_pointer"].hide(); + } + } else { + me["ILS_HDG_R"].hide(); + me["ILS_HDG_L"].hide(); + me["CRS_pointer"].hide(); + } + + # AI HDG + me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, horizon_pitch.getValue() * 11.825); + me.AI_horizon_hdg_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); + me["AI_heading"].update(); + if (athr.getValue() == 1 and (state1_act == "TOGA" or state1_act == "MCT" or state1_act == "MAN THR" or state2_act == "TOGA" or state2_act == "MCT" or state2_act == "MAN THR") and eng_out.getValue() != 1 and alpha_floor_act != 1 and toga_lk_act != 1) { me["FMA_man"].show(); @@ -724,310 +1002,6 @@ var canvas_PFD_base = { } }, - updateCommonFast: func() { - # Attitude Indicator - pitch_cur = pitch.getValue(); - roll_cur = roll.getValue(); - - me.AI_horizon_trans.setTranslation(0, pitch_cur * 11.825); - me.AI_horizon_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); - me.AI_horizon_ground_trans.setTranslation(0, horizon_ground.getValue() * 11.825); - me.AI_horizon_ground_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); - me.AI_horizon_sky_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); - - me["AI_slipskid"].setTranslation(math.clamp(slip_skid.getValue(), -15, 15) * 7, 0); - me["AI_bank"].setRotation(-roll_cur * D2R); - - if (fbw_law.getValue() == 0) { - me["AI_bank_lim"].show(); - me["AI_pitch_lim"].show(); - me["AI_bank_lim_X"].hide(); - me["AI_pitch_lim_X"].hide(); - } else { - me["AI_bank_lim"].hide(); - me["AI_pitch_lim"].hide(); - me["AI_bank_lim_X"].show(); - me["AI_pitch_lim_X"].show(); - } - - fd_roll_cur = fd_roll.getValue(); - fd_pitch_cur = fd_pitch.getValue(); - if (fd_roll_cur != nil) { - me["FD_roll"].setTranslation((fd_roll_cur) * 2.2, 0); - } - if (fd_pitch_cur != nil) { - me["FD_pitch"].setTranslation(0, -(fd_pitch_cur) * 3.8); - } - - gear_agl_cur = gear_agl.getValue(); - - me["AI_agl"].setText(sprintf("%s", math.round(math.clamp(gear_agl_cur, 0, 2500)))); - - if (fmgc.FMGCInternal.phase < 3 or fmgc.flightPlanController.arrivalDist >= 250) { - me["FMA_dh_box"].hide(); - me["FMA_dh"].hide(); - me["FMA_dhn"].hide(); - me["FMA_nodh"].hide(); - #me["dhReached"].hide(); - if (gear_agl_cur <= 2500) { - me["AI_agl"].show(); - if (gear_agl_cur <= decision.getValue()) { - me["AI_agl"].setColor(0.7333,0.3803,0); - } else { - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } else { - me["AI_agl"].hide(); - } - } else { - if (gear_agl_cur <= 2500) { - me["AI_agl"].show(); - me["FMA_dh_box"].hide(); #not implemented - if (int(getprop("/FMGC/internal/radio")) != 99999) { - me["FMA_dh"].setText("RADIO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/radio"))); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - hundredAbove.setValue(getprop("/FMGC/internal/radio") + 100); - minimum.setValue(getprop("/FMGC/internal/radio")); - if (gear_agl_cur <= getprop("/FMGC/internal/radio") + 100) { - me["AI_agl"].setColor(0.7333,0.3803,0); - } else { - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } else if (int(getprop("/FMGC/internal/baro")) != 99999) { - me["FMA_dh"].setText("BARO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/baro"))); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - hundredAbove.setValue(getprop("/FMGC/internal/baro") + 100); - minimum.setValue(getprop("/FMGC/internal/baro")); - if (gear_agl_cur <= getprop("/FMGC/internal/baro") + 100) { - me["AI_agl"].setColor(0.7333,0.3803,0); - } else { - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } else if (fmgc.FMGCInternal.radioNo) { - me["FMA_dh"].setText("BARO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText("100"); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - hundredAbove.setValue(100); - minimum.setValue(0); - if (gear_agl_cur <= 100) { - me["AI_agl"].setColor(0.7333,0.3803,0); - } else { - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } else { - me["FMA_dh"].hide(); - me["FMA_dhn"].hide(); - me["FMA_nodh"].show(); - hundredAbove.setValue(400); - minimum.setValue(300); - if (gear_agl_cur <= 400) { - me["AI_agl"].setColor(0.7333,0.3803,0); - } else { - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } - } else { - me["AI_agl"].hide(); - me["FMA_nodh"].hide(); - me["FMA_dh_box"].hide(); #not implemented - if (int(getprop("/FMGC/internal/radio")) != 99999) { - me["FMA_dh"].setText("RADIO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/radio"))); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - } else if (int(getprop("/FMGC/internal/baro")) != 99999) { - me["FMA_dh"].setText("BARO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/baro"))); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - } else if (fmgc.FMGCInternal.radioNo) { - me["FMA_dh"].setText("BARO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText("100"); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - } else { - me["FMA_dh"].hide(); - me["FMA_dhn"].hide(); - me["FMA_nodh"].show(); - } - } - } - - me["AI_agl_g"].setRotation(-roll_cur * D2R); - - FMGCphase_act = fmgc.FMGCInternal.phase; - if ((wow1.getValue() == 1 or wow2.getValue() == 1) and FMGCphase_act != 0 and FMGCphase_act != 1) { - me["AI_stick"].show(); - me["AI_stick_pos"].show(); - - } else if ((wow1.getValue() == 1 or wow2.getValue() == 1) and (FMGCphase_act == 0 or FMGCphase_act == 1) and (eng0_state.getValue() == 3 or eng1_state.getValue() == 3)) { - me["AI_stick"].show(); - me["AI_stick_pos"].show(); - } else { - me["AI_stick"].hide(); - me["AI_stick_pos"].hide(); - } - - me["AI_stick_pos"].setTranslation(aileron_input.getValue() * 196.8, elevator_input.getValue() * 151.5); - - # Vertical Speed - me["VS_pointer"].setRotation(vs_needle.getValue() * D2R); - - me["VS_box"].setTranslation(0, vs_digit.getValue()); - - var vs_pfd_cur = ap_vs_pfd.getValue(); - if (vs_pfd_cur < 2) { - me["VS_box"].hide(); - } else { - me["VS_box"].show(); - } - - if (vs_pfd_cur < 10) { - me["VS_digit"].setText(sprintf("%02d", "0" ~ vs_pfd_cur)); - } else { - me["VS_digit"].setText(sprintf("%02d", vs_pfd_cur)); - } - - var vs_itaf = fmgc.Internal.vs.getValue(); - var gearAgl = gear_agl.getValue(); - - if (abs(vs_itaf) >= 6000 or (vs_itaf <= -2000 and gearAgl <= 2500) or (vs_itaf <= -1200 and gearAgl <= 1000)) { - me["VS_digit"].setColor(0.7333,0.3803,0); - me["VS_pointer"].setColor(0.7333,0.3803,0); - me["VS_pointer"].setColorFill(0.7333,0.3803,0); - } else { - me["VS_digit"].setColor(0.0509,0.7529,0.2941); - me["VS_pointer"].setColor(0.0509,0.7529,0.2941); - me["VS_pointer"].setColorFill(0.0509,0.7529,0.2941); - } - - # ILS - me["LOC_pointer"].setTranslation(loc.getValue() * 197, 0); - me["GS_pointer"].setTranslation(0, gs.getValue() * -197); - - # Heading - me.heading = hdg_scale.getValue(); - me.headOffset = me.heading / 10 - int(me.heading / 10); - me.middleText = roundabout(me.heading / 10); - me.middleOffset = nil; - if(me.middleText == 36) { - me.middleText = 0; - } - me.leftText1 = me.middleText == 0?35:me.middleText - 1; - me.rightText1 = me.middleText == 35?0:me.middleText + 1; - me.leftText2 = me.leftText1 == 0?35:me.leftText1 - 1; - me.rightText2 = me.rightText1 == 35?0:me.rightText1 + 1; - me.leftText3 = me.leftText2 == 0?35:me.leftText2 - 1; - me.rightText3 = me.rightText2 == 35?0:me.rightText2 + 1; - if (me.headOffset > 0.5) { - me.middleOffset = -(me.headOffset - 1) * 98.5416; - } else { - me.middleOffset = -me.headOffset * 98.5416; - } - me["HDG_scale"].setTranslation(me.middleOffset, 0); - me["HDG_scale"].update(); - me["HDG_four"].setText(sprintf("%d", me.middleText)); - me["HDG_five"].setText(sprintf("%d", me.rightText1)); - me["HDG_three"].setText(sprintf("%d", me.leftText1)); - me["HDG_six"].setText(sprintf("%d", me.rightText2)); - me["HDG_two"].setText(sprintf("%d", me.leftText2)); - me["HDG_seven"].setText(sprintf("%d", me.rightText3)); - me["HDG_one"].setText(sprintf("%d", me.leftText3)); - - me["HDG_four"].setFontSize(fontSizeHDG(me.middleText), 1); - me["HDG_five"].setFontSize(fontSizeHDG(me.rightText1), 1); - me["HDG_three"].setFontSize(fontSizeHDG(me.leftText1), 1); - me["HDG_six"].setFontSize(fontSizeHDG(me.rightText2), 1); - me["HDG_two"].setFontSize(fontSizeHDG(me.leftText2), 1); - me["HDG_seven"].setFontSize(fontSizeHDG(me.rightText3), 1); - me["HDG_one"].setFontSize(fontSizeHDG(me.leftText3), 1); - - show_hdg_act = show_hdg.getValue(); - hdg_diff_act = hdg_diff.getValue(); - if (show_hdg_act == 1 and hdg_diff_act >= -23.62 and hdg_diff_act <= 23.62) { - me["HDG_target"].setTranslation((hdg_diff_act / 10) * 98.5416, 0); - me["HDG_digit_L"].hide(); - me["HDG_digit_R"].hide(); - me["HDG_target"].show(); - } else if (show_hdg_act == 1 and hdg_diff_act < -23.62 and hdg_diff_act >= -180) { - me["HDG_digit_L"].setText(sprintf("%3.0f", ap_hdg.getValue())); - me["HDG_digit_L"].show(); - me["HDG_digit_R"].hide(); - me["HDG_target"].hide(); - } else if (show_hdg_act == 1 and hdg_diff_act > 23.62 and hdg_diff_act <= 180) { - me["HDG_digit_R"].setText(sprintf("%3.0f", ap_hdg.getValue())); - me["HDG_digit_R"].show(); - me["HDG_digit_L"].hide(); - me["HDG_target"].hide(); - } else { - me["HDG_digit_L"].hide(); - me["HDG_digit_R"].hide(); - me["HDG_target"].hide(); - } - - - 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_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(); - me["ILS_HDG_L"].hide(); - me["CRS_pointer"].show(); - } else if (magnetic_hdg_dif < -23.62 and magnetic_hdg_dif >= -180) { - if (int(magnetic_hdg) < 10) { - me["ILS_left"].setText(sprintf("00%1.0f", int(magnetic_hdg))); - } else if (int(magnetic_hdg) < 100) { - me["ILS_left"].setText(sprintf("0%2.0f", int(magnetic_hdg))); - } else { - me["ILS_left"].setText(sprintf("%3.0f", int(magnetic_hdg))); - } - me["ILS_HDG_L"].show(); - me["ILS_HDG_R"].hide(); - me["CRS_pointer"].hide(); - } else if (magnetic_hdg_dif > 23.62 and magnetic_hdg_dif <= 180) { - if (int(magnetic_hdg) < 10) { - me["ILS_right"].setText(sprintf("00%1.0f", int(magnetic_hdg))); - } else if (int(magnetic_hdg) < 100) { - me["ILS_right"].setText(sprintf("0%2.0f", int(magnetic_hdg))); - } else { - me["ILS_right"].setText(sprintf("%3.0f", int(magnetic_hdg))); - } - me["ILS_HDG_R"].show(); - me["ILS_HDG_L"].hide(); - me["CRS_pointer"].hide(); - } else { - me["ILS_HDG_R"].hide(); - me["ILS_HDG_L"].hide(); - me["CRS_pointer"].hide(); - } - } else { - me["ILS_HDG_R"].hide(); - me["ILS_HDG_L"].hide(); - me["CRS_pointer"].hide(); - } - - # AI HDG - me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, horizon_pitch.getValue() * 11.825); - 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() { @@ -1235,9 +1209,6 @@ var canvas_PFD_1 = { me["ilsError"].hide(); } - me.updateCommon(); - }, - updateFast: func() { # Airspeed # ind_spd = ind_spd_kt.getValue(); # Subtract 30, since the scale starts at 30, but don"t allow less than 0, or more than 420 situations @@ -1830,7 +1801,7 @@ var canvas_PFD_1 = { me["ALT_box"].hide(); } - me.updateCommonFast(); + me.updateCommon(); }, }; @@ -2010,9 +1981,6 @@ var canvas_PFD_2 = { me["ilsError"].hide(); } - me.updateCommon(); - }, - updateFast: func() { # Airspeed # ind_spd = ind_spd_kt.getValue(); # Subtract 30, since the scale starts at 30, but don"t allow less than 0, or more than 420 situations @@ -2605,7 +2573,7 @@ var canvas_PFD_2 = { me["ALT_box"].hide(); } - me.updateCommonFast(); + me.updateCommon(); }, }; @@ -2783,7 +2751,6 @@ setlistener("sim/signals/fdm-initialized", func { PFD_2_mismatch = canvas_PFD_2_mismatch.new(group_pfd2_mismatch, "Aircraft/A320-family/Models/Instruments/Common/res/mismatch.svg"); PFD_update.start(); - PFD_update_fast.start(); if (pfdrate.getValue() == 1) { rateApply(); @@ -2791,15 +2758,10 @@ setlistener("sim/signals/fdm-initialized", func { }); var rateApply = func { - PFD_update.restart(0.15 * pfdrate.getValue()); - PFD_update_fast.restart(0.05 * pfdrate.getValue()); + PFD_update.restart(0.05 * pfdrate.getValue()); } -var PFD_update = maketimer(0.15, func { - canvas_PFD_base.updateSlow(); -}); - -var PFD_update_fast = maketimer(0.05, func { +var PFD_update = maketimer(0.05, func { canvas_PFD_base.update(); }); From 62e3035ac1a6ccc90186b3806558f41877d28079 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 18 Jan 2021 20:02:24 +0000 Subject: [PATCH 32/38] APU: instant start up with panel states --- Nasal/Systems/APU.nas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nasal/Systems/APU.nas b/Nasal/Systems/APU.nas index 8f57a2df..829acc60 100644 --- a/Nasal/Systems/APU.nas +++ b/Nasal/Systems/APU.nas @@ -101,7 +101,7 @@ var APU = { me.inletFlap.open(); me.listenSignals = 1; settimer(func() { - if (APUNodes.Controls.master.getValue() and !getprop("/systems/acconfig/autoconfig-running")) { + if (APUNodes.Controls.master.getValue() and !pts.Acconfig.running.getValue()) { me.setState(2); } }, 3); @@ -131,7 +131,7 @@ var APU = { apuStartTimer.start(); }, waitStart: func() { - if (pts.APU.rpm.getValue() >= 4.9) { + if (pts.APU.rpm.getValue() >= 4.9 or me.fastStart) { me.GenericControls.cutoff.setValue(0); if (me.fastStart) { setprop("/fdm/jsbsim/propulsion/set-running", 2); From 988fab63d085f3c1e544484038ab13fb217faef0 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 19 Jan 2021 17:30:25 +0000 Subject: [PATCH 33/38] PFD: fix bug where it would desync RHS PFD --- Models/Instruments/PFD/PFD.nas | 5 +-- Nasal/Displays/DMC.nas | 13 +++--- Nasal/Libraries/libraries.nas | 21 ++++++++++ Systems/pfd.xml | 74 +++++++++++++++++++++++++++++++++- 4 files changed, 103 insertions(+), 10 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 40a5b38f..77c41c11 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -134,7 +134,6 @@ var adr_3_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr 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"); var heading = props.globals.initNode("/instrumentation/pfd/heading-deg", 0.0, "DOUBLE"); var horizon_pitch = props.globals.initNode("/instrumentation/pfd/horizon-pitch", 0.0, "DOUBLE"); var horizon_ground = props.globals.initNode("/instrumentation/pfd/horizon-ground", 0.0, "DOUBLE"); @@ -1690,7 +1689,7 @@ var canvas_PFD_1 = { me["ALT_tens"].setTranslation(0, altTens * 1.392); ap_alt_cur = ap_alt.getValue(); - alt_diff_cur = alt_diff.getValue(); + alt_diff_cur = dmc.DMController.DMCs[0].outputs[7].getValue(); if (alt_diff_cur >= -565 and alt_diff_cur <= 565) { me["ALT_target"].setTranslation(0, (alt_diff_cur / 100) * -48.66856); me["ALT_target_digit"].setText(sprintf("%03d", math.round(ap_alt_cur / 100))); @@ -2462,7 +2461,7 @@ var canvas_PFD_2 = { me["ALT_tens"].setTranslation(0, altTens * 1.392); ap_alt_cur = ap_alt.getValue(); - alt_diff_cur = alt_diff.getValue(); + alt_diff_cur = dmc.DMController.DMCs[1].outputs[7].getValue(); if (alt_diff_cur >= -565 and alt_diff_cur <= 565) { me["ALT_target"].setTranslation(0, (alt_diff_cur / 100) * -48.66856); me["ALT_target_digit"].setText(sprintf("%03d", math.round(ap_alt_cur / 100))); diff --git a/Nasal/Displays/DMC.nas b/Nasal/Displays/DMC.nas index 6b555bf9..efe94e5b 100644 --- a/Nasal/Displays/DMC.nas +++ b/Nasal/Displays/DMC.nas @@ -13,11 +13,12 @@ var DMC = { d.airspeeds = [props.globals.getNode("/systems/navigation/adr/output/cas-1", 1), props.globals.getNode("/systems/navigation/adr/output/cas-2", 1), props.globals.getNode("/systems/navigation/adr/output/cas-3", 1)]; d.altitudes = [props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-1-capt", 1), props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-2-capt", 1), props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-3-capt", 1)]; d.machs = [props.globals.getNode("/systems/navigation/adr/output/mach-1", 1), props.globals.getNode("/systems/navigation/adr/output/mach-2", 1), props.globals.getNode("/systems/navigation/adr/output/mach-3", 1)]; - d.altitudesPfd = [props.globals.getNode("instrumentation/altimeter[0]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[1]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[2]/indicated-altitude-ft-pfd", 1)]; + d.altitudesPfd = [props.globals.getNode("/instrumentation/altimeter[0]/indicated-altitude-ft-pfd", 1), props.globals.getNode("/instrumentation/altimeter[1]/indicated-altitude-ft-pfd", 1), props.globals.getNode("/instrumentation/altimeter[2]/indicated-altitude-ft-pfd", 1)]; d.sats = [props.globals.getNode("/systems/navigation/adr/output/sat-1", 1), props.globals.getNode("/systems/navigation/adr/output/sat-2", 1), props.globals.getNode("/systems/navigation/adr/output/sat-3", 1)]; d.tats = [props.globals.getNode("/systems/navigation/adr/output/tat-1", 1), props.globals.getNode("/systems/navigation/adr/output/tat-2", 1), props.globals.getNode("/systems/navigation/adr/output/tat-3", 1)]; - d.trends = [props.globals.getNode("instrumentation/pfd/speed-lookahead-1", 1), props.globals.getNode("instrumentation/pfd/speed-lookahead-2", 1), props.globals.getNode("instrumentation/pfd/speed-lookahead-3", 1)]; - d.outputs = [nil, nil, nil, nil, nil, nil, nil]; # airspeed, altitude, mach, pfd altitude, sat, tat, speed trend + d.trends = [props.globals.getNode("/instrumentation/pfd/speed-lookahead-1", 1), props.globals.getNode("/instrumentation/pfd/speed-lookahead-2", 1), props.globals.getNode("/instrumentation/pfd/speed-lookahead-3", 1)]; + d.altitudeDiffs = [props.globals.getNode("//instrumentation/pfd/alt-diff[0]", 1), props.globals.getNode("//instrumentation/pfd/alt-diff[1]", 1), props.globals.getNode("//instrumentation/pfd/alt-diff[2]", 1)]; + d.outputs = [nil, nil, nil, nil, nil, nil, nil, nil]; # airspeed, altitude, mach, pfd altitude, sat, tat, speed trend, altitudeDiffs return d; }, changeActiveADIRS: func(newADIRS) { @@ -32,6 +33,7 @@ var DMC = { me.outputs[4] = me.sats[ADIRS]; me.outputs[5] = me.tats[ADIRS]; me.outputs[6] = me.trends[ADIRS]; + me.outputs[7] = me.altitudeDiffs[ADIRS]; }, setOutputsNil: func() { me.outputs[0] = nil; @@ -41,6 +43,7 @@ var DMC = { me.outputs[4] = nil; me.outputs[5] = nil; me.outputs[6] = nil; + me.outputs[7] = nil; }, update: func() { if (systems.ADIRS.ADIRunits[me.activeADIRS].operative and systems.ADIRS.ADIRunits[me.activeADIRS].outputOn) { @@ -71,8 +74,8 @@ var DMController = { # update DMC2 to correct properties for first officer PFD me.DMCs[1].altitudes = [props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-1-fo", 1), props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-2-fo", 1), props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-3-fo", 1)]; - me.DMCs[1].altitudesPfd = [props.globals.getNode("instrumentation/altimeter[3]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[4]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[5]/indicated-altitude-ft-pfd", 1)]; - + me.DMCs[1].altitudesPfd = [props.globals.getNode("/instrumentation/altimeter[3]/indicated-altitude-ft-pfd", 1), props.globals.getNode("/instrumentation/altimeter[4]/indicated-altitude-ft-pfd", 1), props.globals.getNode("/instrumentation/altimeter[5]/indicated-altitude-ft-pfd", 1)]; + me.DMCs[1].altitudeDiffs = [props.globals.getNode("//instrumentation/pfd/alt-diff[3]", 1), props.globals.getNode("//instrumentation/pfd/alt-diff[4]", 1), props.globals.getNode("//instrumentation/pfd/alt-diff[5]", 1)]; me._init = 1; } }, diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index 190b6911..c5b05971 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -383,4 +383,25 @@ foreach (var name; keys(input)) { emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Libraries", name, input[name])); } +# TODO split EFIS altimeters +var newinhg = nil; +setlistener("/instrumentation/altimeter/setting-inhg", func() { + newinhg = getprop("/instrumentation/altimeter/setting-inhg"); + setprop("/instrumentation/altimeter[1]/setting-inhg", newinhg); + setprop("/instrumentation/altimeter[2]/setting-inhg", newinhg); + setprop("/instrumentation/altimeter[3]/setting-inhg", newinhg); + setprop("/instrumentation/altimeter[4]/setting-inhg", newinhg); + setprop("/instrumentation/altimeter[5]/setting-inhg", newinhg); +}, 0, 0); + +var newhpa = nil; +setlistener("/instrumentation/altimeter/setting-hpa", func() { + newhpa = getprop("/instrumentation/altimeter/setting-hpa"); + setprop("/instrumentation/altimeter[1]/setting-hpa", newhpa); + setprop("/instrumentation/altimeter[2]/setting-hpa", newhpa); + setprop("/instrumentation/altimeter[3]/setting-hpa", newhpa); + setprop("/instrumentation/altimeter[4]/setting-hpa", newhpa); + setprop("/instrumentation/altimeter[5]/setting-hpa", newhpa); +}, 0, 0); + setprop("/systems/acconfig/libraries-loaded", 1); diff --git a/Systems/pfd.xml b/Systems/pfd.xml index c3749535..733054dc 100644 --- a/Systems/pfd.xml +++ b/Systems/pfd.xml @@ -136,9 +136,79 @@ /it-autoflight/internal/alt - /instrumentation/altimeter/indicated-altitude-ft + /instrumentation/altimeter[0]/indicated-altitude-ft - /instrumentation/pfd/alt-diff + /instrumentation/pfd/alt-diff[0] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[1]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[1] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[2]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[2] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[3]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[3] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[4]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[4] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[5]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[5] From 3f61a67313cb265df8d4f88ca85115f2129c143b Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 20 Jan 2021 10:29:23 +0000 Subject: [PATCH 34/38] Bugfix to braking sound by inuyaksa --- Sounds/A320-common-sound.xml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml index 26000189..40db7e4e 100644 --- a/Sounds/A320-common-sound.xml +++ b/Sounds/A320-common-sound.xml @@ -2137,14 +2137,26 @@ - - /fdm/jsbsim/fcs/left-brake-cmd-norm - 0.95 - - - /fdm/jsbsim/fcs/right-brake-cmd-norm - 0.95 - + + + /fdm/jsbsim/fcs/left-brake-cmd-norm + 0.95 + + + /gear/gear[1]/wow + 1 + + + + + /fdm/jsbsim/fcs/right-brake-cmd-norm + 0.95 + + + /gear/gear[2]/wow + 1 + + /velocities/groundspeed-kt From fd3010f82fd2525526752e68a50585a7e781e9ce Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 20 Jan 2021 14:51:36 +0000 Subject: [PATCH 35/38] Bugfix: fix the ATIS API references --- Nasal/FMGC/mcdu-messages.nas | 2 +- Nasal/Systems/Comm/Notification.nas | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index 3c036d2c..b3274ff5 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -180,7 +180,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"), + TypeIMessage.new("NO ANSWER TO REQUEST"),TypeIMessage.new("NO D-ATIS AVAILABLE"),TypeIMessage.new("NO METAR AVAILABLE"),TypeIMessage.new("BAD SERVER RESPONSE"), TypeIMessage.new("WIND DATA UPLINK"),TypeIMessage.new("CHECK ALT WIND"),TypeIMessage.new("INVALID WIND UPLINK"),TypeIMessage.new("WIND UPLINK EXISTS"), #p.533 TypeIMessage.new("FM DATALINK UNAVAIL"),TypeIMessage.new("NOT XMITTED TO ACARS"), #p.559 TypeIMessage.new("PRINTER NOT AVAILABLE"), diff --git a/Nasal/Systems/Comm/Notification.nas b/Nasal/Systems/Comm/Notification.nas index 408f2be1..5d01f494 100644 --- a/Nasal/Systems/Comm/Notification.nas +++ b/Nasal/Systems/Comm/Notification.nas @@ -168,12 +168,12 @@ var AOC = { var serverString = ""; if (me.server.getValue() == "vatsim") { - serverString = "https://api.flybywiresim.com/metar?source=vatsim&icao="; + serverString = "https://api.flybywiresim.com/metar/" ~ airport ~ "?source=vatsim"; } else { - serverString = defaultServer; + serverString = defaultServer ~ airport; } - http.load(serverString ~ airport) + http.load(serverString) .fail(func(r) me.downloadFail(i, r)) .done(func(r) { var errs = []; @@ -212,7 +212,23 @@ var AOC = { }, processMETAR: func(r, i) { var raw = r.response; + if (find('"statusCode":404',raw) != -1) { + me.received = 0; + me.sent = 0; + mcdu.mcdu_message(i, "NO METAR AVAILABLE"); + return; + } + if (me.server.getValue() == "vatsim") { + if (find("metar", raw) != -1) { + raw = split('"metar":"', raw)[1]; + raw = split('","source":"Vatsim"}', raw)[0]; + } else { + me.received = 0; + me.sent = 0; + mcdu.mcdu_message(i, "BAD SERVER RESPONSE"); + return; + } me.lastMETAR = raw; } else if (find("", raw) != -1) { raw = split("", raw)[1]; @@ -330,7 +346,7 @@ var ATIS = { }, processATIS: func(r, i) { var raw = r.response; - if (r.response == "FBW_ERROR: D-ATIS not available at this airport" or find("atis not avail",r.response) != -1 or find('"statusCode":404',r.response) != -1) { + if (raw == "FBW_ERROR: D-ATIS not available at this airport" or find("atis not avail",raw) != -1 or find('"statusCode":404',raw) != -1) { me.received = 0; me.sent = 0; mcdu.mcdu_message(i,"NO D-ATIS AVAILABLE"); From da6562bc8a26026e9cc9c85588d7284540ea0175 Mon Sep 17 00:00:00 2001 From: Inuyaksa Date: Wed, 20 Jan 2021 20:32:21 +0100 Subject: [PATCH 36/38] preflight --- Models/Instruments/MCDU/MCDU.nas | 120 +++++++++++++++-------- Models/Instruments/MCDU/res/mcdu.svg | 141 +++++++++++++++------------ Nasal/FMGC/FMGC.nas | 12 ++- Nasal/FMGC/SimbriefParser.nas | 31 +++++- Nasal/MCDU/FLIGHTLOG.nas | 44 +++++++-- Nasal/MCDU/INITA.nas | 2 +- Nasal/MCDU/MCDU.nas | 8 +- Nasal/MCDU/ROUTESELECTION.nas | 15 +++ Sounds/A320-common-sound.xml | 40 ++++++-- 9 files changed, 285 insertions(+), 128 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 71b97409..a54eb8d9 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -231,7 +231,7 @@ var canvas_MCDU_base = { return me; }, getKeys: func() { - return ["Simple","Simple_Center","Scratchpad","Simple_Title","Simple_PageNum","ArrowLeft","ArrowRight","Simple_L1","Simple_L2","Simple_L3","Simple_L4", + return ["Simple","Simple_Center","Scratchpad","Simple_Title","Simple_Title2","Simple_PageNum","ArrowLeft","ArrowRight","Simple_L1","Simple_L2","Simple_L3","Simple_L4", "Simple_L5","Simple_L6","Simple_L0S","Simple_L1S","Simple_L2S","Simple_L3S","Simple_L4S","Simple_L5S","Simple_L6S","Simple_L1_Arrow", "Simple_L2_Arrow","Simple_L3_Arrow","Simple_L4_Arrow","Simple_L5_Arrow","Simple_L6_Arrow","Simple_R1","Simple_R2","Simple_R3","Simple_R4","Simple_R5", "Simple_R6","Simple_R1S","Simple_R2S","Simple_R3S","Simple_R4S","Simple_R5S","Simple_R6S","Simple_R1_Arrow","Simple_R2_Arrow","Simple_R3_Arrow", @@ -262,6 +262,7 @@ var canvas_MCDU_base = { defaultHide: func() { me["Simple"].show(); me["Simple_Center"].hide(); + me["Simple_Title2"].hide(); me["FPLN"].hide(); me["DIRTO_TMPY_group"].hide(); me["INITA"].hide(); @@ -279,6 +280,7 @@ var canvas_MCDU_base = { defaultHideWithCenter: func() { me["Simple"].show(); me["Simple_Center"].show(); + me["Simple_Title2"].hide(); me["FPLN"].hide(); me["DIRTO_TMPY_group"].hide(); me["INITA"].hide(); @@ -343,7 +345,9 @@ var canvas_MCDU_base = { me.fontRight(default, default, default, default, default, default); me.fontRightS(default, default, default, default, default, default); me.fontSizeLeft(normal, normal, normal, normal, normal, normal); + me.fontSizeLeftS(small, small, small, small, small, small); me.fontSizeRight(normal, normal, normal, normal, normal, normal); + me.fontSizeRightS(small, small, small, small, small, small); }, standardFontColour: func() { me.colorLeft("wht", "wht", "wht", "wht", "wht", "wht"); @@ -387,6 +391,9 @@ var canvas_MCDU_base = { me["PRINTPAGE"].setColor(WHITE); } } + + if (!pageSwitch[i].getBoolValue()) me.defaultHide(); + if (page != "ATIS") { me["ATISSend1"].hide(); me["ATISSend2"].hide(); @@ -620,7 +627,7 @@ var canvas_MCDU_base = { } } else if (page == "FLTLOG") { if (!pageSwitch[i].getBoolValue()) { - me.defaultHideWithCenter(); + me.defaultHideWithCenter(); me["Simple_L0S"].hide(); me["ArrowLeft"].hide(); @@ -718,7 +725,7 @@ var canvas_MCDU_base = { var logpage = mcdu.FlightLogDatabase.getPage(logid); - me["Simple_L1"].setText(sprintf("%8s - ",logpage.fltnum) ~ logpage.date); + me["Simple_L1"].setText(sprintf("%8s- ",logpage.fltnum) ~ logpage.date); me["Simple_R1"].setText(logpage.tofrom ~ " "); me["Simple_L5S"].setText( " " ~ logpage.flttime ); @@ -735,6 +742,7 @@ var canvas_MCDU_base = { } else if (page == "SENSORS") { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); + me.standardFontSize(); me["Simple_Title"].setText("SENSORS "); me.defaultPageNumbers(); me["Simple_L0S"].hide(); @@ -2769,37 +2777,65 @@ var canvas_MCDU_base = { } else if (page == "ROUTESELECTION") { if (!pageSwitch[i].getBoolValue()) { - me.defaultHideWithCenter(); + me.defaultHide(); + me.standardFontSize(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("ROUTE SELECTION"); - me.defaultPageNumbers(); + me.showPageNumbers(1,1); - me.showLeft(1, -1, -1, -1, -1, 1); + me.showLeft(1, 1, 1, 1, 1, 1); me["Simple_L0S"].hide(); - me.showLeftS(-1, -1, -1, -1, -1, -1); + me.showLeftS(-1, 1, 1, 1, 1, -1); 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.showRight(-1, 1, 1, 1, 1, 1); + me.showRightS(-1, 1, 1, 1, 1, -1); me.showRightArrow(-1, -1, -1, -1, -1, -1); - me.showCenter(-1, -1, -1, -1, -1, -1); - me["Simple_C3B"].hide(); - me["Simple_C4B"].hide(); - me.showCenterS(-1, -1, -1, -1, -1, -1); + #me.showCenter(-1, -1, 1, -1, -1, -1); + #me.showCenterS(-1, -1, 1, -1, -1, -1); + #me["Simple_C3B"].hide(); + #me["Simple_C4B"].hide(); - me.fontLeft(default, 0, 0, 0, 0, default); - - me.fontSizeLeft(normal, 0, 0, 0, 0, normal); - - me.colorLeft("grn", "ack", "ack", "ack", "ack", "wht"); + #me.fontLeft(default, default, default, default, default, default); + #me.fontLeftS(default, default, default, default, default, default); + #me.fontSizeLeft(normal, normal, normal, normal, normal, normal); + me.fontSizeLeftS(normal, normal, normal, normal, normal, normal); + #me.fontRight(default, default, default, default, default, default); + #me.fontRightS(default, default, default, default, default, default); + me.fontSizeRight(0, small, small, small, small, normal); + me.fontSizeRightS(0, small, small, small, small, normal); + me.colorLeft("grn", "grn", "grn", "grn", "grn", "wht"); + me.colorLeftS("grn", "grn", "grn", "grn", "grn", "wht"); + #me.colorCenter("grn", "ack", "amb", "ack", "ack", "wht"); + me.colorRight("ack", "wht", "wht", "wht", "wht", "amb"); + me.colorRightS("ack", "wht", "wht", "wht", "wht", "wht"); + pageSwitch[i].setBoolValue(1); } me["Simple_L1"].setText("NONE"); me["Simple_L6"].setText(" RETURN"); + me["Simple_R6"].setText("INSERT "); + me["PRINTPAGE"].show(); + me["PRINTPAGE"].setColor(AMBER); + + var rows = ["2S","2","3S","3","4S","4","5S","5"]; + + me["Simple_L1"].setText("DUBLHR1"); + + var r = 0; + for ( ; r < 8; r += 1) { + me["Simple_L" ~ rows[r]].setText(sprintf("%11s %11s","SELKA","NUGRA")); + me["Simple_R" ~ rows[r]].setText(sprintf("%-13s %-13s","UL975","UL975")); + } + while (r<8) { + me["Simple_L" ~ rows[r]].setText(""); + me["Simple_R" ~ rows[r]].setText(""); + r+=1; + } if (fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.altSelected) { me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.depApt ~ "/" ~ fmgc.FMGCInternal.arrApt)); @@ -3551,8 +3587,11 @@ var canvas_MCDU_base = { me["Simple_L6"].setFontSize(small); } - } else if (page == "PROGTO" or page == "PROGCLB" or page == "PROGCRZ" or page == "PROGDES") { - if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { + } else if (page == "PROGPREF" or page == "PROGTO" or page == "PROGCLB" or page == "PROGCRZ" or page == "PROGDES") { + if (fmgc.FMGCInternal.phase == 0) { + setprop("/MCDU[" ~ i ~ "]/page", "PROGPREF"); + page = "PROGPREF"; + } else if (fmgc.FMGCInternal.phase == 1) { setprop("/MCDU[" ~ i ~ "]/page", "PROGTO"); page = "PROGTO"; } else if (fmgc.FMGCInternal.phase == 2) { @@ -3582,30 +3621,29 @@ var canvas_MCDU_base = { me["PERFAPPR"].hide(); me["PERFGA"].hide(); - if (fmgc.FMGCInternal.flightNumSet) { - if (page == "PROGTO") { - me["Simple_Title"].setText(sprintf("TAKE OFF %s", fmgc.FMGCInternal.flightNum)); - } else if (page == "PROGCLB") { - me["Simple_Title"].setText(sprintf("CLIMB %s", fmgc.FMGCInternal.flightNum)); - } else if (page == "PROGCRZ") { - me["Simple_Title"].setText(sprintf("CRUISE %s", fmgc.FMGCInternal.flightNum)); - } else if (page == "PROGDES") { - me["Simple_Title"].setText(sprintf("DESCENT %s", fmgc.FMGCInternal.flightNum)); - } - } else { - if (page == "PROGTO") { - me["Simple_Title"].setText("TAKE OFF"); - } else if (page == "PROGCLB") { - me["Simple_Title"].setText("CLIMB"); - } else if (page == "PROGCRZ") { - me["Simple_Title"].setText("CRUISE"); - } else if (page == "PROGDES") { - me["Simple_Title"].setText("DESCENT"); - } + var colortext = ["",""]; + + if (page == "PROGPREF") { + colortext[0] = "PREFLIGHT"; + } else if (page == "PROGTO") { + colortext[0] = "TAKE OFF"; + } else if (page == "PROGCLB") { + colortext[0] = "CLIMB"; + } else if (page == "PROGCRZ") { + colortext[0] = "CRUISE"; + } else if (page == "PROGDES") { + colortext[0] = "DESCENT"; } + + colortext[1] = (fmgc.FMGCInternal.flightNumSet) ? fmgc.FMGCInternal.flightNum ~ " " : ""; # push title a little left + + me["Simple_Title"].setText(colortext[0] ~ sprintf("%" ~ (size(colortext[1])+1) ~ "s"," ")); + me["Simple_Title2"].setText(sprintf("%" ~ (size(colortext[0])+1) ~ "s"," ") ~ colortext[1]); me["Simple_Title"].show(); me["Simple_Title"].setColor(GREEN); + me["Simple_Title2"].show(); + me["Simple_Title2"].setColor(WHITE); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].hide(); @@ -3644,6 +3682,8 @@ var canvas_MCDU_base = { me.fontSizeCenter(small, small, small, small, small, normal); me.fontSizeCenterS(normal, small, small, small, small, small); + me["Simple_C1S"].setFontSize(small); + me.colorLeft("blu", "wht", "blu", "wht", "wht", "blu"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg index 9eb38288..ecda2737 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="0.92.4 (5da689c313, 2019-01-14)" + inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)" sodipodi:docname="mcdu.svg"> @@ -37,17 +37,17 @@ guidetolerance="20" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1366" - inkscape:window-height="705" + inkscape:window-width="1920" + inkscape:window-height="1017" id="namedview371" showgrid="true" - inkscape:zoom="3.1578866" - inkscape:cx="1122.1906" - inkscape:cy="986.92422" + inkscape:zoom="0.55824076" + inkscape:cx="608.20261" + inkscape:cy="690.7315" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" - inkscape:current-layer="svg2" + inkscape:current-layer="Simple" showguides="false" inkscape:snap-global="false" units="px" @@ -306,6 +306,19 @@ y="539.16522" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke-width:1px">TEXT + TITLE + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -1103,7 +1116,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.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -1235,7 +1248,7 @@ inkscape:label="arrow5L" id="arrow5L"> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -2617,7 +2630,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.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.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.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">= @@ -3019,9 +3032,9 @@ inkscape:connector-curvature="0" id="path1273" 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" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> 0 and getprop("/FMGC/flightplan[2]/active") == 1 and flightPlanController.arrivalDist <= 15 and (modelat == "NAV" or modelat == "LOC" or modelat == "LOC*") and pts.Position.gearAglFt.getValue() < 9500) { #todo decel pseudo waypoint setprop("/FMGC/internal/decel", 1); diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 1dc01602..541236bf 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -1,6 +1,6 @@ # A3XX Simbrief Parser # Copyright (c) 2020 Jonathan Redpath (legoboyvdlp) -# enhanceded 12/2020 - parse TOD & TOC psedo waypoints, set computer speeds on fix wps, fake coRoute name +# enhanced 12/2020 - parse TOD & TOC psedo waypoints, set computer speeds on fix wps, fake coRoute name var LBS2KGS = 0.4535924; @@ -14,7 +14,7 @@ var SimbriefParser = { me.inhibit = 1; 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)) + .fail(func { me.failure(i) }) .done(func { var errs = []; call(me.read, [(getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml"),i], SimbriefParser, {}, errs); @@ -49,6 +49,33 @@ var SimbriefParser = { me.failure(i); } }, + checkValid: func(xml) { + var data = io.readxml(xml); + if (data != nil) { + return (data.getChild("OFP") != nil); + } + return false; + }, + readLegs: func(xml) { # lite OFP parser only for legs = wapoinst + airways + var legs = []; + var data = io.readxml(xml); + if (data != nil) { + var ofp = data.getChild("OFP"); + if (ofp != nil) { + var ofpNavlog = ofp.getNode("navlog"); + var ofpFixes = ofpNavlog.getChildren("fix"); + var ident = ""; + foreach (var ofpFix; ofpFixes) { + if (ofpFix.getNode("is_sid_star").getBoolValue()) continue; + ident = ofpFix.getNode("ident").getValue(); + if (ident == "TOC" or ident == "TOD") continue; + append(legs, [ ofpFix.getNode("ident").getValue() , ofpFix.getNode("via_airway").getValue() ] ); + } + return legs; + } + } + return nil; + }, tryFindByCoord: func(coords, id, type) { var result = nil; if (type == "nav") { diff --git a/Nasal/MCDU/FLIGHTLOG.nas b/Nasal/MCDU/FLIGHTLOG.nas index d2127c8a..818dac51 100644 --- a/Nasal/MCDU/FLIGHTLOG.nas +++ b/Nasal/MCDU/FLIGHTLOG.nas @@ -2,12 +2,17 @@ # Basic OOOI system implementation var OOOIReport = { - new: func(state,fob="",time="") { + new: func(state,time=0,fob="") { var report = {parents:[OOOIReport]}; report.state = state; report.fob = (fob != "") ? fob : fmgc.FMGCInternal.fob; - report.time = (time != "") ? time : sprintf("%02d.%02d", getprop("/sim/time/utc/hour"), getprop("/sim/time/utc/minute")); - report.elapsed = int(getprop("/sim/time/elapsed-sec")); + if (time != 0) { + report.time = formatSecToHHMM(time); + report.elapsed = time; + } else { + report.time = sprintf("%02d.%02d", getprop("/sim/time/utc/hour"), getprop("/sim/time/utc/minute")); + report.elapsed = int(getprop("/sim/time/elapsed-sec")); + } report.gmt = getprop("/sim/time/gmt-string"); report.date = getprop("/sim/time/utc/day"); report.fltnum = (fmgc.FMGCInternal.flightNumSet == 1) ? fmgc.FMGCInternal.flightNum : "----"; @@ -47,8 +52,10 @@ var FlightLogDatabase = { if (report.state == 0 or me.getPageSize()==0) me.addPage(); me.database.append(report); var pg = me.pages.vector[me.pages.size()-1]; - pg.fltnum = report.fltnum; - pg.tofrom = report.tofrom; + if (report.state < 3) { # IN states (3/4) don't update page data + if (report.fltnum != "") pg.fltnum = report.fltnum; + if (report.tofrom != "") pg.tofrom = report.tofrom; + } if (report.state == 0) { pg.fltstate = "OUT"; pg.blkstart = report.elapsed; @@ -67,7 +74,8 @@ var FlightLogDatabase = { } }, reset: func() { - if (me.getPageSize()>0 and me.currpageindex < me.getSize()) me.addPage(); + #Actually reset occurs before IN state - I have no solution for this + #if (me.getPageSize()>0 and me.currpageindex < me.getSize()) me.addPage(); }, getSize: func() { return me.database.size(); @@ -118,7 +126,11 @@ var doorR1_pos = props.globals.getNode("/sim/model/door-positions/doorr1/positio var doorL4_pos = props.globals.getNode("/sim/model/door-positions/doorl4/position-norm", 1); var doorR4_pos = props.globals.getNode("/sim/model/door-positions/doorr4/position-norm", 1); -#check for A/C state change - advice me for a better method, please :/ +# Detect OFF without IN +var lastgs0 = 0; +var lastgsrestart = 0; + +# Check for A/C state change - advice me for a better method, please :/ var waitingOOOIChange = maketimer(1, func(){ # 1sec precision var phase = fmgc.FMGCInternal.phase; @@ -129,9 +141,10 @@ var waitingOOOIChange = maketimer(1, func(){ # 1sec precision if (expectedOOOIState == 0) { # OUT if (gear0 and phase == 0) { - if (gs>9) { # imho - it's useful few speed tollerance, 10kts min speed on taxiways - CHECKME - better with pushback detection? + if (gs > 9) { # imho - it's useful few speed tollerance, 10kts min speed on taxiways - CHECKME - better with pushback detection? FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); expectedOOOIState = 1; + lastgear0 = 0; } } } else if (expectedOOOIState == 1) { # OFF @@ -149,14 +162,29 @@ var waitingOOOIChange = maketimer(1, func(){ # 1sec precision if (gear0 and (phase == 7 or phase == 0)) { #done or preflight FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); expectedOOOIState = 3; + lastgear0 = 0; + lastgsrestart = 0; } } else if (expectedOOOIState == 3) { # IN if (gear0 and gs < 1) { + if (lastgs0 == 0) { + lastgs0 = int(getprop("/sim/time/elapsed-sec")); + lastgsrestart = 0; + } if (doorL1_pos.getValue()>0 or doorR1_pos.getValue()>0 or doorL4_pos.getValue()>0 or doorR4_pos.getValue()>0) { FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); expectedOOOIState = 0; } } + else if (!gear0) { # OFF without IN -> To without stop and opening doors + if (lastgear0) FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState,lastgear0)); # IN (estimated) + FlightLogDatabase.addPage(); + if (lastgsrestart) FlightLogDatabase.addReport(OOOIReport.new(0,lastgsrestart)); # OUT (estimated) + expectedOOOIState = 1; # watch for OFF state + } + else if (gs > 9 and lastgsrestart == 0) { # try to decect OFF without IN + lastgsrestart = int(getprop("/sim/time/elapsed-sec")); + } } }); diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 00e02637..e96f0df2 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -242,7 +242,7 @@ var initInputA = func(key, i) { #} else if (scratchpad == "") { #fmgc.FMGCInternal.altSelected = 0; #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); - } else { + } else { if (!fmgc.flightPlanController.temporaryFlag[i]) { var tfs = size(scratchpad); if (tfs == 9 and find("/", scratchpad) != -1) { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 81a8b18d..d1fd839d 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -237,6 +237,8 @@ var lskbutton = func(btn, i) { canvas_mcdu.myCRZWIND[i].pushButtonLeft(1); } else if (page == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonLeft(1); + } else if (page == "PROGPREF") { + progTOInput("L1",i); # same fn as TO } else if (page == "PROGTO") { progTOInput("L1",i); } else if (page == "PROGCLB") { @@ -1413,14 +1415,16 @@ var pagebutton = func(btn, i) { # A more flexible system/page tracking for future system expansion if (getprop("/MCDU[" ~ i ~ "]/active-system") == "fmgc") setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", page); - else setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page); + else if (getprop("/MCDU[" ~ i ~ "]/active-system") == "atsu") setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page); if (btn == "atc") setprop("/MCDU[" ~ i ~ "]/active-system","atsu"); else setprop("/MCDU[" ~ i ~ "]/active-system","fmgc"); if (btn == "radnav") { pageNode[i].setValue("RADNAV"); } else if (btn == "prog") { - if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { + if (fmgc.FMGCInternal.phase == 0) { + pageNode[i].setValue("PROGPREF"); + } else if (fmgc.FMGCInternal.phase == 1) { pageNode[i].setValue("PROGTO"); } else if (fmgc.FMGCInternal.phase == 2) { pageNode[i].setValue("PROGCLB"); diff --git a/Nasal/MCDU/ROUTESELECTION.nas b/Nasal/MCDU/ROUTESELECTION.nas index 85d1b464..d1b03bff 100644 --- a/Nasal/MCDU/ROUTESELECTION.nas +++ b/Nasal/MCDU/ROUTESELECTION.nas @@ -1,7 +1,22 @@ # Copyright (c) 2020 Matthew Maring (mattmaring) +# enhanced inuyaksa*2021 var initInputROUTESEL = func(key, i) { if (key == "L6") { setprop("MCDU[" ~ i ~ "]/page", "INITA"); } } + +var RouteSelManager = { + + leglist: nil, + + loadFlightplan: func(path) { + if (right(path,4) == ".xml") { # plan from SimBrief? + if (SimBrief.isValid(path)) { + leglist = SimBrief.readLegs(path); + } + } + } + +} \ No newline at end of file diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml index 26000189..7029c503 100644 --- a/Sounds/A320-common-sound.xml +++ b/Sounds/A320-common-sound.xml @@ -2137,14 +2137,38 @@ - - /fdm/jsbsim/fcs/left-brake-cmd-norm - 0.95 - - - /fdm/jsbsim/fcs/right-brake-cmd-norm - 0.95 - + + + /fdm/jsbsim/fcs/left-brake-cmd-norm + 0.95 + + + + /gear/gear[0]/wow + 1 + + + /gear/gear[1]/wow + 1 + + + + + + /fdm/jsbsim/fcs/right-brake-cmd-norm + 0.95 + + + + /gear/gear[0]/wow + 1 + + + /gear/gear[2]/wow + 1 + + + /velocities/groundspeed-kt From 9b9dc79026e9f52a305bd6be0ed7d63140826774 Mon Sep 17 00:00:00 2001 From: Inuyaksa Date: Wed, 20 Jan 2021 21:25:37 +0100 Subject: [PATCH 37/38] cleaning the code --- Models/Instruments/MCDU/MCDU.nas | 75 ++++++++++++++------------------ Nasal/FMGC/SimbriefParser.nas | 4 +- Nasal/MCDU/FLIGHTLOG.nas | 6 +-- Nasal/MCDU/ROUTESELECTION.nas | 15 ------- 4 files changed, 38 insertions(+), 62 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index a54eb8d9..0419aeeb 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -2793,60 +2793,49 @@ var canvas_MCDU_base = { 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.showCenter(-1, -1, 1, -1, -1, -1); - #me.showCenterS(-1, -1, 1, -1, -1, -1); - #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.fontSizeLeft(normal, normal, normal, normal, normal, normal); me.fontSizeLeftS(normal, normal, normal, normal, normal, normal); - #me.fontRight(default, default, default, default, default, default); - #me.fontRightS(default, default, default, default, default, default); me.fontSizeRight(0, small, small, small, small, normal); me.fontSizeRightS(0, small, small, small, small, normal); me.colorLeft("grn", "grn", "grn", "grn", "grn", "wht"); me.colorLeftS("grn", "grn", "grn", "grn", "grn", "wht"); - #me.colorCenter("grn", "ack", "amb", "ack", "ack", "wht"); me.colorRight("ack", "wht", "wht", "wht", "wht", "amb"); me.colorRightS("ack", "wht", "wht", "wht", "wht", "wht"); - pageSwitch[i].setBoolValue(1); + me["Simple_L1"].setText("NONE"); + me["Simple_L6"].setText(" RETURN"); + me["Simple_R6"].setText("INSERT "); + me["PRINTPAGE"].show(); + me["PRINTPAGE"].setColor(AMBER); + + var rows = ["2S","2","3S","3","4S","4","5S","5"]; + + me["Simple_L1"].setText("DUBLHR1"); + + var r = 0; + #for ( ; r < 8; r += 1) { # Example how formats rows with 4 cols + # me["Simple_L" ~ rows[r]].setText(sprintf("%11s %11s","SELKA","NUGRA")); + # me["Simple_R" ~ rows[r]].setText(sprintf("%-13s %-13s","UL975","UL975")); + #} + while (r<8) { + me["Simple_L" ~ rows[r]].setText(""); + me["Simple_R" ~ rows[r]].setText(""); + r+=1; + } + + if (fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.altSelected) { + me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.depApt ~ "/" ~ fmgc.FMGCInternal.arrApt)); + } else if (!fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) { + me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.altAirport)); + } else if (fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) { + me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.arrApt ~ "/" ~ fmgc.FMGCInternal.altAirport)); + } else { + me["Simple_Title"].setText("ROUTE SELECTION"); + } + + pageSwitch[i].setBoolValue(1); # update on request only (left/right arrows) } - me["Simple_L1"].setText("NONE"); - me["Simple_L6"].setText(" RETURN"); - me["Simple_R6"].setText("INSERT "); - me["PRINTPAGE"].show(); - me["PRINTPAGE"].setColor(AMBER); - - var rows = ["2S","2","3S","3","4S","4","5S","5"]; - - me["Simple_L1"].setText("DUBLHR1"); - - var r = 0; - for ( ; r < 8; r += 1) { - me["Simple_L" ~ rows[r]].setText(sprintf("%11s %11s","SELKA","NUGRA")); - me["Simple_R" ~ rows[r]].setText(sprintf("%-13s %-13s","UL975","UL975")); - } - while (r<8) { - me["Simple_L" ~ rows[r]].setText(""); - me["Simple_R" ~ rows[r]].setText(""); - r+=1; - } - - if (fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.altSelected) { - me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.depApt ~ "/" ~ fmgc.FMGCInternal.arrApt)); - } else if (!fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) { - me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.altAirport)); - } else if (fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) { - me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.arrApt ~ "/" ~ fmgc.FMGCInternal.altAirport)); - } else { - me["Simple_Title"].setText("ROUTE SELECTION"); - } - } else if (page == "INITB") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 541236bf..087c1f44 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -49,7 +49,7 @@ var SimbriefParser = { me.failure(i); } }, - checkValid: func(xml) { + validateFile: func(xml) { var data = io.readxml(xml); if (data != nil) { return (data.getChild("OFP") != nil); @@ -188,6 +188,7 @@ var SimbriefParser = { #setprop("/autopilot/route-manager/vnav/tc/latitude-deg",ofpFix.getNode("pos_lat").getValue()); #setprop("/autopilot/route-manager/vnav/tc/longitude-deg",ofpFix.getNode("pos_long").getValue()); #ident = "(T/C)"; + continue; # restore skip TOC/TOD } if (ident == "TOD") { @@ -195,6 +196,7 @@ var SimbriefParser = { #setprop("/autopilot/route-manager/vnav/td/latitude-deg",ofpFix.getNode("pos_lat").getValue()); #setprop("/autopilot/route-manager/vnav/td/longitude-deg",ofpFix.getNode("pos_long").getValue()); #ident = "(T/D)"; + continue; # restore skip TOC/TOD } coords = geo.Coord.new(); diff --git a/Nasal/MCDU/FLIGHTLOG.nas b/Nasal/MCDU/FLIGHTLOG.nas index 818dac51..c8550c1f 100644 --- a/Nasal/MCDU/FLIGHTLOG.nas +++ b/Nasal/MCDU/FLIGHTLOG.nas @@ -176,13 +176,13 @@ var waitingOOOIChange = maketimer(1, func(){ # 1sec precision expectedOOOIState = 0; } } - else if (!gear0) { # OFF without IN -> To without stop and opening doors + else if (!gear0) { # OFF without IN -> TO without stop and opening doors if (lastgear0) FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState,lastgear0)); # IN (estimated) FlightLogDatabase.addPage(); if (lastgsrestart) FlightLogDatabase.addReport(OOOIReport.new(0,lastgsrestart)); # OUT (estimated) - expectedOOOIState = 1; # watch for OFF state + expectedOOOIState = 1; # go on to OFF state } - else if (gs > 9 and lastgsrestart == 0) { # try to decect OFF without IN + else if (gs > 9 and lastgsrestart == 0) { # try to detect OFF without IN lastgsrestart = int(getprop("/sim/time/elapsed-sec")); } } diff --git a/Nasal/MCDU/ROUTESELECTION.nas b/Nasal/MCDU/ROUTESELECTION.nas index d1b03bff..85d1b464 100644 --- a/Nasal/MCDU/ROUTESELECTION.nas +++ b/Nasal/MCDU/ROUTESELECTION.nas @@ -1,22 +1,7 @@ # Copyright (c) 2020 Matthew Maring (mattmaring) -# enhanced inuyaksa*2021 var initInputROUTESEL = func(key, i) { if (key == "L6") { setprop("MCDU[" ~ i ~ "]/page", "INITA"); } } - -var RouteSelManager = { - - leglist: nil, - - loadFlightplan: func(path) { - if (right(path,4) == ".xml") { # plan from SimBrief? - if (SimBrief.isValid(path)) { - leglist = SimBrief.readLegs(path); - } - } - } - -} \ No newline at end of file From b3c34dea153a17fd38841fb1bdd26e42b891496b Mon Sep 17 00:00:00 2001 From: Inuyaksa Date: Wed, 20 Jan 2021 21:50:32 +0100 Subject: [PATCH 38/38] PERFTO as aligned to manual p.145 --- Models/Instruments/MCDU/MCDU.nas | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 0419aeeb..4601d4cd 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -3753,7 +3753,7 @@ var canvas_MCDU_base = { me.showLeftS(1, 1, 1, 1, 1, 1); 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.showRightS(1, 1, 1, 1, 1, 1); me.showRightArrow(-1, -1, -1, -1, -1, 1); me.showCenter(1, 1, 1, -1, -1, -1); me["Simple_C3B"].hide(); @@ -3772,11 +3772,13 @@ var canvas_MCDU_base = { me.colorLeft("blu", "blu", "blu", "blu", "blu", "wht"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRight("wht", "blu", "blu", "blu", "blu", "wht"); + me.colorRight("grn", "blu", "blu", "blu", "blu", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); me.colorCenter("grn", "grn", "grn", "wht", "wht", "wht"); me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); + + me["Simple_Title"].setText("TAKE OFF"); pageSwitch[i].setBoolValue(1); } @@ -3816,17 +3818,24 @@ var canvas_MCDU_base = { me["Simple_L6S"].hide(); } - if (fmgc.FMGCInternal.phase == 1) { + if (fmgc.FMGCInternal.phase > 0) { # not modifiable from TO phase me["Simple_Title"].setColor(GREEN); + me.colorLeft("grn", "grn", "grn", "blu", "grn", "wht"); + me.colorRight("grn", "blu", "grn", "grn", "grn", "wht"); } else { me["Simple_Title"].setColor(WHITE); + me.colorLeft("blu", "blu", "blu", "blu", "blu", "wht"); + me.colorRight("grn", "blu", "blu", "blu", "blu", "wht"); } if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) { - me["Simple_Title"].setText(sprintf("TAKE OFF RWY %s", fmgc.flightPlanController.flightplans[2].departure_runway.id)); + me["Simple_R1"].setText(fmgc.flightPlanController.flightplans[2].departure_runway.id ~ " "); + me["Simple_R1"].show(); } else { - me["Simple_Title"].setText("TAKE OFF"); + me["Simple_R1"].hide(); } + + if (fmgc.FMGCInternal.v1set) { me["PERFTO_V1"].hide();