Skip to content

Commit

Permalink
Merge branch 'master' into scrape_points
Browse files Browse the repository at this point in the history
  • Loading branch information
flogross89 authored Jul 8, 2024
2 parents aa1354c + cc89848 commit a2a8d81
Show file tree
Hide file tree
Showing 46 changed files with 13,093 additions and 181 deletions.
4 changes: 3 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@
1. [GENERAL] Added environ AIRCRAFT_PROJECT_PREFIX to allow for custom aircraft project prefixes - @2hwk (2Cas)
1. [EFB] Read from VFS JSON5 markup for Ground > Payload page - @2hwk (2Cas)
1. [FADEC] Fadec rewrite/cleanup/commenting using cpp framework - @frankkopp (Frank Kopp)
1. [EFB] Added warning for not compatible aircraft type to simbrief import - @2hwk (2Cas)
1. [EFCS] Fix ground spoiler retraction after increasing TLA slightly above 0 - @lukecologne (luke)
1. [FWC] Improved LDG LT memo to take into account light position - @BravoMike99 (bruno_pt99)
1. [PRESS] Add pressurization system failures - @mjuhe (Miquel Juhe)
1. [EFB] Added simrate indicator to status bar - @2hwk (2Cas)
1. [EFB] Added simrate and pause on TOD controls to control center - @2hwk (2Cas)
1. [FMS] Implement missed approach route - @Benjozork (Benjamin Dupont), @tracernz (Mike), @saschl (saschl#9432), @BlueberryKing (BlueberryKing)
1. [AUTOFLIGHT] Implement NAV IN GA - @lukecologne (luke)
1. [FMS] Implement ability to program alternate routing - @Benjozork (Benjamin Dupont), @tracernz (Mike), @saschl (saschl#9432), @BlueberryKing (BlueberryKing)
Expand Down Expand Up @@ -156,7 +159,6 @@
1. [EFB/ATSU] Use MSFS METAR data rather than FSX cloud data from FBW API - @tracernz (Mike)
1. [APU] Added xfeed APU fuel capabilities - @Taz5150 (TazX [Z+1]#0405)
1. [ATSU] Fix ATIS Auto Update LSK6L to ATIS page instead of ATC MENU - @BravoMike99 (bruno_pt99)
1. [EFB] Added warning for not compatible aircraft type to simbrief import - @2hwk (2Cas)

## 0.10.0

Expand Down
58 changes: 58 additions & 0 deletions fbw-a32nx/docs/a320-simvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
- [Landing Gear (ATA 32)](#landing-gear-ata-32)
- [ATC (ATA 34)](#atc-ata-34)
- [Radio Altimeter (ATA 34)](#radio-altimeter-ata-34)
- [GPWS / TAWS (ATA 34)](#gpws--taws-ata-34)
- [ROW / ROP / OANS (ATA 34)](#row--rop--oans-ata-34)
- [Electronic Flight Bag (ATA 46)](#electronic-flight-bag-ata-46)

## Uncategorized
Expand Down Expand Up @@ -3916,6 +3918,62 @@ In the variables below, {number} should be replaced with one item in the set: {
- 1
- 2

## GPWS / TAWS (ATA 34)
- `A32NX_EGPWS_ALERT_{1 | 2}_DISCRETE_WORD_1`
- Data word for GPWS alerts. Used for displaying alerts on the PFD (on the A380) and triggering aural warnings
- Arinc429<Discrete>
- | Bit | Description |
|:---:|:----------------------:|
| 11 | SINKRATE |
| 12 | PULL UP |
| 13 | TERRAIN |
| 14 | DON'T SINK |
| 15 | TOO LOW GEAR |
| 16 | TOO LOW FLAPS |
| 17 | TOO LOW TERRAIN |
| 18 | GLIDESLOPE |
| 20 | TERRAIN PULL UP |
| 22 | TERRAIN AHEAD PULL UP |
| 27 | TERRAIN AHEAD |

- `A32NX_EGPWS_ALERT_{1 | 2}_DISCRETE_WORD_2`
- Data word for GPWS alerts. Used for displaying alerts on the PFD (on the A380) or on the GPWS visual indicators on the A320
- Arinc429<Discrete>
- | Bit | Description |
|:---:|:----------------------------:|
| 11 | G/S CANCEL |
| 12 | GPWS ALERT |
| 13 | GPWS WARNING |
| 14 | GPWS INOP |
| 15 | W/S WARNING |
| 16 | AUDIO ON |
| 22 | TERRAIN AWARENESS WARNING |
| 23 | TERRAIN AWARENESS CAUTION |
| 24 | TERRAIN AWARENESS INOP |
| 25 | EXTERNAL FAULT |
| 26 | TERRAIN AWARENESS NOT AVAIL. |

## ROW / ROP / OANS (ATA 34)

- A32NX_ROW_ROP_WORD_1
- Data word for ROW and ROP functions. Used for displaying alerts on the PFD.
- Arinc429<Discrete>
- | Bit | Description |
|:---:|:---------------------------------:|
| 11 | ROW/ROP operative |
| 12 | ROP: Active with autobrake |
| 13 | ROP: Active with manual braking |
| 14 | ROW Wet: Runway too short |
| 15 | ROW Dry: Runway too short |

- A32NX_OANS_WORD_1
- Data word for OANS functions. Used for displaying alerts on the PFD.
- Arinc429<Discrete>
- | Bit | Description |
|:---:|:---------------------------------:|
| 11 | OANS: Runway ahead |


## Electronic Flight Bag (ATA 46)

- A32NX_PUSHBACK_SYSTEM_ENABLED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class CDUPerformancePage {
const transAlt = targetPlan.performanceData.transitionAltitude;
const transAltitudeIsFromDatabase = targetPlan.performanceData.transitionAltitudeIsFromDatabase;

if (transAlt !== undefined) {
if (transAlt !== null) {
transAltCell = `{cyan}${transAlt}{end}`;
if (transAltitudeIsFromDatabase) {
transAltCell += "[s-text]";
Expand All @@ -203,7 +203,7 @@ class CDUPerformancePage {
const eoAcc = plan.performanceData.engineOutAccelerationAltitude;
const eoAccPilot = plan.performanceData.engineOutAccelerationAltitudeIsPilotEntered;

const thrRedAcc = `{${thrRedPilot ? 'big' : 'small'}}${thrRed !== undefined ? thrRed.toFixed(0).padStart(5, '\xa0') : '-----'}{end}/{${accPilot ? 'big' : 'small'}}${acc !== undefined ? acc.toFixed(0).padEnd(5, '\xa0') : '-----'}{end}`;
const thrRedAcc = `{${thrRedPilot ? 'big' : 'small'}}${thrRed !== null ? thrRed.toFixed(0).padStart(5, '\xa0') : '-----'}{end}/{${accPilot ? 'big' : 'small'}}${acc !== null ? acc.toFixed(0).padEnd(5, '\xa0') : '-----'}{end}`;

mcdu.onLeftInput[4] = (value, scratchpadCallback) => {
if (mcdu.trySetThrustReductionAccelerationAltitude(value)) {
Expand All @@ -214,7 +214,7 @@ class CDUPerformancePage {
};

// eng out acceleration altitude
const engOut = `{${eoAccPilot ? 'big' : 'small'}}${eoAcc !== undefined ? eoAcc.toFixed(0).padStart(5, '\xa0') : '-----'}{end}`;
const engOut = `{${eoAccPilot ? 'big' : 'small'}}${eoAcc !== null ? eoAcc.toFixed(0).padStart(5, '\xa0') : '-----'}{end}`;
mcdu.onRightInput[4] = (value, scratchpadCallback) => {
if (mcdu.trySetEngineOutAcceleration(value)) {
CDUPerformancePage.ShowTAKEOFFPage(mcdu);
Expand Down Expand Up @@ -849,7 +849,7 @@ class CDUPerformancePage {
if (hasDestination) {
const transitionLevel = plan.performanceData.transitionLevel;

if (transitionLevel !== undefined) {
if (transitionLevel !== null) {
transAltCell = (transitionLevel * 100).toFixed(0).padEnd(5, "\xa0");

if (plan.performanceData.transitionLevelIsFromDatabase) {
Expand Down Expand Up @@ -1019,8 +1019,8 @@ class CDUPerformancePage {
const eoAcc = plan.performanceData.missedEngineOutAccelerationAltitude;
const eoAccPilot = plan.performanceData.missedEngineOutAccelerationAltitudeIsPilotEntered;

const thrRedAcc = `{${thrRedPilot ? 'big' : 'small'}}${thrRed !== undefined ? thrRed.toFixed(0).padStart(5, '\xa0') : '-----'}{end}/{${accPilot ? 'big' : 'small'}}${acc !== undefined ? acc.toFixed(0).padEnd(5, '\xa0') : '-----'}{end}`;
const engOut = `{${eoAccPilot ? 'big' : 'small'}}${eoAcc !== undefined ? eoAcc.toFixed(0).padStart(5, '\xa0') : '-----'}{end}`;
const thrRedAcc = `{${thrRedPilot ? 'big' : 'small'}}${thrRed !== null ? thrRed.toFixed(0).padStart(5, '\xa0') : '-----'}{end}/{${accPilot ? 'big' : 'small'}}${acc !== null ? acc.toFixed(0).padEnd(5, '\xa0') : '-----'}{end}`;
const engOut = `{${eoAccPilot ? 'big' : 'small'}}${eoAcc !== null ? eoAcc.toFixed(0).padStart(5, '\xa0') : '-----'}{end}`;

mcdu.onLeftInput[4] = (value, scratchpadCallback) => {
if (mcdu.trySetThrustReductionAccelerationAltitudeGoaround(value)) {
Expand Down
121 changes: 79 additions & 42 deletions fbw-a32nx/src/systems/fmgc/src/guidance/vnav/descent/TodGuidance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AircraftToDescentProfileRelation } from '@fmgc/guidance/vnav/descent/Ai
import { VerticalProfileComputationParametersObserver } from '@fmgc/guidance/vnav/VerticalProfileComputationParameters';
import { LateralMode } from '@shared/autopilot';
import { FmgcFlightPhase } from '@shared/flightphase';
import { NXDataStore, PopUpDialog } from '@flybywiresim/fbw-sdk';
import { LocalSimVar, NXDataStore, PopUpDialog } from '@flybywiresim/fbw-sdk';

const TIMEOUT = 10_000;

Expand All @@ -16,6 +16,12 @@ export class TodGuidance {

private tdPaused: boolean;

private tdArmed: LocalSimVar<boolean>;

private pauseAtTodDistance: number;

private tdPauseEnabled: boolean;

private apEngaged: boolean;

private cooldown: number;
Expand All @@ -29,6 +35,33 @@ export class TodGuidance {
this.apEngaged = false;
this.tdReached = false;
this.tdPaused = false;
this.tdPauseEnabled = false;
this.tdArmed = new LocalSimVar('L:A32NX_PAUSE_AT_TOD_ARMED', 'bool');

NXDataStore.getAndSubscribe(
'PAUSE_AT_TOD_DISTANCE',
(_, value: string) => {
const pF = parseFloat(value);
if (isNaN(pF)) {
this.pauseAtTodDistance = 0;
} else {
this.pauseAtTodDistance = pF;
}
},
'10',
);

NXDataStore.getAndSubscribe(
'PAUSE_AT_TOD',
(_, value: string) => {
if (value === 'ENABLED') {
this.tdPauseEnabled = true;
} else {
this.tdPauseEnabled = false;
}
},
'DISABLED',
);
}

showPausePopup(title: string, message: string) {
Expand All @@ -44,61 +77,65 @@ export class TodGuidance {

update(deltaTime: number) {
this.updateTdReached(deltaTime);
this.updateTdPause(deltaTime);
if (this.tdPauseEnabled) {
this.updateTdPause(deltaTime);
}
}

updateTdPause(deltaTime: number) {
if (this.cooldown <= 0 && NXDataStore.get('PAUSE_AT_TOD', 'DISABLED') === 'ENABLED') {
// Only watching if T/D pause untriggered + between flight phase CLB and CRZ
if (
// Only armed if all conditions met
this.tdArmed.setVar(
this.cooldown <= 0 &&
!this.tdPaused &&
this.observer.get().flightPhase >= FmgcFlightPhase.Climb &&
this.observer.get().flightPhase <= FmgcFlightPhase.Cruise &&
Simplane.getAutoPilotAirspeedManaged()
Simplane.getAutoPilotAirspeedManaged(),
);

if (this.tdArmed.getVar()) {
// Check T/D pause first
if (
(this.aircraftToDescentProfileRelation.distanceToTopOfDescent() ?? Number.POSITIVE_INFINITY) <
this.pauseAtTodDistance
) {
this.tdPaused = true;
this.showPausePopup(
'TOP OF DESCENT',
`Paused before the calculated top of descent. System Time was ${new Date().toLocaleTimeString()}.`,
);
// Check A/P mode reversion
} else if (
// Only guard A/P above transitional altitude
this.atmosphericConditions.currentAltitude
? this.atmosphericConditions.currentAltitude > this.observer.get().originTransitionAltitude
: false
) {
// Check T/D pause first, then AP mode reversion
if (
(this.aircraftToDescentProfileRelation.distanceToTopOfDescent() ?? Number.POSITIVE_INFINITY) <
parseFloat(NXDataStore.get('PAUSE_AT_TOD_DISTANCE', '10'))
) {
this.tdPaused = true;
const apActive =
SimVar.GetSimVarValue('L:A32NX_AUTOPILOT_ACTIVE', 'boolean') &&
SimVar.GetSimVarValue('L:A32NX_FMA_LATERAL_MODE', 'Enum') === LateralMode.NAV;

if (this.apEngaged && !apActive) {
this.showPausePopup(
'TOP OF DESCENT',
`Paused before the calculated top of descent. System Time was ${new Date().toLocaleTimeString()}.`,
'AP PROTECTION',
`Autopilot or lateral guidance disengaged before the calculated top of descent. System Time was ${new Date().toLocaleTimeString()}.`,
);
// Only guard AP above transitional altitude
} else if (
this.atmosphericConditions.currentAltitude
? this.atmosphericConditions.currentAltitude > this.observer.get().originTransitionAltitude
: false
) {
const apActive =
SimVar.GetSimVarValue('L:A32NX_AUTOPILOT_ACTIVE', 'boolean') &&
SimVar.GetSimVarValue('L:A32NX_FMA_LATERAL_MODE', 'Enum') === LateralMode.NAV;

if (this.apEngaged && !apActive) {
this.showPausePopup(
'AP PROTECTION',
`Autopilot or lateral guidance disengaged before the calculated top of descent. System Time was ${new Date().toLocaleTimeString()}.`,
);
}

if (this.apEngaged !== apActive) {
this.apEngaged = apActive;
}
}
}

// Reset flags on turnaround
if (
this.observer.get().flightPhase === FmgcFlightPhase.Done ||
this.observer.get().flightPhase === FmgcFlightPhase.Preflight
) {
this.tdPaused = false;
this.apEngaged = false;
if (this.apEngaged !== apActive) {
this.apEngaged = apActive;
}
}
}

// Reset flags on turnaround
if (
this.observer.get().flightPhase === FmgcFlightPhase.Done ||
this.observer.get().flightPhase === FmgcFlightPhase.Preflight
) {
this.tdPaused = false;
this.apEngaged = false;
}
// Iterate backoff timer
if (this.cooldown > 0) {
this.cooldown = Math.max(0, this.cooldown - deltaTime);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,43 @@
</Requires>
</Sound>

<!-- Stall warning =====================================================================-->
<Sound WwiseEvent="aural_stall_new" WwiseData="true" NodeName="PEDALS_LEFT" LocalVar="A32NX_AUDIO_STALL_WARNING" Continuous="true">
<Range LowerBound="1"/>
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>
</Sound>

<!-- ROP/ROW warnings =====================================================================-->
<Sound WwiseEvent="brake_max_braking" WwiseData="true" NodeName="Wiper_Base_l" LocalVar="A32NX_AUDIO_ROP_MAX_BRAKING" Continuous="true">
<Range LowerBound="1"/>
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>
</Sound>

<Sound WwiseEvent="set_max_reverse" WwiseData="true" NodeName="Wiper_Base_l" LocalVar="A32NX_AUDIO_ROW_SET_MAX_REVERSE" Continuous="true">
<Range LowerBound="1"/>
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>
</Sound>

<Sound WwiseEvent="keep_max_reverse" WwiseData="true" NodeName="Wiper_Base_l" LocalVar="A32NX_AUDIO_ROP_KEEP_MAX_REVERSE" Continuous="false">
<Range LowerBound="1"/>
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>
</Sound>

<Sound WwiseEvent="runway_too_short" WwiseData="true" NodeName="Wiper_Base_l" LocalVar="A32NX_AUDIO_ROW_RWY_TOO_SHORT" Continuous="true">
<Range LowerBound="1"/>
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>
</Sound>

</SimVarSounds>

<!-- AvionicSounds ========================================================================================== -->
Expand Down Expand Up @@ -1186,13 +1223,6 @@
<Sound WwiseData="true" WwiseEvent="traffic_traffic" NodeName="WIPER_BASE_L" />
<Sound WwiseData="true" WwiseEvent="TCAS_sys_test_OK" NodeName="WIPER_BASE_L" />

<!-- ROPS callouts ==================================================================================== -->

<Sound WwiseData="true" WwiseEvent="brake_max_braking" NodeName="WIPER_BASE_L" />
<Sound WwiseData="true" WwiseEvent="keep_max_reverse" NodeName="WIPER_BASE_L" />
<Sound WwiseData="true" WwiseEvent="runway_too_short" NodeName="WIPER_BASE_L" />
<Sound WwiseData="true" WwiseEvent="set_max_reverse" NodeName="WIPER_BASE_L" />

</AvionicSounds>

<!-- AnimationSounds ========================================================================================== -->
Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit a2a8d81

Please sign in to comment.