Skip to content

Commit

Permalink
FGS: Split T/O and G/A from ITAF core
Browse files Browse the repository at this point in the history
  • Loading branch information
Octal450 committed Feb 6, 2025
1 parent eb90c11 commit 953db60
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 31 deletions.
8 changes: 5 additions & 3 deletions Nasal/FGS/FGS-b.nas
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ var Athr = {
loop: func() {
me.tciMode = systems.THRLIM.Limit.activeModeInt.getValue();
Output.thrModeTemp = Output.thrMode.getValue();
me.retard = Output.athr.getBoolValue() and Output.vert.getValue() != 7 and pts.Position.gearAglFt.getValue() <= 50 and systems.FCS.slatsCmd.getValue() >= 28 and me.tciMode != 0 and me.tciMode != 1;
Output.vertTemp = Output.vert.getValue();
me.retard = Output.athr.getBoolValue() and Output.vertTemp != 7 and Output.vertTemp != 8 and pts.Position.gearAglFt.getValue() <= 50 and systems.FCS.slatsCmd.getValue() >= 28 and me.tciMode != 0 and me.tciMode != 1;

if (Output.thrModeTemp == 0) { # Update it as the UpdateFma only does it once
me.modeZeroCheck();
Expand All @@ -254,16 +255,17 @@ var Athr = {
},
setMode: func(n) { # 0 Thrust, 1 Retard, 2 EPR/N1 Limit, 3 Clamp
me.tciMode = systems.THRLIM.Limit.activeModeInt.getValue();
Output.vertTemp = Output.vert.getValue();

if (me.tciMode == 0 or me.tciMode == 1) {
me.toCheck();
} else if (!me.retard or fgs.Output.vert.getValue() == 7) {
} else if (!me.retard or Output.vertTemp == 7 or Output.vertTemp == 8) {
Output.thrMode.setValue(n);
}
UpdateFma.thr();
},
toCheck: func() {
if (Text.vert.getValue() == "T/O CLB") {
if (Output.vert.getValue() == 7) {
if (pts.Instrumentation.AirspeedIndicator.indicatedSpeedKt.getValue() < 80 and pts.Position.wow.getBoolValue()) {
if (Output.thrMode.getValue() != 2) {
Output.thrMode.setValue(2);
Expand Down
23 changes: 15 additions & 8 deletions Nasal/FGS/FGS.nas
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ var ITAF = {
me.checkRadioReversion(Output.latTemp, Output.vertTemp);
}

# Takeoff Lateral Reversion
if (Output.latTemp == 5 and Output.vertTemp != 7) {
# Takeoff/Go Around Lateral Reversion
if (Output.latTemp == 5 and Output.vertTemp != 7 and Output.vertTemp != 8) {
me.setLatMode(3);
}

Expand Down Expand Up @@ -832,11 +832,20 @@ var ITAF = {
me.updateGsArm(0, 1); # Don't disarm autoland
Output.vert.setValue(6);
me.updateVertText("FLARE");
} else if (n == 7) { # T/O CLB or G/A CLB, text is set by TOGA selector
} else if (n == 7) { # T/O CLB
Internal.flchActive = 0;
Internal.altCaptureActive = 0;
me.updateGsArm(0);
Output.vert.setValue(7);
me.updateVertText("T/O CLB");
Athr.setMode(2); # EPR Lim
Input.ktsMachFlch.setBoolValue(0);
} else if (n == 8) { # G/A CLB
Internal.flchActive = 0;
Internal.altCaptureActive = 0;
me.updateGsArm(0);
Output.vert.setValue(8);
me.updateVertText("G/A CLB");
Athr.setMode(2); # EPR Lim
Input.ktsMachFlch.setBoolValue(0);
} else if (n == 9) { # TURB
Expand Down Expand Up @@ -1008,13 +1017,11 @@ var ITAF = {
me.updateLatText("T/O");
}
me.setVertMode(7);
me.updateVertText("T/O CLB");
} else if (Output.vertTemp != 7) {
} else if (Output.vertTemp != 8) {
systems.THRLIM.setMode(2); # G/A
me.setLatMode(5);
me.updateLatText("G/A");
me.setVertMode(7); # Must be before kicking AP off
me.updateVertText("G/A CLB");
me.setVertMode(8); # Must be before kicking AP off
if (Gear.wow1.getBoolValue() or Gear.wow2.getBoolValue()) {
me.ap1Master(0);
me.ap2Master(0);
Expand Down Expand Up @@ -1144,7 +1151,7 @@ setlistener("/it-autoflight/input/fd2", func() {
});

setlistener("/it-autoflight/input/kts-mach-flch", func() {
if (Output.vert.getValue() == 7) { # Mach is not allowed in Mode 7, and don't sync
if (Output.vertTemp == 7 or Output.vertTemp == 8) { # Mach is not allowed in Mode 7/8, and don't sync
if (Input.ktsMachFlch.getBoolValue()) {
Input.ktsMachFlch.setBoolValue(0);
}
Expand Down
54 changes: 38 additions & 16 deletions Systems/fgs-drivers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,16 @@
<gain>1.0</gain>
<input>
<condition>
<equals>
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
<or>
<equals>
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
<equals>
<property>/it-autoflight/output/vert</property>
<value>8</value>
</equals>
</or>
</condition>
<expression>
<product>
Expand Down Expand Up @@ -455,6 +461,10 @@
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
<equals>
<property>/it-autoflight/output/vert</property>
<value>8</value>
</equals>
</or>
<property>/it-autoflight/output/apfd-on</property>
<equals>
Expand Down Expand Up @@ -1134,8 +1144,8 @@
<condition>
<and>
<equals>
<property>/it-autoflight/text/vert</property>
<value>T/O CLB</value>
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
<greater-than-equals>
<property>/instrumentation/airspeed-indicator/indicated-speed-kt</property>
Expand Down Expand Up @@ -1228,8 +1238,8 @@
<input>
<condition>
<equals>
<property>/it-autoflight/text/vert</property>
<value>T/O CLB</value>
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
</condition>
<expression>
Expand Down Expand Up @@ -1263,21 +1273,33 @@
<gain>1.0</gain>
<input>
<condition>
<equals>
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
<or>
<equals>
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
<equals>
<property>/it-autoflight/output/vert</property>
<value>8</value>
</equals>
</or>
</condition>
<property>/systems/fcc/speeds/v2-target</property>
</input>
<input>/it-autoflight/input/kts</input>
<output>/it-autoflight/output/fast-slow-input</output>
<min>
<condition>
<equals>
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
<or>
<equals>
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
<equals>
<property>/it-autoflight/output/vert</property>
<value>8</value>
</equals>
</or>
</condition>
<property>/systems/fcc/speeds/v2-target</property>
</min>
Expand Down
22 changes: 18 additions & 4 deletions Systems/fgs-pitch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
<equals>
<property>/it-autoflight/output/vert</property>
<value>8</value>
</equals>
</or>
</and>
</input>
Expand Down Expand Up @@ -177,10 +181,16 @@
</min>
<min>
<condition>
<equals>
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
<or>
<equals>
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
<equals>
<property>/it-autoflight/output/vert</property>
<value>8</value>
</equals>
</or>
</condition>
<value>120</value>
</min>
Expand Down Expand Up @@ -268,6 +278,10 @@
<property>/it-autoflight/output/vert</property>
<value>7</value>
</equals>
<equals>
<property>/it-autoflight/output/vert</property>
<value>8</value>
</equals>
</or>
</condition>
<property>/it-autoflight/internal/target-fpm-flch</property>
Expand Down

0 comments on commit 953db60

Please sign in to comment.