Skip to content

Commit

Permalink
implement "RWY AHEAD" advisory
Browse files Browse the repository at this point in the history
  • Loading branch information
flogross89 committed Apr 23, 2024
1 parent dcb83f6 commit f1eb495
Show file tree
Hide file tree
Showing 12 changed files with 259 additions and 32 deletions.
14 changes: 10 additions & 4 deletions fbw-a380x/src/systems/instruments/src/ND/animations.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

@mixin GenericPulsingStroke($color, $name) {
@keyframes #{$name} {
0% {stroke: scale-color($color, $lightness: -30%);}
50% {stroke: scale-color($color, $lightness: -30%);}
51% {stroke: scale-color($color, $lightness: 30%);}
100% {stroke: scale-color($color, $lightness: 30%);}
0% {stroke: scale-color($color, $lightness: -50%);}
50% {stroke: scale-color($color, $lightness: -50%);}
51% {stroke: scale-color($color, $lightness: 50%);}
100% {stroke: scale-color($color, $lightness: 50%);}
}
animation-name: $name;
}
Expand Down Expand Up @@ -69,3 +69,9 @@
animation-duration: 200ms;
animation-iteration-count: infinite;
}

.RwyAheadAnimation {
@include GenericPulsingStroke($display-yellow, pulse-yellow-stroke);
animation-duration: 1s;
animation-iteration-count: infinite;
}
5 changes: 5 additions & 0 deletions fbw-a380x/src/systems/instruments/src/ND/instrument.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { EgpwcBusPublisher } from '../MsfsAvionicsCommon/providers/EgpwcBusPubli
import { DmcPublisher } from '../MsfsAvionicsCommon/providers/DmcPublisher';
import { FMBusPublisher } from '../MsfsAvionicsCommon/providers/FMBusPublisher';
import { FcuBusPublisher, FcuSimVars } from '../MsfsAvionicsCommon/providers/FcuBusPublisher';
import { RopRowOansPublisher } from '@flybywiresim/msfs-avionics-common';
import { MouseCursor } from './UI/MouseCursor';

