diff --git a/A320-100-CFM-set.xml b/A320-100-CFM-set.xml
index 999d7716..3615764b 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 ea10812f..79c4660d 100644
--- a/A320-200-CFM-set.xml
+++ b/A320-200-CFM-set.xml
@@ -185,7 +185,8 @@
0
-
+
+
Right Aft View
lookfrom
false
@@ -200,7 +201,16 @@
0
-
+
+
+
+ Aircraft/A320-family/Systems/fadec-cfm.xml
+
+
+ Aircraft/A320-family/Systems/cfm56-sound.xml
+
+
+
diff --git a/A320-200-IAE-set.xml b/A320-200-IAE-set.xml
index c4a5548d..3222c40c 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/A320-main.xml b/A320-main.xml
index 871b68c1..881df496 100644
--- a/A320-main.xml
+++ b/A320-main.xml
@@ -4432,9 +4432,11 @@
Aircraft/A320-family/Nasal/Libraries/libraries.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/A320neo-CFM-set.xml b/A320neo-CFM-set.xml
index ed5c07b2..707a12e4 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 831b1eae..6a073e80 100644
--- a/A320neo-PW-set.xml
+++ b/A320neo-PW-set.xml
@@ -185,7 +185,8 @@
0
-
+
+
Right Aft View
lookfrom
false
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 54f42db8..bbe49b26 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);
@@ -117,7 +118,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);
@@ -3011,12 +3011,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/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;
diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas
index 1c21a4fa..5dfef46a 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);
@@ -681,7 +682,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);
@@ -1018,9 +1019,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/buttons.nas b/Nasal/Libraries/buttons.nas
index 5c6ec78e..289abfb2 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);
@@ -64,72 +62,89 @@ 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);
}
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/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/custom-views.nas b/Nasal/Libraries/custom-views.nas
index 004f502f..230647e8 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/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas
index 0f58771c..ac09a897 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 #
#########
@@ -195,7 +78,11 @@ var triggerDoor = func(door, doorName, doorDesc) {
###########
# Systems #
###########
-var systemsInit = func {
+var systemsInitialized = 0;
+var A320Libraries = nil;
+
+var systemsInit = func() {
+ systemsInitialized = 0;
fbw.FBW.init();
effects.light_manager.init();
systems.ELEC.init();
@@ -217,9 +104,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();
@@ -231,13 +116,17 @@ var systemsInit = func {
fmgc.flightPlanController.init();
fmgc.windController.init();
atsu.CompanyCall.init();
+ systemsInitialized = 1;
}
-setlistener("/sim/signals/fdm-initialized", func {
+setlistener("/sim/signals/fdm-initialized", func() {
systemsInit();
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");
@@ -245,10 +134,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 == 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) { return; }
systems.ELEC.loop();
systems.PNEU.loop();
systems.HYD.loop();
@@ -261,36 +182,19 @@ var systemsLoop = maketimer(0.1, func {
dmc.DMController.loop();
atsu.ATSU.loop();
libraries.BUTTONS.update();
- systems.HFLoop();
+ systems.HFLoop(notification);
- 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) {
+ 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();
}
-});
+
+ foreach (var update_item; update_items) {
+ update_item.update(notification);
+ }
+}
# GPWS
var GPWS = {
@@ -336,7 +240,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 {
@@ -352,12 +256,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);
@@ -368,146 +272,9 @@ 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 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) {
@@ -528,25 +295,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]");
}
@@ -561,7 +327,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);
@@ -579,4 +345,37 @@ 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 = {
+ # Libraries
+ "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/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas
index 78825392..47dab7ee 100644
--- a/Nasal/Libraries/property-tree-setup.nas
+++ b/Nasal/Libraries/property-tree-setup.nas
@@ -249,6 +249,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 = {
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..fabe002d
--- /dev/null
+++ b/Nasal/Libraries/sounds.nas
@@ -0,0 +1,125 @@
+# 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);
+
+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/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",
};
diff --git a/Systems/a320-misc.xml b/Systems/a320-misc.xml
index 22dddba9..d661a80e 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 gt 0
+ /gear/gear[1]/compression-norm gt 0
+ /gear/gear[2]/compression-norm gt 0
+
+
+
+
+
+
+
+ /engines/engine[0]/state eq 3
+ /engines/engine[1]/state eq 3
+
+
+
+
+
+
+ /velocities/groundspeed-kt ge 2
+
+
+
+
+
+
+ /velocities/groundspeed-kt ge 2
+
+
+
+
+
diff --git a/revision.txt b/revision.txt
index ac4213d6..7d373862 100644
--- a/revision.txt
+++ b/revision.txt
@@ -1 +1 @@
-43
\ No newline at end of file
+45
\ No newline at end of file