Skip to content

Commit

Permalink
[OANS] draw stop line, update DRY/WET lines, visualize overrun status
Browse files Browse the repository at this point in the history
  • Loading branch information
flogross89 committed Apr 8, 2024
1 parent 526e704 commit c7a87b9
Show file tree
Hide file tree
Showing 8 changed files with 254 additions and 106 deletions.
14 changes: 8 additions & 6 deletions fbw-a380x/src/systems/instruments/src/ND/OansControlPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import {
ArraySubject, ClockEvents, ComponentProps, DisplayComponent, EventBus, FSComponent,
MapSubject, MappedSubject, MappedSubscribable, SimVarValueType, Subject, Subscribable, Subscription, VNode,
} from '@microsoft/msfs-sdk';
import { BrakeToVacateUtils, ControlPanelAirportSearchMode, ControlPanelStore, ControlPanelUtils, FmsDataStore, NavigraphAmdbClient, OansControlEvents, globalToAirportCoordinates } from '@flybywiresim/oanc';
import { BrakeToVacateUtils, ControlPanelAirportSearchMode, ControlPanelStore, ControlPanelUtils, FmsDataStore, FmsOansDataArinc429, NavigraphAmdbClient, OansControlEvents, globalToAirportCoordinates } from '@flybywiresim/oanc';
import { AmdbAirportSearchResult, Arinc429RegisterSubject, EfisSide, FeatureType, FeatureTypeString, MathUtils, MsfsBackend, Runway } from '@flybywiresim/fbw-sdk';