import './style.scss';
Expand Down Expand Up @@ -55,6 +56,8 @@ class NDInstrument implements FsInstrument {

private readonly fmsOansArincProvider: FmsOansArincProvider;

private readonly ropRowOansPublisher: RopRowOansPublisher;

private readonly btvSimvarPublisher: BtvSimvarPublisher;

private readonly btvArincProvider: BtvArincProvider;
Expand Down Expand Up @@ -172,6 +175,7 @@ class NDInstrument implements FsInstrument {
this.fmsDataPublisher = new FmsDataPublisher(this.bus, stateSubject);
this.fmsOansSimvarPublisher = new FmsOansSimvarPublisher(this.bus);
this.fmsOansArincProvider = new FmsOansArincProvider(this.bus);
this.ropRowOansPublisher = new RopRowOansPublisher(this.bus);
this.btvSimvarPublisher = new BtvSimvarPublisher(this.bus);
this.btvArincProvider = new BtvArincProvider(this.bus);
this.fgDataPublisher = new FGDataPublisher(this.bus);
Expand All @@ -191,6 +195,7 @@ class NDInstrument implements FsInstrument {
this.backplane.addPublisher('fcu', this.fcuBusPublisher);
this.backplane.addPublisher('fms', this.fmsDataPublisher);
this.backplane.addPublisher('fms-oans', this.fmsOansSimvarPublisher);
this.backplane.addPublisher('rop-row-oans', this.ropRowOansPublisher);
this.backplane.addPublisher('btv', this.btvSimvarPublisher);
this.backplane.addPublisher('fg', this.fgDataPublisher);
this.backplane.addPublisher('fms-arinc', this.fmBusPublisher);
Expand Down
3 changes: 2 additions & 1 deletion fbw-a380x/src/systems/instruments/src/ND/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"@typings/*": ["../../../fbw-common/src/typings/*"],
"@flybywiresim/fbw-sdk": ["../../../fbw-common/src/systems/index-no-react.ts"],
"@flybywiresim/navigation-display": ["../../../fbw-common/src/systems/instruments/src/ND/index.ts"],
"@flybywiresim/oanc": ["../../../fbw-common/src/systems/instruments/src/OANC/index.ts"]
"@flybywiresim/oanc": ["../../../fbw-common/src/systems/instruments/src/OANC/index.ts"],
"@flybywiresim/msfs-avionics-common": ["../../../fbw-common/src/systems/instruments/src/MsfsAvionicsCommon/index.ts"]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './providers';
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { EventBus, SimVarPublisher, SimVarValueType } from '@microsoft/msfs-sdk';

export interface RopRowOansSimVars {
rowRopWord1Raw: number;
oansWord1Raw: number;
}

export class RopRowOansPublisher extends SimVarPublisher<RopRowOansSimVars> {
constructor(bus: EventBus) {
super(new Map([
['rowRopWord1Raw', { name: 'L:A32NX_ROW_ROP_WORD_1', type: SimVarValueType.Number }],
['oansWord1Raw', { name: 'L:A32NX_OANS_WORD_1', type: SimVarValueType.Number }],
]), bus);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './RopRowOansPublisher';
2 changes: 2 additions & 0 deletions fbw-common/src/systems/instruments/src/ND/ND.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ClockEvents, ConsumerSubject, DisplayComponent, EventBus, FSComponent,

import { clampAngle } from 'msfs-geo';
import { BtvRunwayInfo } from 'instruments/src/ND/shared/BtvRunwayInfo';
import { RwyAheadAdvisory } from 'instruments/src/ND/shared/RwyAheadAdvisory';
import { SelectedHeadingBug } from './pages/arc/SelectedHeadingBug';
import { VnavStatus } from './shared/VnavStatus';
import { LnavStatus } from './shared/LnavStatus';
Expand Down Expand Up @@ -284,6 +285,7 @@ export class NDComponent<T extends number> extends DisplayComponent<NDProps<T>>
<svg class="nd-svg nd-top-layer" viewBox="0 0 768 768" style="transform: rotateX(0deg);">
<TcasWxrMessages bus={this.props.bus} mode={this.currentPageMode} />
<FmMessages bus={this.props.bus} mode={this.currentPageMode} />
<RwyAheadAdvisory bus={this.props.bus} />
</svg>
</div>
<div style={{ display: this.showOans.map((it) => (it ? 'none' : 'block')) }}>
Expand Down
126 changes: 102 additions & 24 deletions fbw-common/src/systems/instruments/src/ND/animations.scss
Original file line number Diff line number Diff line change
@@ -1,45 +1,115 @@
@keyframes blinking {
0% {opacity: 0;}
50% {opacity: 0;}
51% {opacity: 1;}
100% {opacity: 1;}
0% {
opacity: 0;
}

50% {
opacity: 0;
}

51% {
opacity: 1;
}

100% {
opacity: 1;
}
}

@mixin GenericPulsingStroke($color, $name) {
@keyframes #{$name} {
0% {stroke: scale-color($color, $lightness: -30%);}
50% {stroke: scale-color($color, $lightness: -30%);}
51% {stroke: scale-color($color, $lightness: 30%);}
100% {stroke: scale-color($color, $lightness: 30%);}
0% {
stroke: scale-color($color, $lightness: -50%);
}

50% {
stroke: scale-color($color, $lightness: -50%);
}

51% {
stroke: scale-color($color, $lightness: 50%);
}

100% {
stroke: scale-color($color, $lightness: 50%);
}
}

animation-name: $name;
}

@mixin GenericPulsingFill($color, $name) {
@keyframes #{$name} {
0% {fill: scale-color($color, $lightness: -30%);}
50% {fill: scale-color($color, $lightness: -30%);}
51% {fill: scale-color($color, $lightness: 30%);}
100% {fill: scale-color($color, $lightness: 30%);}
0% {
fill: scale-color($color, $lightness: -30%);
}

50% {
fill: scale-color($color, $lightness: -30%);
}

51% {
fill: scale-color($color, $lightness: 30%);
}

100% {
fill: scale-color($color, $lightness: 30%);
}
}

animation-name: $name;
}

@keyframes OuterMarkerAnim {
0% {opacity: 0;}
33% {opacity: 0;}
34% {opacity: 1;}
100% {opacity: 1;}
0% {
opacity: 0;
}

33% {
opacity: 0;
}

34% {
opacity: 1;
}

100% {
opacity: 1;
}
}

@keyframes MiddleMarkerAnim {
0% {opacity: 0}
10% {opacity: 0}
11% {opacity: 1}
27% {opacity: 1}
28% {opacity: 0}
44% {opacity: 0}
45% {opacity: 1}
100% {opacity: 1}
0% {
opacity: 0
}

10% {
opacity: 0
}

11% {
opacity: 1
}

27% {
opacity: 1
}

28% {
opacity: 0
}

44% {
opacity: 0
}

45% {
opacity: 1
}

100% {
opacity: 1
}
}

.BlinkInfinite {
Expand All @@ -59,13 +129,21 @@
animation-duration: 460ms;
animation-iteration-count: infinite;
}

.MiddleMarkerBlink {
animation-name: MiddleMarkerAnim;
animation-duration: 730ms;
animation-iteration-count: infinite;
}

.InnerMarkerBlink {
animation-name: blinking;
animation-duration: 200ms;
animation-iteration-count: infinite;
}

.RwyAheadAnimation {
@include GenericPulsingStroke($display-yellow, pulse-yellow-stroke);
animation-duration: 1s;
animation-iteration-count: infinite;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { DisplayComponent, FSComponent, Subject, VNode } from '@microsoft/msfs-sdk';
import { Arinc429Word, ArincEventBus } from 'index-no-react';
import { FmsOansData } from 'instruments/src/OANC';
import { RopRowOansSimVars } from '../../MsfsAvionicsCommon/providers';

export interface RwyAheadAdvisoryProps {
bus: ArincEventBus,
}

export class RwyAheadAdvisory extends DisplayComponent<RwyAheadAdvisoryProps> {
private readonly flagRef = FSComponent.createRef<SVGTextElement>();

private readonly qfu = Subject.create<string>('');

onAfterRender(node: VNode) {
super.onAfterRender(node);

this.props.bus.getSubscriber<RopRowOansSimVars>().on('oansWord1Raw').whenChanged().handle((it) => {
const w = new Arinc429Word(it);
this.flagRef.instance.style.display = w.getBitValueOr(11, false) ? 'block' : 'none';
});

this.props.bus.getSubscriber<FmsOansData>().on('ndRwyAheadQfu').whenChanged().handle((it) => this.qfu.set(it));
}

render(): VNode | null {
return (
<g ref={this.flagRef}>
<rect x="273" y="209" width="210" height="40" stroke="yellow" stroke-width="3" fill="black" style="RwyAheadAnimation" />
<text
x={378}
y={241}
class="FontLarge Yellow MiddleAlign RwyAheadAnimation TextOutline"
style="stroke-width: 0.25mm;"
>
{this.qfu}
</text>
</g>

);
}
}
Loading

0 comments on commit f1eb495

Please sign in to comment.