Skip to content

Commit

Permalink
feat(a380x): TERR ON ND (#8778)
Browse files Browse the repository at this point in the history
* prepare EFIS CP and ND

(cherry picked from commit 59ebb5a)

* change elec supply

* add VD
  • Loading branch information
flogross89 committed Jul 28, 2024
1 parent 7bd5b1d commit 5d35148
Show file tree
Hide file tree
Showing 8 changed files with 243 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@
1 (>L:A32NX_EFIS_L_OPTION)
}

(L:A380X_EFIS_L_ACTIVE_OVERLAY) 2 == (>L:A32NX_EFIS_TERR_L_ACTIVE)

(L:A380X_EFIS_R_ACTIVE_FILTER) 0 == if{
3 (>L:A32NX_EFIS_R_OPTION)
}
Expand All @@ -148,6 +150,9 @@
1 (>L:A32NX_EFIS_R_OPTION)
}

(L:A380X_EFIS_R_ACTIVE_OVERLAY) 2 == (>L:A32NX_EFIS_TERR_R_ACTIVE)


(O:PrevPot7Value) s0
(A:LIGHT POTENTIOMETER:7, Percent over 100) s1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
<!-- WX -->
<UseTemplate Name="FBW_A380X_BacklightIndicator_Button_Template">
<NODE_ID>PUSH_EFIS_#SIDE_NODE_GROUP#_WX</NODE_ID>
<BUTTON_CODE>0 (&gt;L:A380X_EFIS_#SIDE_SIMVAR_GROUP#_ACTIVE_OVERLAY)</BUTTON_CODE>
<INDICATOR_CODE>(L:A380X_EFIS_#SIDE_SIMVAR_GROUP#_ACTIVE_OVERLAY) 0 ==</INDICATOR_CODE>
<BUTTON_CODE>(L:A380X_EFIS_#SIDE_SIMVAR_GROUP#_ACTIVE_OVERLAY) 1 == ! (&gt;L:A380X_EFIS_#SIDE_SIMVAR_GROUP#_ACTIVE_OVERLAY)</BUTTON_CODE>
<INDICATOR_CODE>(L:A380X_EFIS_#SIDE_SIMVAR_GROUP#_ACTIVE_OVERLAY) 1 ==</INDICATOR_CODE>
<TOOLTIPID>SELECT WX OVERLAY ON ND/VD</TOOLTIPID>

<NODE_IS_INDICATOR />
Expand All @@ -145,8 +145,8 @@
<!-- TERR -->
<UseTemplate Name="FBW_A380X_BacklightIndicator_Button_Template">
<NODE_ID>PUSH_EFIS_#SIDE_NODE_GROUP#_TERR</NODE_ID>
<BUTTON_CODE>1 (&gt;L:A380X_EFIS_#SIDE_SIMVAR_GROUP#_ACTIVE_OVERLAY)</BUTTON_CODE>
<INDICATOR_CODE>(L:A380X_EFIS_#SIDE_SIMVAR_GROUP#_ACTIVE_OVERLAY) 1 ==</INDICATOR_CODE>
<BUTTON_CODE>(L:A380X_EFIS_#SIDE_SIMVAR_GROUP#_ACTIVE_OVERLAY) 2 == ! 2 * (&gt;L:A380X_EFIS_#SIDE_SIMVAR_GROUP#_ACTIVE_OVERLAY)</BUTTON_CODE>
<INDICATOR_CODE>(L:A380X_EFIS_#SIDE_SIMVAR_GROUP#_ACTIVE_OVERLAY) 2 ==</INDICATOR_CODE>
<TOOLTIPID>SELECT TERR OVERLAY ON ND</TOOLTIPID>

<NODE_IS_INDICATOR />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ size_mm=768,1024
pixel_size=768,1024
texture=$SCREEN_DU_NDL

htmlgauge00=A380X/ND/nd.html?Index=1&duID=1, 0,0,768,1024
htmlgauge00=WasmInstrument/WasmInstrument.html?wasm_module=terronnd.wasm&wasm_gauge=terronnd,0,0,768,1024,L
htmlgauge01=A380X/ND/nd.html?Index=1&duID=1, 0,0,768,1024

[VCockpit08]
size_mm=768,1024
pixel_size=768,1024
texture=$SCREEN_DU_NDR

htmlgauge00=A380X/ND/nd.html?Index=2?duID=4, 0,0,768,1024
htmlgauge00=WasmInstrument/WasmInstrument.html?wasm_module=terronnd.wasm&wasm_gauge=terronnd,0,0,768,1024,R
htmlgauge01=A380X/ND/nd.html?Index=2?duID=4, 0,0,768,1024

[VCockpit09]
size_mm=5120,5120
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@font-face {
font-family: 'Ecam';
src: url(/Fonts/ECAMFontRegular.ttf);
src: url("/Fonts/FBW-Display-EIS-A380.ttf");
}

$font-size-small: 14px;
Expand Down
71 changes: 36 additions & 35 deletions fbw-a380x/src/systems/instruments/src/ND/NDSimvarPublisher.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { EventBus, SimVarDefinition, SimVarValueType } from '@microsoft/msfs-sdk';
import {
AdirsSimVarDefinitions,
AdirsSimVars,
SwitchingPanelSimVarsDefinitions,
SwitchingPanelVSimVars,
AdirsSimVarDefinitions,
AdirsSimVars,
SwitchingPanelSimVarsDefinitions,
SwitchingPanelVSimVars,
} from '../MsfsAvionicsCommon/SimVarTypes';
import { UpdatableSimVarPublisher } from '../MsfsAvionicsCommon/UpdatableSimVarPublisher';

export type NDSimvars = AdirsSimVars & SwitchingPanelVSimVars & {
export type NDSimvars = AdirsSimVars &
SwitchingPanelVSimVars & {
elec: boolean;
elecFo: boolean;
potentiometerCaptain: number;
Expand All @@ -19,41 +20,41 @@ export type NDSimvars = AdirsSimVars & SwitchingPanelVSimVars & {
pposLat: Degrees;
pposLong: Degrees;
absoluteTime: Seconds;
}
};

export enum NDVars {
elec = 'L:A32NX_ELEC_AC_ESS_BUS_IS_POWERED',
elecFo = 'L:A32NX_ELEC_AC_2_BUS_IS_POWERED',
potentiometerCaptain = 'LIGHT POTENTIOMETER:89',
potentiometerFo = 'LIGHT POTENTIOMETER:91',
ilsCourse = 'L:A32NX_FM_LS_COURSE',
selectedWaypointLat = 'L:A32NX_SELECTED_WAYPOINT_LAT',
selectedWaypointLong = 'L:A32NX_SELECTED_WAYPOINT_LONG',
selectedHeading = 'L:A32NX_FCU_HEADING_SELECTED',
pposLat = 'PLANE LATITUDE', // TODO replace with fm position
pposLong = 'PLANE LONGITUDE', // TODO replace with fm position
absoluteTime = 'E:ABSOLUTE TIME',
elec = 'L:A32NX_ELEC_AC_ESS_BUS_IS_POWERED',
elecFo = 'L:A32NX_ELEC_AC_2_BUS_IS_POWERED',
potentiometerCaptain = 'LIGHT POTENTIOMETER:89',
potentiometerFo = 'LIGHT POTENTIOMETER:91',
ilsCourse = 'L:A32NX_FM_LS_COURSE',
selectedWaypointLat = 'L:A32NX_SELECTED_WAYPOINT_LAT',
selectedWaypointLong = 'L:A32NX_SELECTED_WAYPOINT_LONG',
selectedHeading = 'L:A32NX_FCU_HEADING_SELECTED',
pposLat = 'PLANE LATITUDE', // TODO replace with fm position
pposLong = 'PLANE LONGITUDE', // TODO replace with fm position
absoluteTime = 'E:ABSOLUTE TIME',
}

/** A publisher to poll and publish nav/com simvars. */
export class NDSimvarPublisher extends UpdatableSimVarPublisher<NDSimvars> {
private static simvars = new Map<keyof NDSimvars, SimVarDefinition>([
...AdirsSimVarDefinitions,
...SwitchingPanelSimVarsDefinitions,
['elec', { name: NDVars.elec, type: SimVarValueType.Bool }],
['elecFo', { name: NDVars.elecFo, type: SimVarValueType.Bool }],
['potentiometerCaptain', { name: NDVars.potentiometerCaptain, type: SimVarValueType.Number }],
['potentiometerFo', { name: NDVars.potentiometerFo, type: SimVarValueType.Number }],
['ilsCourse', { name: NDVars.ilsCourse, type: SimVarValueType.Number }],
['selectedWaypointLat', { name: NDVars.selectedWaypointLat, type: SimVarValueType.Degree }],
['selectedWaypointLong', { name: NDVars.selectedWaypointLong, type: SimVarValueType.Degree }],
['selectedHeading', { name: NDVars.selectedHeading, type: SimVarValueType.Degree }],
['pposLat', { name: NDVars.pposLat, type: SimVarValueType.Degree }],
['pposLong', { name: NDVars.pposLong, type: SimVarValueType.Degree }],
['absoluteTime', { name: NDVars.absoluteTime, type: SimVarValueType.Seconds }],
])
private static simvars = new Map<keyof NDSimvars, SimVarDefinition>([
...AdirsSimVarDefinitions,
...SwitchingPanelSimVarsDefinitions,
['elec', { name: NDVars.elec, type: SimVarValueType.Bool }],
['elecFo', { name: NDVars.elecFo, type: SimVarValueType.Bool }],
['potentiometerCaptain', { name: NDVars.potentiometerCaptain, type: SimVarValueType.Number }],
['potentiometerFo', { name: NDVars.potentiometerFo, type: SimVarValueType.Number }],
['ilsCourse', { name: NDVars.ilsCourse, type: SimVarValueType.Number }],
['selectedWaypointLat', { name: NDVars.selectedWaypointLat, type: SimVarValueType.Degree }],
['selectedWaypointLong', { name: NDVars.selectedWaypointLong, type: SimVarValueType.Degree }],
['selectedHeading', { name: NDVars.selectedHeading, type: SimVarValueType.Degree }],
['pposLat', { name: NDVars.pposLat, type: SimVarValueType.Degree }],
['pposLong', { name: NDVars.pposLong, type: SimVarValueType.Degree }],
['absoluteTime', { name: NDVars.absoluteTime, type: SimVarValueType.Seconds }],
]);

public constructor(bus: EventBus) {
super(NDSimvarPublisher.simvars, bus);
}
public constructor(bus: EventBus) {
super(NDSimvarPublisher.simvars, bus);
}
}
82 changes: 82 additions & 0 deletions fbw-a380x/src/systems/instruments/src/ND/VerticalDisplay.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import {
A380EfisNdRangeValue,
ArincEventBus,
EfisNdMode,
EfisSide,
a380EfisRangeSettings,
} from '@flybywiresim/fbw-sdk';
import { ComponentProps, DisplayComponent, FSComponent, VNode } from '@microsoft/msfs-sdk';

export interface VerticalDisplayProps extends ComponentProps {
bus: ArincEventBus;
side: EfisSide;
}

export interface GenericFcuEvents {
ndMode: EfisNdMode;
ndRangeSetting: A380EfisNdRangeValue;
}

export class VerticalDisplayDummy extends DisplayComponent<VerticalDisplayProps> {
private topRef = FSComponent.createRef<SVGElement>();

private ndMode: EfisNdMode = EfisNdMode.ARC;

private ndRangeSetting: A380EfisNdRangeValue = 10;

private updateVisibility() {
if (this.ndMode === EfisNdMode.PLAN) {
this.topRef.instance.style.display = 'none';
} else if (this.ndRangeSetting === -1) {
this.topRef.instance.style.display = 'none';
} else {
this.topRef.instance.style.display = 'block';
}
}

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

const sub = this.props.bus.getSubscriber<GenericFcuEvents>();

sub
.on('ndMode')
.whenChanged()
.handle((mode) => {
this.ndMode = mode;
this.updateVisibility();
});

sub
.on('ndRangeSetting')
.whenChanged()
.handle((range) => {
this.ndRangeSetting = a380EfisRangeSettings[range];
this.updateVisibility();
});
}

render(): VNode {
return (
<svg ref={this.topRef} viewBox="0 0 768 1024" xmlns="http://www.w3.org/2000/svg">
<g>
<line x1="105" x2="105" y1="800" y2="1000" stroke="red" stroke-width="2" />
<line x1="105" x2="120" y1="820" y2="820" stroke="red" stroke-width="2" />
<line x1="105" x2="120" y1="850" y2="850" stroke="red" stroke-width="2" />
<line x1="105" x2="120" y1="880" y2="880" stroke="red" stroke-width="2" />
<line x1="105" x2="120" y1="910" y2="910" stroke="red" stroke-width="2" />
<line x1="105" x2="120" y1="940" y2="940" stroke="red" stroke-width="2" />
<line x1="105" x2="120" y1="970" y2="970" stroke="red" stroke-width="2" />
</g>
<g>
<line x1="150" x2="690" y1="800" y2="800" stroke="red" stroke-width="2" />
<line x1="150" x2="150" y1="800" y2="1000" stroke="red" stroke-width="2" stroke-dasharray="8" />
<line x1="285" x2="285" y1="800" y2="1000" stroke="red" stroke-width="2" stroke-dasharray="8" />
<line x1="420" x2="420" y1="800" y2="1000" stroke="red" stroke-width="2" stroke-dasharray="8" />
<line x1="555" x2="555" y1="800" y2="1000" stroke="red" stroke-width="2" stroke-dasharray="8" />
<line x1="690" x2="690" y1="800" y2="1000" stroke="red" stroke-width="2" />
</g>
</svg>
);
}
}
Loading

0 comments on commit 5d35148

Please sign in to comment.