From 698caf81b434f5ebf6e28b20e3fec12729d3bc0b Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sat, 1 Jan 2022 20:53:29 +0000 Subject: [PATCH 1/8] ATC was missing from annun-test condition --- Models/FlightDeck/a320.flightdeck.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index b1877ad4..ad3a2f8f 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -1272,6 +1272,7 @@ select + atc-test audio_att_sgn audio_call_hf2_led audio_call_hf1_led @@ -1281,13 +1282,10 @@ audio_mech_sgn ecam_c_b_led ecam_el_dc_led - ecam_sts_led engine_fault_1 engine_fault_2 exped_led - qnh-test radio_opt_led - ver.fmgc controls/switches/annun-test @@ -1298,7 +1296,9 @@ alt-text-test hdg-text-test spd-text-test + qnh-test vs-text-test + ver.fmgc FMGC/FCU-working From 5e666793665714fb958dffe1ef565f1790d462ce Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sun, 2 Jan 2022 02:08:08 +0000 Subject: [PATCH 2/8] Apply patch by Tobias Dammers to prevent mapstructure error --- Models/Instruments/ND/canvas/map/RTE.lcontroller | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Models/Instruments/ND/canvas/map/RTE.lcontroller b/Models/Instruments/ND/canvas/map/RTE.lcontroller index e8fc79c7..42343196 100644 --- a/Models/Instruments/ND/canvas/map/RTE.lcontroller +++ b/Models/Instruments/ND/canvas/map/RTE.lcontroller @@ -25,7 +25,7 @@ var new = func(layer) { map: layer.map, listeners: [], }; - layer.searcher._equals = func(l,r) 0; # TODO: create model objects instead? + layer.searcher._equals = func(l,r) return (l == r); append(m.listeners, setlistener(layer.options.active_node, func m.layer.update() ), setlistener(layer.options.wp_num, func m.layer.update() )); m.addVisibilityListener(); var driver = opt_member(m.layer.options, 'route_driver'); From ca4036400ce5e6d22180816e543cde1b2809a013 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sun, 2 Jan 2022 13:11:35 +0000 Subject: [PATCH 3/8] remove un-needed --- Systems/a320-fuel.xml | 1 - Systems/a320-fwc-phases.xml | 1 - Systems/a320-fwc.xml | 55 ------------------------------------- Systems/a320-hydraulic.xml | 1 - 4 files changed, 58 deletions(-) diff --git a/Systems/a320-fuel.xml b/Systems/a320-fuel.xml index 9267dd76..9bd6e57a 100644 --- a/Systems/a320-fuel.xml +++ b/Systems/a320-fuel.xml @@ -186,7 +186,6 @@ - Timer for the Fuel Center pumps /systems/fuel/quantity/center-low 120 0.00333 diff --git a/Systems/a320-fwc-phases.xml b/Systems/a320-fwc-phases.xml index 05af76de..59894caf 100644 --- a/Systems/a320-fwc-phases.xml +++ b/Systems/a320-fwc-phases.xml @@ -7,7 +7,6 @@ - Timer for the ECAM phase system /ECAM/logic/ground-calc-immediate 120 1 diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml index 4bb6fa18..b59f0d73 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -13,363 +13,311 @@ - Timer for the ECAM system /ECAM/phases/timer/eng1idle 120 0.033 - Timer for the ECAM system /ECAM/phases/timer/eng2idle 120 0.033 - Timer for the ECAM system /ECAM/phases/timer/to-inhibit 120 0.33 - Timer for the ECAM system /ECAM/phases/timer/ldg-inhibit 120 0.33 - Timer for the ECAM system /ECAM/warnings/timer/bleed-1-fault 120 0.2 - Timer for the ECAM system /ECAM/warnings/timer/bleed-2-fault 120 0.2 - Timer for the ECAM system /ECAM/warnings/logic/apu-bleed-fault 120 0.1 - Timer for the ECAM system /systems/pneumatics/warnings/crossbleed-disag 120 0.1 - Timer for the ECAM system /ECAM/warnings/logic/crossbleed-fault-timer-was-one 0.1 120 - Timer for the ECAM system /controls/engines/engine[0]/fire-btn 0.06666666666 - Timer for the ECAM system /ECAM/warnings/logic/prv-1-not-shut-apu 120 1 - Timer for the ECAM system /ECAM/warnings/logic/prv-2-not-shut-apu 120 1 - Timer for the ECAM system /ECAM/warnings/logic/prv-1-not-shut 120 1 - Timer for the ECAM system /ECAM/warnings/logic/prv-2-not-shut 120 1 - Timer for the ECAM system /ECAM/warnings/timer/bleed-1-and-2-low-temp 120 0.00185185 - Timer for the ECAM system /systems/pneumatics/warnings/lowtemp-1-mem 120 0.016666 - Timer for the ECAM system /systems/pneumatics/warnings/lowtemp-2-mem 120 0.016666 - Timer for the ECAM system /ECAM/warnings/logic/bleed-1-off-60 120 0.016666 - Timer for the ECAM system /ECAM/warnings/logic/bleed-2-off-60 120 0.016666 - Timer for the ECAM system /ECAM/warnings/logic/bleed-1-off-5 120 0.2 - Timer for the ECAM system /ECAM/warnings/logic/bleed-2-off-5 120 0.2 - Timer for the ECAM system /ECAM/warnings/logic/eng-aice-1-open 120 0.2 - Timer for the ECAM system /ECAM/warnings/logic/eng-aice-2-open 120 0.2 - Timer for the ECAM system /ECAM/warnings/logic/eng-aice-1-closed 120 0.1 - Timer for the ECAM system /ECAM/warnings/logic/eng-aice-2-closed 120 0.1 - Timer for the ECAM system /ECAM/warnings/logic/wing-anti-ice-flipflop-set-input 120 0.0285714 - Timer for the ECAM system /ECAM/warnings/timer/phase-1-input 120 0.5 - Timer for the ECAM system /controls/ice-protection/wing 120 0.04 - Timer for the ECAM system /ECAM/warnings/logic/wing-anti-ice-left-closed-set-input 120 0.066666 - Timer for the ECAM system /ECAM/warnings/logic/wing-anti-ice-right-closed-set-input 120 0.066666 - Timer for the ECAM system /ECAM/warnings/logic/proc-wai-shutdown-flipflop 120 0.1 - Timer for the ECAM system /ECAM/warnings/logic/wing-hi-pr-left-input 120 0.025 - Timer for the ECAM system /ECAM/warnings/logic/wing-hi-pr-right-input 120 0.025 - Timer for the ECAM system /ECAM/warnings/logic/cranking-35-sec-input 120 0.028571 - Timer for the ECAM system /ECAM/warnings/logic/pack-1-fault-closed-input 120 0.1 - Timer for the ECAM system /ECAM/warnings/logic/pack-2-fault-closed-input 120 0.1 - Timer for the ECAM system /ECAM/warnings/logic/pack-1-disagree-input 120 0.1 - Timer for the ECAM system /ECAM/warnings/logic/pack-2-disagree-input 120 0.1 - Timer for the ECAM system /ECAM/warnings/logic/ignition 100 0.028571 - Timer for the ECAM system /ECAM/warnings/logic/pack-1-fault-input 120 0.20 - Timer for the ECAM system /ECAM/warnings/logic/pack-2-fault-input 120 0.20 - Timer for the ECAM system /ECAM/warnings/logic/pack-1-fault-warning-input 120 0.50 - Timer for the ECAM system /ECAM/warnings/logic/pack-2-fault-warning-input 120 0.50 - Timer for the ECAM system /ECAM/warnings/logic/pack-1-off-input 120 0.0166666 - Timer for the ECAM system /ECAM/warnings/logic/pack-2-off-input 120 0.0166666 - Timer for the ECAM system /ECAM/warnings/logic/trim-air-fault-input 120 0.2 - Timer for the ECAM system /ECAM/warnings/logic/yaw-damper-1-fault 120 0.2 - Timer for the ECAM system /ECAM/warnings/logic/yaw-damper-2-fault 120 0.2 - Timer for the ECAM system /ECAM/warnings/logic/nav-gpws-terr-fault 120 1.0 - Timer for the ECAM system /ECAM/warnings/logic/apu-gen-fault-reset 120 0.5 - Timer for the ECAM system /ECAM/warnings/logic/wing-anti-ice-left-open-set-15-input 120 0.06666666666 - Timer for the ECAM system /ECAM/warnings/logic/wing-anti-ice-right-open-set-15-input 120 0.06666666666 @@ -1725,7 +1673,6 @@ - Timer for the ECAM system /ECAM/warnings/logic/gen-1-fault-set 120 0.1818 @@ -1793,7 +1740,6 @@ - Timer for the ECAM system /ECAM/warnings/logic/gen-2-fault-set 120 0.1818 @@ -1860,7 +1806,6 @@ - Timer for the ECAM system /ECAM/warnings/logic/apu-gen-fault-set 120 0.2 diff --git a/Systems/a320-hydraulic.xml b/Systems/a320-hydraulic.xml index f3ad3abc..30def2b9 100644 --- a/Systems/a320-hydraulic.xml +++ b/Systems/a320-hydraulic.xml @@ -172,7 +172,6 @@ - Timer for the ECAM system /systems/hydraulic/sources/blue-elec/pump-operate-apu 100 0.0083333 From 293e6af84c0b1d98f453ddbe5c8fcb305702eb9a Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sun, 2 Jan 2022 13:57:03 +0000 Subject: [PATCH 4/8] FAC failure: correct condition on warning --- Systems/a320-fbw.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Systems/a320-fbw.xml b/Systems/a320-fbw.xml index a510a77b..808ca447 100644 --- a/Systems/a320-fbw.xml +++ b/Systems/a320-fbw.xml @@ -570,7 +570,7 @@ - /systems/fctl/fac1-healthy ne 0 + /systems/fctl/fac1-healthy eq 1 /systems/fctl/fac1-healthy-latch eq 0 /gear/gear[0]/wow eq 1 @@ -641,7 +641,7 @@ - /systems/fctl/fac2-healthy ne 0 + /systems/fctl/fac2-healthy eq 1 /systems/fctl/fac2-healthy-latch eq 0 /gear/gear[0]/wow eq 1 From e394db0cd96f4c84fc3aeaf3a428082698ee27eb Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sun, 2 Jan 2022 16:52:05 +0000 Subject: [PATCH 5/8] External power light - correct AVAIL power source --- Models/Instruments/OHpanel/OHpanel.xml | 39 +++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index 971d182c..8b419635 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -21,7 +21,6 @@ CargoHotAirBtn1F CargoHotAirBtn2O CrewOxyBtn2O - ExtPwrBtn1A GalleyPwrBtn1F GalleyPwrBtn2O Gen1LineBtn1S @@ -110,6 +109,44 @@ + + + select + ExtPwrBtn1A + + + + + + systems/electrical/bus/ac-si-bus + 110 + + + systems/electrical/bus/ac-ess-shed + 110 + + + + systems/electrical/bus/ac-ess + 110 + + + + + /systems/electrical/sources/ext/output-volt + 110 + + + + systems/electrical/bus/ac-ess + 110 + + + + + + + select From b85863cf06fb46b361f86f6b3c29092ae7fc355d Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sun, 2 Jan 2022 17:24:59 +0000 Subject: [PATCH 6/8] No smoking light / seatbelt light - correct CIDS power source; move to JSB --- AircraftConfig/acconfig.nas | 12 +-- Nasal/ECAM/ECAM-logic.nas | 12 +-- Nasal/Libraries/buttons.nas | 8 +- Nasal/Libraries/libraries.nas | 102 ++++++++---------------- Nasal/Libraries/property-tree-setup.nas | 10 +++ Nasal/Systems/ground_services.nas | 4 +- Systems/a320-lights.xml | 40 ++++++++++ 7 files changed, 102 insertions(+), 86 deletions(-) diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 58ec28a6..53f18096 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -391,9 +391,9 @@ var beforestart_b = func { setprop("/controls/adirs/mcducbtn", 1); setprop("/controls/switches/beacon", 1); setprop("/controls/lighting/nav-lights-switch", 1); - libraries.noSmokingSwitch.setValue(0.5); - libraries.seatbeltSwitch.setValue(1.0); - libraries.emerLtsSwitch.setValue(0.5); + pts.Controls.Switches.noSmokingSwitch.setValue(0.5); + pts.Controls.Switches.seatbeltSwitch.setValue(1.0); + pts.Controls.Switches.emerLtsSwitch.setValue(0.5); setprop("/controls/radio/rmp[0]/on", 1); setprop("/controls/radio/rmp[1]/on", 1); setprop("/controls/radio/rmp[2]/on", 1); @@ -488,9 +488,9 @@ var taxi_b = func { setprop("/controls/switches/beacon", 1); setprop("/controls/switches/wing-lights", 1); setprop("/controls/lighting/nav-lights-switch", 1); - libraries.noSmokingSwitch.setValue(0.5); - libraries.seatbeltSwitch.setValue(1.0); - libraries.emerLtsSwitch.setValue(0.5); + pts.Controls.Switches.noSmokingSwitch.setValue(0.5); + pts.Controls.Switches.seatbeltSwitch.setValue(1.0); + pts.Controls.Switches.emerLtsSwitch.setValue(0.5); setprop("/controls/radio/rmp[0]/on", 1); setprop("/controls/radio/rmp[1]/on", 1); setprop("/controls/radio/rmp[2]/on", 1); diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index c4481bcb..68318983 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -3314,7 +3314,7 @@ var messages_config_memo = func { toMemoLine1.colour = "c"; } - if (libraries.seatbeltSwitch.getValue() and libraries.noSmokingSwitch.getValue() ) { + if (pts.Controls.Switches.seatbeltSwitch.getValue() and pts.Controls.Switches.noSmokingSwitch.getValue()) { toMemoLine2.msg = " SIGNS ON"; toMemoLine2.colour = "g"; } else { @@ -3380,7 +3380,7 @@ var messages_config_memo = func { ldgMemoLine1.colour = "c"; } - if (libraries.seatbeltSwitch.getValue() and libraries.noSmokingSwitch.getValue()) { + if (pts.Controls.Switches.seatbeltSwitch.getValue() and pts.Controls.Switches.noSmokingSwitch.getValue()) { ldgMemoLine2.msg = " SIGNS ON"; ldgMemoLine2.colour = "g"; } else { @@ -3505,19 +3505,19 @@ var messages_memo = func { gnd_splrs.active = 0; } - if (libraries.seatbeltLight.getValue() == 1 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { + if (pts.Controls.Lighting.seatbeltSign.getValue() and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { seatbelts.active = 1; } else { seatbelts.active = 0; } - if (libraries.noSmokingLight.getValue() == 1 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { # should go off after takeoff assuming switch is in auto due to old logic from the days when smoking was allowed! + if (pts.Controls.Lighting.noSmokingSign.getValue() and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { # should go off after takeoff assuming switch is in auto due to old logic from the days when smoking was allowed! nosmoke.active = 1; } else { nosmoke.active = 0; } - if (getprop("/controls/lighting/strobe") == 0 and !pts.Gear.wow[1].getValue() and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { # todo: use gear branch properties + if (!pts.Controls.Lighting.strobe.getValue() and !pts.Gear.wow[1].getValue() and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { # todo: use gear branch properties strobe_lt_off.active = 1; } else { strobe_lt_off.active = 0; @@ -3542,7 +3542,7 @@ var messages_memo = func { fob_66L.active = 0; } - if (getprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override") == 1 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { + if (libraries.GPWS.flapAllOverride.getValue() and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { gpws_flap_mode_off.active = 1; } else { gpws_flap_mode_off.active = 0; diff --git a/Nasal/Libraries/buttons.nas b/Nasal/Libraries/buttons.nas index a888c3d3..423bc9cf 100644 --- a/Nasal/Libraries/buttons.nas +++ b/Nasal/Libraries/buttons.nas @@ -24,7 +24,7 @@ var variousReset = func() { setprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", 0); setprop("/controls/switches/cabinCall", 0); setprop("/controls/switches/mechCall", 0); - libraries.emerLtsSwitch.setValue(0.5); + pts.Controls.Switches.emerLtsSwitch.setValue(0.5); # cockpit voice recorder stuff setprop("/controls/CVR/power", 0); setprop("/controls/CVR/test", 0); @@ -61,9 +61,9 @@ var variousReset = func() { setprop("/modes/fcu/hdg-time", -45); setprop("/controls/navigation/switching/att-hdg", 0); setprop("/controls/navigation/switching/air-data", 0); - libraries.noSmokingSwitch.setValue(0.0); - libraries.seatbeltSwitch.setValue(0.0); - libraries.emerLtsSwitch.setValue(0.0); + pts.Controls.Switches.noSmokingSwitch.setValue(0); + pts.Controls.Switches.seatbeltSwitch.setValue(0); + pts.Controls.Switches.emerLtsSwitch.setValue(0); } var BUTTONS = { diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index f5014294..09ac782c 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -70,7 +70,7 @@ var triggerDoor = func(door, doorName, doorDesc) { gui.popupTip("Closing " ~ doorDesc ~ " door"); door.toggle(); } else { - if (getprop("/velocities/groundspeed-kt") > 5) { + if (pts.Velocities.groundspeed.getValue() > 5) { gui.popupTip("You cannot open the doors while the aircraft is moving!"); } else { gui.popupTip("Opening " ~ doorDesc ~ " door"); @@ -133,48 +133,6 @@ setlistener("/sim/signals/fdm-initialized", func() { emesary.GlobalTransmitter.Register(A320Libraries); }); -var collectorTankL = props.globals.getNode("/fdm/jsbsim/propulsion/tank[5]/contents-lbs"); -var collectorTankR = props.globals.getNode("/fdm/jsbsim/propulsion/tank[6]/contents-lbs"); -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 groundspeed = 0; -var stateL = 0; -var stateR = 0; - -var seatbeltSwitch = props.globals.getNode("/controls/switches/seatbelt-sign"); -var noSmokingSwitch = props.globals.getNode("/controls/switches/no-smoking-sign"); -var emerLtsSwitch = props.globals.getNode("/controls/switches/emer-lights"); -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 == 1) { - 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 and getprop("/systems/acconfig/mismatch-code") != "0x000") { return; } systems.PNEU.loop(notification); @@ -190,15 +148,12 @@ var systemsLoop = func(notification) { atsu.ATSU.loop(); libraries.BUTTONS.update(); - if ((notification.engine1State == 2 or notification.engine1State == 3) and collectorTankL.getValue() < 1) { + if (notification.engine1State >= 2 and pts.Fdm.JSBsim.Propulsion.Tank.contentsLbs[5].getValue() < 1) { systems.cutoff_one(); } - if ((notification.engine2State == 2 or notification.engine2State == 3) and collectorTankR.getValue() < 1) { - systems.cutoff_two(); - } - foreach (var update_item; update_items) { - update_item.update(notification); + if (notification.engine2State >= 2 and pts.Fdm.JSBsim.Propulsion.Tank.contentsLbs[6].getValue() < 1) { + systems.cutoff_two(); } } @@ -210,11 +165,13 @@ var GPWS = { flapAllOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override"), flap3Override: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override"), flapOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-override"), - alertMode: props.globals.initNode("/instrumentation/mk-viii/outputs/alert-mode",0,"INT"), + alertMode: props.globals.initNode("/instrumentation/mk-viii/outputs/alert-mode", 0, "INT"), + alert: props.globals.getNode("instrumentation/mk-viii/outputs/discretes/gpws-alert"), + warning: props.globals.getNode("instrumentation/mk-viii/outputs/discretes/gpws-warning"), }; -setlistener("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit", func() { - if (GPWS.inhibitNode.getBoolValue()) { +setlistener("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit", func(val) { + if (val.getBoolValue()) { GPWS.volume.setValue(2); } else { GPWS.volume.setValue(0); @@ -238,18 +195,29 @@ setlistener("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override }, 0, 0); # GPWS alert pooling for get mode change - a little esoteric way but it works -var gpws_alert_watch = maketimer(0.8,func { - var alert = 0; - if (getprop("instrumentation/mk-viii/outputs/discretes/gpws-warning")) alert = 2; # MODE2 - warning - RED - else if (getprop("instrumentation/mk-viii/outputs/discretes/gpws-alert")) alert = 1; # MODE1 - caution - YELLOW - if (GPWS.alertMode.getValue()!=alert) GPWS.alertMode.setValue(alert); +var GPWSAlertStatus = 0; +var gpws_alert_watch = maketimer(0.8, func() { + if (GPWS.warning.getValue()) { + GPWSAlertStatus = 2; # MODE2 - warning - RED + } else if (GPWS.alert.getValue()) { + GPWSAlertStatus = 1; # MODE1 - caution - YELLOW + } else { + GPWSAlertStatus = 0; + } + + if (GPWS.alertMode.getValue() != GPWSAlertStatus) { + GPWS.alertMode.setValue(GPWSAlertStatus); + } }); -setlistener("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", func{ # detect GPWS switch status - var failure = GPWS.tatcfInhibit.getBoolValue(); - if (!failure) gpws_alert_watch.start(); - else gpws_alert_watch.stop(); -},1,0); +# detect GPWS switch status +setlistener("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", func (val) { + if (!val.getBoolValue()) { + gpws_alert_watch.start(); + } else { + gpws_alert_watch.stop(); + } +}, 1, 0); # Replay var replayState = props.globals.getNode("/sim/replay/replay-state"); @@ -392,8 +360,6 @@ var LibrariesRecipient = var input = { # Libraries - "seatbelt": "/controls/switches/seatbelt-sign", - "noSmoking": "/controls/switches/no-smoking-sign", "gearPosNorm": "/gear/gear[0]/position-norm", "gearPosNorm1": "/gear/gear[1]/position-norm", "gearPosNorm2": "/gear/gear[2]/position-norm", @@ -407,8 +373,8 @@ foreach (var name; keys(input)) { # TODO split EFIS altimeters var newinhg = nil; -setlistener("/instrumentation/altimeter/setting-inhg", func() { - newinhg = getprop("/instrumentation/altimeter/setting-inhg"); +setlistener("/instrumentation/altimeter/setting-inhg", func(val) { + newinhg = val.getValue(); setprop("/instrumentation/altimeter[1]/setting-inhg", newinhg); setprop("/instrumentation/altimeter[2]/setting-inhg", newinhg); setprop("/instrumentation/altimeter[3]/setting-inhg", newinhg); @@ -417,8 +383,8 @@ setlistener("/instrumentation/altimeter/setting-inhg", func() { }, 0, 0); var newhpa = nil; -setlistener("/instrumentation/altimeter/setting-hpa", func() { - newhpa = getprop("/instrumentation/altimeter/setting-hpa"); +setlistener("/instrumentation/altimeter/setting-hpa", func(val) { + newhpa = val.getValue(); setprop("/instrumentation/altimeter[1]/setting-hpa", newhpa); setprop("/instrumentation/altimeter[2]/setting-hpa", newhpa); setprop("/instrumentation/altimeter[3]/setting-hpa", newhpa); diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index b88890eb..7c08659b 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -69,9 +69,15 @@ var Controls = { }, Lighting: { landingLights: [props.globals.getNode("/controls/lighting/landing-lights[0]"),props.globals.getNode("/controls/lighting/landing-lights[1]"),props.globals.getNode("/controls/lighting/landing-lights[2]")], + noSmokingSign: props.globals.getNode("/controls/lighting/no-smoking-sign"), + seatbeltSign: props.globals.getNode("/controls/lighting/seatbelt-sign"), + strobe: props.globals.getNode("/controls/lighting/strobe"), }, Switches: { annunTest: props.globals.getNode("/controls/switches/annun-test"), + emerLtsSwitch: props.globals.getNode("/controls/switches/emer-lights"), + noSmokingSwitch: props.globals.getNode("/controls/switches/no-smoking-sign"), + seatbeltSwitch: props.globals.getNode("/controls/switches/seatbelt-sign"), }, }; @@ -136,6 +142,10 @@ var Fdm = { fuelUsed: [props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/fuel-used-lbs"), props.globals.getNode("/fdm/jsbsim/propulsion/engine[1]/fuel-used-lbs")], reverserAngle: [props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad"), props.globals.getNode("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad")], }, + Tank: { + contentsLbs: [props.globals.getNode("/fdm/jsbsim/propulsion/tank[0]/contents-lbs"), props.globals.getNode("/fdm/jsbsim/propulsion/tank[1]/contents-lbs"), props.globals.getNode("/fdm/jsbsim/propulsion/tank[2]/contents-lbs"), + props.globals.getNode("/fdm/jsbsim/propulsion/tank[3]/contents-lbs"), props.globals.getNode("/fdm/jsbsim/propulsion/tank[4]/contents-lbs"), props.globals.getNode("/fdm/jsbsim/propulsion/tank[5]/contents-lbs"), props.globals.getNode("/fdm/jsbsim/propulsion/tank[6]/contents-lbs")], + }, }, }, }; diff --git a/Nasal/Systems/ground_services.nas b/Nasal/Systems/ground_services.nas index ff82adef..0b027dc7 100644 --- a/Nasal/Systems/ground_services.nas +++ b/Nasal/Systems/ground_services.nas @@ -19,8 +19,8 @@ var ground_services = { setprop("/services/deicing_truck/de-ice", 0); # Set them all to 0 if the aircraft is not stationary - if (getprop("velocities/groundspeed-kt") >= 2) { - setprop("/services/chocks/enable", 0); + if (pts.Velocities.groundspeed.getValue() >= 2) { + pts.Controls.Gear.chocks.setValue(0); setprop("/services/fuel-truck/enable", 0); setprop("/services/deicing_truck/enable", 0); setprop("/services/catering/enable", 0); diff --git a/Systems/a320-lights.xml b/Systems/a320-lights.xml index bb66de86..d64b1429 100644 --- a/Systems/a320-lights.xml +++ b/Systems/a320-lights.xml @@ -223,5 +223,45 @@ + + + + + + + + /systems/electrical/bus/dc-ess ge 25 + /systems/electrical/bus/dc-service-bus ge 25 + + + /systems/pressurization/cabinalt-norm ge 11300 + /controls/switches/no-smoking-sign eq 1 + + + + /controls/switches/no-smoking-sign eq 0.5 + /gear/gear[0]/position-norm eq 1 + + /systems/electrical/bus/dc-ess ge 25 + /systems/electrical/bus/dc-service-bus ge 25 + + + + + + + + + /systems/electrical/bus/dc-ess ge 25 + /systems/electrical/bus/dc-service-bus ge 25 + + + /systems/pressurization/cabinalt-norm ge 11300 + /controls/switches/seatbelt-sign eq 1 + + + + + From c58a8c00e985e2a86a826241ba2207daf93ee6b1 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sun, 2 Jan 2022 17:46:46 +0000 Subject: [PATCH 7/8] No smoking sign comes on with gear downlocks --- Systems/a320-lights.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Systems/a320-lights.xml b/Systems/a320-lights.xml index d64b1429..f3d4df08 100644 --- a/Systems/a320-lights.xml +++ b/Systems/a320-lights.xml @@ -240,7 +240,7 @@ /controls/switches/no-smoking-sign eq 0.5 - /gear/gear[0]/position-norm eq 1 + /gear/gear[0]/position-norm ge 0.8 /systems/electrical/bus/dc-ess ge 25 /systems/electrical/bus/dc-service-bus ge 25 From 02d47b475ec023870c274b65c2e9aedf2b2000a3 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sun, 2 Jan 2022 17:52:36 +0000 Subject: [PATCH 8/8] GPWS code - move to jsb --- Nasal/ECAM/ECAM-logic.nas | 4 +-- Nasal/Libraries/libraries.nas | 48 +++++-------------------- Nasal/Libraries/property-tree-setup.nas | 2 ++ Systems/a320-misc.xml | 22 ++++++++++++ 4 files changed, 35 insertions(+), 41 deletions(-) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 68318983..b8f9a7d0 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -3542,7 +3542,7 @@ var messages_memo = func { fob_66L.active = 0; } - if (libraries.GPWS.flapAllOverride.getValue() and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { + if (pts.Instrumentation.MKVII.Inputs.Discretes.flapAllOverride.getValue() and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { gpws_flap_mode_off.active = 1; } else { gpws_flap_mode_off.active = 0; @@ -3737,7 +3737,7 @@ var messages_right_memo = func { brk_fan.active = 0; } - if (pts.Instrumentation.MKVII.Inputs.Discretes.flap3Override.getValue() == 1) { # todo: emer elec + if (pts.Instrumentation.MKVII.Inputs.Discretes.flap3Override.getValue()) { # todo: emer elec gpws_flap3.active = 1; } else { gpws_flap3.active = 0; diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index 09ac782c..1b76fb13 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -159,41 +159,11 @@ var systemsLoop = func(notification) { # GPWS var GPWS = { - inhibitNode: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit"), - tatcfInhibit: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit"), - volume: props.globals.getNode("/instrumentation/mk-viii/speaker/volume"), - flapAllOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override"), - flap3Override: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override"), - flapOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-override"), alertMode: props.globals.initNode("/instrumentation/mk-viii/outputs/alert-mode", 0, "INT"), alert: props.globals.getNode("instrumentation/mk-viii/outputs/discretes/gpws-alert"), warning: props.globals.getNode("instrumentation/mk-viii/outputs/discretes/gpws-warning"), }; -setlistener("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit", func(val) { - if (val.getBoolValue()) { - GPWS.volume.setValue(2); - } else { - GPWS.volume.setValue(0); - } -}, 0, 0); - -var updateGPWSFlap = func() { - if (GPWS.flapAllOverride.getBoolValue() or (GPWS.flap3Override.getBoolValue() and pts.Controls.Flight.flapsPos.getValue() >= 4)) { - GPWS.flapOverride.setBoolValue(1); - } else { - GPWS.flapOverride.setBoolValue(0); - } -} - -setlistener("/instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override", func() { - updateGPWSFlap(); -}, 0, 0); - -setlistener("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", func() { - updateGPWSFlap(); -}, 0, 0); - # GPWS alert pooling for get mode change - a little esoteric way but it works var GPWSAlertStatus = 0; var gpws_alert_watch = maketimer(0.8, func() { @@ -219,6 +189,15 @@ setlistener("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", func (va } }, 1, 0); +# Steep ILS +setlistener("/options/steep-ils", func(val) { + if (val.getValue()) { + pts.Instrumentation.MKVII.Inputs.Discretes.steepApproach.setValue(1); + } else { + pts.Instrumentation.MKVII.Inputs.Discretes.steepApproach.setValue(0); + } +}, 0, 0); + # Replay var replayState = props.globals.getNode("/sim/replay/replay-state"); setlistener(replayState, func(v) { @@ -229,15 +208,6 @@ setlistener(replayState, func(v) { } }, 0, 0); -# Steep ILS -setlistener("/options/steep-ils", func() { - if (getprop("/options/steep-ils") == 1) { - setprop("/instrumentation/mk-viii/inputs/discretes/steep-approach", 1); - } else { - setprop("/instrumentation/mk-viii/inputs/discretes/steep-approach", 0); - } -}, 0, 0); - # hackCanvas canvas.Text._lastText = canvas.Text["_lastText"]; canvas.Text.setText = func(text) { diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 7c08659b..2c61598c 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -217,6 +217,8 @@ var Instrumentation = { Inputs: { Discretes: { flap3Override: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override"), + flapAllOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override"), + steepApproach: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/steep-approach"), }, }, }, diff --git a/Systems/a320-misc.xml b/Systems/a320-misc.xml index 04800d0a..27d5feb0 100644 --- a/Systems/a320-misc.xml +++ b/Systems/a320-misc.xml @@ -385,6 +385,28 @@ + + + + + + /instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override eq 1 + + /instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override eq 1 + /controls/flight/flaps-pos ge 4 + + + + + + + + /instrumentation/mk-viii/inputs/discretes/gpws-inhibit eq 0 + + + + +