import { FmsOansData, FmsOansDataArinc429 } from 'instruments/src/MsfsAvionicsCommon/providers/FmsOansPublisher';
import { Button } from 'instruments/src/ND/UI/Button';
import { OansRunwayInfoBox } from 'instruments/src/ND/OANSRunwayInfoBox';
import { DropdownMenu } from './UI/DropdownMenu';
Expand Down Expand Up @@ -103,7 +102,7 @@ export class OansControlPanel extends DisplayComponent<OansProps> {

private landingRunwayNavdata: Runway | undefined;

private readonly btvUtils = new BrakeToVacateUtils(this.props.bus);
private btvUtils = new BrakeToVacateUtils(this.props.bus);

private readonly airportDatabase = Subject.create('SXT59027250AA04');

Expand Down Expand Up @@ -195,9 +194,12 @@ export class OansControlPanel extends DisplayComponent<OansProps> {
if (destination && this.navigraphAvailable.get() === true) {
const data = await this.amdbClient.getAirportData(destination, [FeatureTypeString.RunwayThreshold]);
const thresholdFeature = data.runwaythreshold?.features.filter((td) => td.properties.feattype === FeatureType.RunwayThreshold && td.properties?.idthr === it.substring(2));
if (thresholdFeature) {
this.runwayLda.set((thresholdFeature[0].properties.lda > 0 ? thresholdFeature[0].properties.lda : 0).toFixed(0));
this.runwayTora.set((thresholdFeature[0].properties.tora > 0 ? thresholdFeature[0].properties.tora : 0).toFixed(0));
if (thresholdFeature && thresholdFeature[0]?.properties.lda && thresholdFeature[0]?.properties.tora) {
this.runwayLda.set(((thresholdFeature[0].properties.lda) > 0 ? thresholdFeature[0].properties.lda : 0).toFixed(0));
this.runwayTora.set((thresholdFeature[0].properties.tora > 0 ? thresholdFeature[0]?.properties.tora : 0).toFixed(0));
} else {
this.runwayLda.set('N/A');
this.runwayTora.set('N/A');
}
} else if (destination && this.navigraphAvailable.get() === false) {
const db = NavigationDatabaseService.activeDatabase.backendDatabase;
Expand Down
29 changes: 27 additions & 2 deletions fbw-a380x/src/systems/instruments/src/ND/oans-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,39 @@
color: $display-white;
}

.oanc-label-style-btv-stop-line {
.oanc-label-style-btv-stop-line-green {
color: $display-green;
}

.oanc-label-style-btv-stop-line-green:hover {
outline: 0px;
}

.oanc-label-style-btv-stop-line-magenta {
color: $display-magenta;
}

.oanc-label-style-btv-stop-line:hover {
.oanc-label-style-btv-stop-line-magenta:hover {
outline: 0px;
}

.oanc-label-style-btv-stop-line-amber {
color: $display-amber;
}

.oanc-label-style-btv-stop-line-amber:hover {
outline: 0px;
}

.oanc-label-style-btv-stop-line-red {
color: $display-red;
}

.oanc-label-style-btv-stop-line-red:hover {
outline: 0px;
}


.oanc-button {
padding: 10px 6px;
background-color: gray;
Expand Down
261 changes: 170 additions & 91 deletions fbw-common/src/systems/instruments/src/OANC/BrakeToVacateUtils.ts

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions fbw-common/src/systems/instruments/src/OANC/BtvPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export interface BtvData {
dryStoppingDistance: number;
/** (BTV -> OANS) Wet stopping distance */
wetStoppingDistance: number;
/** (PRIM -> OANS) Remaining stop distance on ground, used for ROP */
stopBarDistance: number;
}

export enum BtvSimVars {
Expand All @@ -24,6 +26,7 @@ export enum BtvSimVars {
btvTurnAroundMaxReverseRaw = 'L:A32NX_BTV_TURNAROUND_MAX_REV',
dryStoppingDistance = 'L:A32NX_OANS_BTV_DRY_DISTANCE_ESTIMATED',
wetStoppingDistance = 'L:A32NX_OANS_BTV_WET_DISTANCE_ESTIMATED',
stopBarDistance = 'L:A32NX_OANS_BTV_STOP_BAR_DISTANCE_ESTIMATED',
}

export class BtvSimvarPublisher extends SimVarPublisher<BtvData> {
Expand All @@ -33,6 +36,7 @@ export class BtvSimvarPublisher extends SimVarPublisher<BtvData> {
['btvTurnAroundMaxReverseRaw', { name: BtvSimVars.btvTurnAroundMaxReverseRaw, type: SimVarValueType.Number }],
['dryStoppingDistance', { name: BtvSimVars.dryStoppingDistance, type: SimVarValueType.Number }],
['wetStoppingDistance', { name: BtvSimVars.wetStoppingDistance, type: SimVarValueType.Number }],
['stopBarDistance', { name: BtvSimVars.stopBarDistance, type: SimVarValueType.Number }],
])

public constructor(bus: ArincEventBus) {
Expand Down
19 changes: 16 additions & 3 deletions fbw-common/src/systems/instruments/src/OANC/Oanc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ export enum LabelStyle {
BtvSelectedRunwayEnd = 'runway-end-btv-selected',
BtvSelectedRunwayArrow = 'runway-arrow-btv-selected',
BtvSelectedExit = 'taxiway-btv-selected',
BtvStopLine = 'btv-stop-line',
BtvStopLineMagenta = 'btv-stop-line-magenta',
BtvStopLineAmber = 'btv-stop-line-amber',
BtvStopLineRed = 'btv-stop-line-red',
BtvStopLineGreen = 'btv-stop-line-green',
}

export interface Label {
Expand Down Expand Up @@ -269,15 +272,25 @@ export class Oanc<T extends number> extends DisplayComponent<OancProps<T>> {

private readonly fmsDataStore = new FmsDataStore(this.props.bus);

private readonly btvUtils = new BrakeToVacateUtils<T>(this.props.bus, this.labelManager, this.layerCanvasRefs[7], this.canvasCentreX, this.canvasCentreY);
private readonly btvUtils = new BrakeToVacateUtils<T>(
this.props.bus,
this.labelManager,
this.aircraftOnGround,
this.projectedPpos,
this.layerCanvasRefs[7],
this.canvasCentreX,
this.canvasCentreY,
this.zoomLevelIndex,
this.getZoomLevelInverseScale.bind(this),
);

// eslint-disable-next-line arrow-body-style
public usingPposAsReference = MappedSubject.create(([overlayNDMode, aircraftOnGround, aircraftWithinAirport]) => {
return (aircraftOnGround && aircraftWithinAirport) || overlayNDMode === EfisNdMode.ARC;
}, this.overlayNDModeSub, this.aircraftOnGround, this.aircraftWithinAirport);

// eslint-disable-next-line arrow-body-style
private readonly showAircraft = this.usingPposAsReference.map((it) => it);
private readonly showAircraft = this.usingPposAsReference;

private readonly aircraftX = Subject.create(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function filterLabel(label: Label, filter: OancLabelFilter, fmsDepRunway?
} if (label.style === LabelStyle.BtvSelectedRunwayArrow && label.text) {
return label.text.includes(btvSelectedRunway?.substring(2));
}
if (label.style === LabelStyle.BtvStopLine) {
if ([LabelStyle.BtvStopLineMagenta, LabelStyle.BtvStopLineAmber, LabelStyle.BtvStopLineRed, LabelStyle.BtvStopLineGreen].includes(label.style)) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class OancPlanModeCompass extends DisplayComponent<OancPlanModeCompassPro

<rect x={212} y={538} width={41} height={21} class="BackgroundFill" />
<text x={212} y={556} class="Cyan" font-size={22}>
{this.props.oansRange.map((range) => range / 1)}
{this.props.oansRange.map((range) => range / 2)}
</text>

<text x={384} y={170} class="White" font-size={25} text-anchor="middle" alignment-baseline="central">N</text>
Expand Down
29 changes: 27 additions & 2 deletions fbw-common/src/systems/instruments/src/OANC/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,39 @@
color: $display-white;
}

.oanc-label-style-btv-stop-line {
.oanc-label-style-btv-stop-line-green {
color: $display-green;
}

.oanc-label-style-btv-stop-line-green:hover {
outline: 0px;
}

.oanc-label-style-btv-stop-line-magenta {
color: $display-magenta;
}

.oanc-label-style-btv-stop-line:hover {
.oanc-label-style-btv-stop-line-magenta:hover {
outline: 0px;
}

.oanc-label-style-btv-stop-line-amber {
color: $display-amber;
}

.oanc-label-style-btv-stop-line-amber:hover {
outline: 0px;
}

.oanc-label-style-btv-stop-line-red {
color: $display-red;
}

.oanc-label-style-btv-stop-line-red:hover {
outline: 0px;
}


.oanc-button {
padding: 10px 6px;
background-color: gray;
Expand Down

0 comments on commit c7a87b9

Please sign in to comment.