Skip to content

Commit

Permalink
Merge remote-tracking branch 'fbw/master' into fms-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Saschl committed Nov 29, 2023
2 parents 76da7a7 + 4825cd3 commit e0c2076
Show file tree
Hide file tree
Showing 180 changed files with 3,446 additions and 4,359 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
/fbw-a380x/.env.local
!/fbw-a380x/README.md
!/fbw-a380x/mach.config.js
!/fbw-a380x/.env
!/fbw-a380x/docs/
!/fbw-a380x/docs/**
!/fbw-a380x/src/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// Copyright (c) 2021-2023 FlyByWire Simulations
// SPDX-License-Identifier: GPL-3.0

import { FMMessage, FMMessageTriggers } from '@flybywiresim/fbw-sdk';

import { RwyLsMismatchLeft, RwyLsMismatchRight } from '@fmgc/components/fms-messages/RwyLsMismatch';
import { SpecifiedNdbUnavailableLeft, SpecifiedNdbUnavailableRight } from '@fmgc/components/fms-messages/SpecifiedNdbUnavailable';
import { SpecifiedVorUnavailableLeft, SpecifiedVorUnavailableRight } from '@fmgc/components/fms-messages/SpecifiedVorUnavailable';
import { TuneNavaidLeft, TuneNavaidRight } from '@fmgc/components/fms-messages/TuneNavaid';
import { TurnAreaExceedanceLeft, TurnAreaExceedanceRight } from '@fmgc/components/fms-messages/TurnAreaExceedance';
import { TdReached } from '@fmgc/components/fms-messages/TdReached';
import { FMMessage, FMMessageTriggers } from '@shared/FmMessages';
import { StepAhead } from '@fmgc/components/fms-messages/StepAhead';
import { StepDeleted } from '@fmgc/components/fms-messages/StepDeleted';
import { FlightPlanService } from '@fmgc/flightplanning/new/FlightPlanService';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { FMMessage, FMMessageTypes } from '@shared/FmMessages';
// Copyright (c) 2021-2023 FlyByWire Simulations
//
// SPDX-License-Identifier: GPL-3.0

import { FMMessage, FMMessageTypes } from '@flybywiresim/fbw-sdk';

import { FMMessageSelector, FMMessageUpdate } from './FmsMessages';

export class GpsPrimary implements FMMessageSelector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//
// SPDX-License-Identifier: GPL-3.0

import { FMMessage, FMMessageTypes } from '@shared/FmMessages';
import { ConfirmationNode, Trigger } from '@flybywiresim/fbw-sdk';
import { FMMessage, FMMessageTypes, ConfirmationNode, Trigger } from '@flybywiresim/fbw-sdk';

import { FMMessageSelector, FMMessageUpdate } from './FmsMessages';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//
// SPDX-License-Identifier: GPL-3.0

import { FMMessage, FMMessageTypes } from '@shared/FmMessages';
import { Trigger } from '@flybywiresim/fbw-sdk';
import { FMMessage, FMMessageTypes, Trigger } from '@flybywiresim/fbw-sdk';

import { FMMessageSelector, FMMessageUpdate } from './FmsMessages';

abstract class MapPartlyDisplayed implements FMMessageSelector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//
// SPDX-License-Identifier: GPL-3.0

import { FMMessage, FMMessageTypes, Trigger } from '@flybywiresim/fbw-sdk';

import { NavaidTuner } from '@fmgc/navigation/NavaidTuner';
import { FMMessage, FMMessageTypes } from '@shared/FmMessages';
import { Trigger } from '@flybywiresim/fbw-sdk';
import { FMMessageSelector, FMMessageUpdate } from './FmsMessages';

abstract class RwyLsMismatch implements FMMessageSelector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// SPDX-License-Identifier: GPL-3.0

import { NavaidTuner } from '@fmgc/navigation/NavaidTuner';
import { FMMessage, FMMessageTypes } from '@shared/FmMessages';
import { Trigger } from '@flybywiresim/fbw-sdk';
import { Trigger, FMMessage, FMMessageTypes } from '@flybywiresim/fbw-sdk';
import { FMMessageSelector, FMMessageUpdate } from './FmsMessages';

abstract class SpecifiedNdbUnavailable implements FMMessageSelector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//
// SPDX-License-Identifier: GPL-3.0

import { Trigger, FMMessage, FMMessageTypes } from '@flybywiresim/fbw-sdk';

import { NavaidTuner } from '@fmgc/navigation/NavaidTuner';
import { FMMessage, FMMessageTypes } from '@shared/FmMessages';
import { Trigger } from '@flybywiresim/fbw-sdk';
import { FMMessageSelector, FMMessageUpdate } from './FmsMessages';

abstract class SpecifiedVorUnavailable implements FMMessageSelector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
// SPDX-License-Identifier: GPL-3.0

import { GuidanceController } from '@fmgc/guidance/GuidanceController';
import { FMMessageTypes } from '@shared/FmMessages';
import { FlightPlanService } from '@fmgc/flightplanning/new/FlightPlanService';
import { FMMessageTypes } from '@flybywiresim/fbw-sdk';

import { FMMessageSelector, FMMessageUpdate } from './FmsMessages';

export class StepAhead implements FMMessageSelector {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { FMMessage, FMMessageTypes } from '@shared/FmMessages';
// Copyright (c) 2021-2023 FlyByWire Simulations
//
// SPDX-License-Identifier: GPL-3.0

import { FMMessage, FMMessageTypes } from '@flybywiresim/fbw-sdk';

import { FMMessageSelector, FMMessageUpdate } from './FmsMessages';

export class StepDeleted implements FMMessageSelector {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { FMMessage, FMMessageTypes } from '@shared/FmMessages';
// Copyright (c) 2021-2023 FlyByWire Simulations
//
// SPDX-License-Identifier: GPL-3.0

import { FMMessage, FMMessageTypes } from '@flybywiresim/fbw-sdk';

import { FMMessageSelector, FMMessageUpdate } from './FmsMessages';

export class TdReached implements FMMessageSelector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// SPDX-License-Identifier: GPL-3.0

import { NavaidTuner } from '@fmgc/navigation/NavaidTuner';
import { FMMessage, FMMessageTypes } from '@shared/FmMessages';
import { Trigger } from '@flybywiresim/fbw-sdk';
import { FMMessage, FMMessageTypes, Trigger } from '@flybywiresim/fbw-sdk';
import { FMMessageSelector, FMMessageUpdate } from './FmsMessages';

abstract class TuneNavaid implements FMMessageSelector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
//
// SPDX-License-Identifier: GPL-3.0

import { FMMessage, FMMessageTypes, Trigger } from '@flybywiresim/fbw-sdk';

import { GuidanceController } from '@fmgc/guidance/GuidanceController';
import { PILeg } from '@fmgc/guidance/lnav/legs/PI';
import { Navigation } from '@fmgc/navigation/Navigation';
import { FMMessage, FMMessageTypes } from '@shared/FmMessages';
import { Trigger } from '@flybywiresim/fbw-sdk';
import { FlightPlanIndex } from '@fmgc/flightplanning/new/FlightPlanManager';
import { FMMessageSelector, FMMessageUpdate } from './FmsMessages';

Expand Down
2 changes: 1 addition & 1 deletion fbw-a32nx/src/systems/fmgc/src/efis/EfisCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: GPL-3.0

import { EfisNdMode, EfisNdRangeValue } from '@shared/NavigationDisplay';
import { EfisNdMode, EfisNdRangeValue } from '@flybywiresim/fbw-sdk';
import { Coordinates } from '@fmgc/flightplanning/data/geo';

export function withinEditArea(lla: Coordinates, range: EfisNdRangeValue, mode: EfisNdMode, planCentre: Coordinates, trueHeading: DegreesTrue): boolean {
Expand Down
15 changes: 11 additions & 4 deletions fbw-a32nx/src/systems/fmgc/src/efis/EfisSymbols.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
// Copyright (c) 2021-2023 FlyByWire Simulations
// SPDX-License-Identifier: GPL-3.0

import { GenericDataListenerSync, MathUtils, Airport, LegType, Runway, RunwaySurfaceType, VhfNavaidType, WaypointDescriptor } from '@flybywiresim/fbw-sdk';
import { EfisOption, EfisNdMode, NdSymbol, NdSymbolTypeFlags, rangeSettings, EfisNdRangeValue } from '@shared/NavigationDisplay';
import {
GenericDataListenerSync,
MathUtils, Airport, LegType,
Runway, RunwaySurfaceType, VhfNavaidType,
WaypointDescriptor, EfisOption, EfisNdMode, NdSymbol,
NdSymbolTypeFlags, EfisNdRangeValue, efisRangeSettings,
} from '@flybywiresim/fbw-sdk';

import { Coordinates } from '@fmgc/flightplanning/data/geo';
import { Geometry } from '@fmgc/guidance/Geometry';
import { GuidanceController } from '@fmgc/guidance/GuidanceController';
Expand All @@ -19,11 +25,12 @@ import { NavaidTuner } from '@fmgc/navigation/NavaidTuner';
import { getFlightPhaseManager } from '@fmgc/flightphase';
import { FmgcFlightPhase } from '@shared/flightphase';
import { FlightPlanLeg } from '@fmgc/flightplanning/new/legs/FlightPlanLeg';
import { WaypointConstraintType } from '@fmgc/flightplanning/FlightPlanManager';

import { FlightPlanService } from '@fmgc/flightplanning/new/FlightPlanService';
import { AltitudeConstraintType } from '@fmgc/flightplanning/data/constraint';
import { VnavConfig } from '@fmgc/guidance/vnav/VnavConfig';
import { EfisInterface } from '@fmgc/efis/EfisInterface';
import { WaypointConstraintType } from '@fmgc/flightplanning/FlightPlanManager';

export class EfisSymbols {
private blockUpdate = false;
Expand Down Expand Up @@ -159,7 +166,7 @@ export class EfisSymbols {
const hasSuitableRunway = (airport: Airport): boolean => airport.longestRunwayLength >= 1500 && airport.longestRunwaySurfaceType === RunwaySurfaceType.Hard;

for (const side of EfisSymbols.sides) {
const range = rangeSettings[SimVar.GetSimVarValue(`L:A32NX_EFIS_${side}_ND_RANGE`, 'number')];
const range = efisRangeSettings[SimVar.GetSimVarValue(`L:A32NX_EFIS_${side}_ND_RANGE`, 'number')];
const mode: EfisNdMode = SimVar.GetSimVarValue(`L:A32NX_EFIS_${side}_ND_MODE`, 'number');
const efisOption = SimVar.GetSimVarValue(`L:A32NX_EFIS_${side}_OPTION`, 'Enum');

Expand Down
4 changes: 2 additions & 2 deletions fbw-a32nx/src/systems/fmgc/src/efis/EfisVectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
//
// SPDX-License-Identifier: GPL-3.0

import { GenericDataListenerSync } from '@flybywiresim/fbw-sdk';
import { EfisSide, EfisVectorsGroup, GenericDataListenerSync } from '@flybywiresim/fbw-sdk';

import { GuidanceController } from '@fmgc/guidance/GuidanceController';
import { EfisSide, EfisVectorsGroup } from '@shared/NavigationDisplay';
import { PathVector, pathVectorLength, pathVectorValid } from '@fmgc/guidance/lnav/PathVector';
import { ArmedLateralMode, isArmed, LateralMode } from '@shared/autopilot';
import { FlightPlanIndex } from '@fmgc/flightplanning/new/FlightPlanManager';
Expand Down
2 changes: 1 addition & 1 deletion fbw-a32nx/src/systems/fmgc/src/guidance/FmsState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: GPL-3.0

import { EfisNdMode, EfisNdRangeValue } from '@shared/NavigationDisplay';
import { EfisNdMode, EfisNdRangeValue } from '@flybywiresim/fbw-sdk';

export interface FmsState {
leftEfisState: EfisState,
Expand Down
7 changes: 4 additions & 3 deletions fbw-a32nx/src/systems/fmgc/src/guidance/GuidanceController.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
// Copyright (c) 2021-2023 FlyByWire Simulations
// SPDX-License-Identifier: GPL-3.0

import { EfisSide, EfisNdMode, efisRangeSettings, ApproachUtils, SimVarString, ApproachType, LegType } from '@flybywiresim/fbw-sdk';

import { Geometry } from '@fmgc/guidance/Geometry';
import { PseudoWaypoint } from '@fmgc/guidance/PseudoWaypoint';
import { PseudoWaypoints } from '@fmgc/guidance/lnav/PseudoWaypoints';
import { EfisVectors } from '@fmgc/efis/EfisVectors';
import { Coordinates } from '@fmgc/flightplanning/data/geo';
import { EfisState } from '@fmgc/guidance/FmsState';
import { EfisNdMode, EfisSide, rangeSettings } from '@shared/NavigationDisplay';
import { TaskCategory, TaskQueue } from '@fmgc/guidance/TaskQueue';
import { FlightPlanService } from '@fmgc/flightplanning/new/FlightPlanService';
import { GeometryFactory } from '@fmgc/guidance/geometry/GeometryFactory';
import { FlightPlanIndex } from '@fmgc/flightplanning/new/FlightPlanManager';
import { HMLeg } from '@fmgc/guidance/lnav/legs/HX';
import { ApproachUtils, SimVarString, ApproachType, LegType } from '@flybywiresim/fbw-sdk';

import { getFlightPhaseManager } from '@fmgc/flightphase';
import { FmgcFlightPhase } from '@shared/flightphase';

Expand Down Expand Up @@ -154,7 +155,7 @@ export class GuidanceController {

private updateEfisState(side: EfisSide, state: EfisState): void {
const ndMode = SimVar.GetSimVarValue(`L:A32NX_EFIS_${side}_ND_MODE`, 'Enum') as EfisNdMode;
const ndRange = rangeSettings[SimVar.GetSimVarValue(`L:A32NX_EFIS_${side}_ND_RANGE`, 'Enum')];
const ndRange = efisRangeSettings[SimVar.GetSimVarValue(`L:A32NX_EFIS_${side}_ND_RANGE`, 'Enum')];

if (state?.mode !== ndMode || state?.range !== ndRange) {
this.taskQueue.cancelAllInCategory(TaskCategory.EfisVectors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
PseudoWaypointSequencingAction,
} from '@fmgc/guidance/PseudoWaypoint';
import { VnavConfig, VnavDescentMode } from '@fmgc/guidance/vnav/VnavConfig';
import { NdSymbolTypeFlags } from '@shared/NavigationDisplay';
import { NdSymbolTypeFlags } from '@flybywiresim/fbw-sdk';
import { Geometry } from '@fmgc/guidance/Geometry';
import { Coordinates } from '@fmgc/flightplanning/data/geo';
import { GuidanceController } from '@fmgc/guidance/GuidanceController';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Copyright (c) 2021-2023 FlyByWire Simulations
//
// SPDX-License-Identifier: GPL-3.0

import { SimVarValueType } from '@microsoft/msfs-sdk';
import { EfisSide } from '@shared/NavigationDisplay';
import { ArincEventBus, EfisSide } from '@flybywiresim/fbw-sdk';

import { AdirsSimVars, SwitchingPanelVSimVars } from './SimVarTypes';
import { ArincEventBus } from './ArincEventBus';
import { UpdatableSimVarPublisher } from './UpdatableSimVarPublisher';

export class AdirsValueProvider<T extends AdirsSimVars> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// SPDX-License-Identifier: GPL-3.0

import { EventBus, SimVarDefinition, SimVarPublisher, SimVarValueType, Subject } from '@microsoft/msfs-sdk';
import { Arinc429WordData } from '@flybywiresim/fbw-sdk';
import { Arinc429RegisterSubject } from '../Arinc429RegisterSubject';
import { Arinc429WordData, Arinc429RegisterSubject } from '@flybywiresim/fbw-sdk';
import { AdirsSimVars } from '../SimVarTypes';

export interface DmcLogicEvents {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Copyright (c) 2021-2023 FlyByWire Simulations
//
// SPDX-License-Identifier: GPL-3.0

import { EventBus, SimVarPublisher, SimVarValueType } from '@microsoft/msfs-sdk';
import { EfisSide } from '@shared/NavigationDisplay';
import { EfisSide } from '@flybywiresim/fbw-sdk';

export enum TerrainLevelMode {
PeaksMode = 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Copyright (c) 2021-2023 FlyByWire Simulations
//
// SPDX-License-Identifier: GPL-3.0

import { EventBus, SimVarPublisher, SimVarValueType } from '@microsoft/msfs-sdk';
import { EfisNdMode, EfisOption, EfisSide, NavAidMode } from '@shared/NavigationDisplay';
import { EfisNdMode, EfisOption, EfisSide, NavAidMode } from '@flybywiresim/fbw-sdk';

export interface FcuSimVars {
ndRangeSetting: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// SPDX-License-Identifier: GPL-3.0

import { BasePublisher, EventBus } from '@microsoft/msfs-sdk';
import { EfisSide, NdSymbol, NdTraffic } from '@shared/NavigationDisplay';
import { EfisSide, NdSymbol, NdTraffic, GenericDataListenerSync } from '@flybywiresim/fbw-sdk';

import { PathVector } from '@fmgc/guidance/lnav/PathVector';
import { GenericDataListenerSync } from '@flybywiresim/fbw-sdk';

export interface FmsSymbolsData {
symbols: NdSymbol[],
Expand Down
6 changes: 5 additions & 1 deletion fbw-a32nx/src/systems/instruments/src/ND/NDControlEvents.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Copyright (c) 2021-2023 FlyByWire Simulations
//
// SPDX-License-Identifier: GPL-3.0

/**
* Events for internal ND communication between components
*/
import { EfisNdMode } from '@shared/NavigationDisplay';
import { EfisNdMode } from '@flybywiresim/fbw-sdk';

