Skip to content

Commit

Permalink
System: Add AP warning on power up
Browse files Browse the repository at this point in the history
  • Loading branch information
Octal450 committed Jan 2, 2024
1 parent 7f19b7b commit 7060140
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 3 deletions.
18 changes: 18 additions & 0 deletions Nasal/AFS/AFS.nas
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ var Settings = {

var Sound = {
apOff: props.globals.getNode("/it-autoflight/sound/apoff"),
apOffSingle: props.globals.initNode("/it-autoflight/sound/apoff-single", 0, "BOOL"),
enableApOff: 0,
enablePowerApOff: 0,
};

var Text = {
Expand Down Expand Up @@ -331,10 +333,12 @@ var ITAF = {
Warning.atsFlash.setBoolValue(0);
Warning.ats.setBoolValue(0);
Sound.enableApOff = 0;
Sound.enablePowerApOff = 0;
Internal.enableAthrOff = 0;
apKill.stop();
atsKill.stop();
}
Sound.apOffSingle.setBoolValue(0);
systems.WARNINGS.altitudeAlert.setValue(0); # Cancel altitude alert
loopTimer.start();
slowLoopTimer.start();
Expand Down Expand Up @@ -367,6 +371,20 @@ var ITAF = {
}
}

# AP Power Warning - when FCC power cycles, sounds warning
pts.Fdm.JSBsim.Fcc.powerAvailTemp = pts.Fdm.JSBsim.Fcc.powerAvail.getValue();
if (pts.Fdm.JSBsim.Fcc.powerAvailTemp == 1) {
if (acconfig.SYSTEM.autoConfigRunning.getBoolValue()) { # Don't do it during autoconfig
Sound.enablePowerApOff = 0;
} else if (Sound.enablePowerApOff) {
Sound.apOffSingle.setBoolValue(1);
Sound.enablePowerApOff = 0;
}
} else if (pts.Fdm.JSBsim.Fcc.powerAvailTemp == 0) {
Sound.enablePowerApOff = 1;
Sound.apOffSingle.setBoolValue(0);
}

# LNAV Reversion
if (Output.lat.getValue() == 1) { # Only evaulate the rest of the condition if we are in LNAV mode
if (FPLN.num.getValue() == 0 or !FPLN.active.getBoolValue() or !systems.IRS.Iru.anyAligned.getBoolValue()) {
Expand Down
2 changes: 1 addition & 1 deletion Nasal/libraries.nas
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) 2023 Josh Davidson (Octal450)

print("------------------------------------------------");
print("Copyright (c) 2017-2023 Josh Davidson (Octal450)");
print("Copyright (c) 2017-2024 Josh Davidson (Octal450)");
print("------------------------------------------------");

setprop("/sim/menubar/default/menu[0]/item[0]/enabled", 0);
Expand Down
2 changes: 2 additions & 0 deletions Nasal/property-tree-setup.nas
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ var Fdm = {
Lsas: {
autotrimInhibit: props.globals.getNode("/fdm/jsbsim/fcc/lsas/autotrim-inhibit"),
},
powerAvail: props.globals.getNode("/fdm/jsbsim/fcc/power-avail"),
powerAvailTemp: 0,
pitchTrimSpeed: props.globals.getNode("/fdm/jsbsim/fcc/pitch-trim-speed"),
stallAlphaDeg: props.globals.getNode("/fdm/jsbsim/fcc/stall-alpha-deg"),
stallWarnAlphaDeg: props.globals.getNode("/fdm/jsbsim/fcc/stall-warn-alpha-deg"),
Expand Down
14 changes: 13 additions & 1 deletion Sounds/MD-11-common-sound.xml
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@
</condition>
</caws>
<caws>
<name>AP Off</name>
<name>AP Off Warning</name>
<mode>once</mode>
<path>Aircraft/MD-11/Sounds/CAWS/apoff.wav</path>
<type>avionics</type>
Expand All @@ -897,6 +897,18 @@
</greater-than>
</condition>
</caws>
<caws>
<name>AP Off Warning 2</name>
<mode>once</mode>
<path>Aircraft/MD-11/Sounds/CAWS/apoff.wav</path>
<type>avionics</type>
<condition>
<greater-than>
<property>/systems/caws/apoff/single-out</property>
<value>0</value>
</greater-than>
</condition>
</caws>
<caws>
<name>Overspeed</name>
<path>Aircraft/MD-11/Sounds/CAWS/overspeed.wav</path>
Expand Down
23 changes: 23 additions & 0 deletions Systems/md-11-cockpit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,29 @@
<output>/systems/caws/apoff/out</output>
</actuator>

<!-- Autopilot Horn Once -->
<switch name="/systems/caws/apoff/single-trigger">
<default value="/systems/caws/apoff/single-trigger"/>
<test logic="OR" value="0">
/systems/electrical/outputs/mk-viii lt 24
<test logic="AND">
/it-autoflight/sound/apoff-single eq 0
/systems/caws/apoff/single-out eq 1
</test>
</test>
<test logic="AND" value="1">
/systems/caws/apoff/single-out eq 0
/it-autoflight/sound/apoff-single eq 1
</test>
</switch>

<actuator name="/systems/caws/apoff/single-actuator">
<input>/systems/caws/apoff/single-trigger</input>
<rate_limit sense="incr">0.35</rate_limit>
<rate_limit sense="decr">100</rate_limit>
<output>/systems/caws/apoff/single-out</output>
</actuator>

<!-- Landing Gear Horn -->
<switch name="/systems/caws/landing-gear/trigger">
<default value="/systems/caws/landing-gear/trigger"/>
Expand Down
8 changes: 8 additions & 0 deletions Systems/md-11-fcc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
</test>
</switch>

<switch name="fcc/power-avail">
<default value="0"/>
<test logic="OR" value="1">
fcc/fcc1-power eq 1
fcc/fcc2-power eq 1
</test>
</switch>

<switch name="fcc/afs/enabled">
<default value="0"/>
<test logic="OR" value="1">
Expand Down
2 changes: 1 addition & 1 deletion revision.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1330
1331

0 comments on commit 7060140

Please sign in to comment.