export interface NDControlEvents {
/**
Expand Down
37 changes: 32 additions & 5 deletions fbw-a32nx/src/systems/instruments/src/ND/instrument.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// Copyright (c) 2021-2023 FlyByWire Simulations
//
// SPDX-License-Identifier: GPL-3.0

import { Clock, FsBaseInstrument, FSComponent, FsInstrument, HEventPublisher, InstrumentBackplane, Subject } from '@microsoft/msfs-sdk';
import { EfisSide } from '@shared/NavigationDisplay';
import { NDComponent } from './ND';
import { ArincEventBus, EfisSide } from '@flybywiresim/fbw-sdk';
import { NDComponent } from '@flybywiresim/navigation-display';

import { NDSimvarPublisher, NDSimvars } from './NDSimvarPublisher';
import { AdirsValueProvider } from '../MsfsAvionicsCommon/AdirsValueProvider';
import { FmsDataPublisher } from '../MsfsAvionicsCommon/providers/FmsDataPublisher';
Expand All @@ -9,11 +14,10 @@ import { VorBusPublisher } from '../MsfsAvionicsCommon/providers/VorBusPublisher
import { TcasBusPublisher } from '../MsfsAvionicsCommon/providers/TcasBusPublisher';
import { FGDataPublisher } from '../MsfsAvionicsCommon/providers/FGDataPublisher';
import { NDControlEvents } from './NDControlEvents';
import { getDisplayIndex } from '../MsfsAvionicsCommon/displayUnit';
import { DisplayUnit, getDisplayIndex } from '../MsfsAvionicsCommon/displayUnit';
import { EgpwcBusPublisher } from '../MsfsAvionicsCommon/providers/EgpwcBusPublisher';
import { DmcPublisher } from '../MsfsAvionicsCommon/providers/DmcPublisher';
import { FMBusPublisher } from '../MsfsAvionicsCommon/providers/FMBusPublisher';
import { ArincEventBus } from '../MsfsAvionicsCommon/ArincEventBus';
import { FcuBusPublisher } from '../MsfsAvionicsCommon/providers/FcuBusPublisher';

import './style.scss';
Expand Down Expand Up @@ -53,6 +57,12 @@ class NDInstrument implements FsInstrument {

private readonly clock: Clock;

private displayBrightness = Subject.create(0);

private displayFailed = Subject.create(false);

private displayPowered = Subject.create(false);

constructor() {
const side: EfisSide = getDisplayIndex() === 1 ? 'L' : 'R';
const stateSubject = Subject.create<'L' | 'R'>(side);
Expand Down Expand Up @@ -99,7 +109,24 @@ class NDInstrument implements FsInstrument {

this.adirsValueProvider.start();

FSComponent.render(<NDComponent bus={this.bus} side={this.efisSide} />, document.getElementById('ND_CONTENT'));
const sub = this.bus.getSubscriber<NDSimvars>();

const isCaptainSide = getDisplayIndex() === 1;

sub.on(isCaptainSide ? 'potentiometerCaptain' : 'potentiometerFo').whenChanged().handle((value) => {
this.displayBrightness.set(value);
});

sub.on(isCaptainSide ? 'elec' : 'elecFo').whenChanged().handle((value) => {
this.displayPowered.set(value);
});

FSComponent.render(
<DisplayUnit bus={this.bus} brightness={this.displayBrightness} powered={this.displayPowered} failed={this.displayFailed} normDmc={getDisplayIndex()}>
<NDComponent bus={this.bus} side={this.efisSide} />
</DisplayUnit>,
document.getElementById('ND_CONTENT'),
);

// Remove "instrument didn't load" text
document.getElementById('ND_CONTENT').querySelector(':scope > h1').remove();
Expand Down
Loading

0 comments on commit e0c2076

Please sign in to comment.