Skip to content

Commit

Permalink
feat(a380x/tcas): first (legacy port) working tcas implementation (fl…
Browse files Browse the repository at this point in the history
…ybywiresim#8972)

* feat: legacy tcas v1

* fix: switch to generic data listener sync, linting

* fix: update to latest tcas computer

* feat: mfd surv page

* refactor: use Instrument, implement review comments

* refactor: remove update throttler

* feat: efis traf filter

* fix: fixed NORM alt

* fix: clear display on tcas fault

* feat: force on traf filter when in TA/RA

* fix: overly aggressive TRAF filter selection

* feat: added tcas failure indicator on surv page

* fix: mfd surv - tcas alert level correctly set val

* fix: remove def

* fix: add mfd_ prefix

* fix: remove dev-env
  • Loading branch information
2hwk authored Oct 10, 2024
1 parent f70f617 commit 29c52a9
Show file tree
Hide file tree
Showing 13 changed files with 377 additions and 321 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export class MfdSurvControls extends DisplayComponent<MfdSurvControlsProps> {

private readonly xpdrStatusSelectedIndex = Subject.create<number | null>(0);

private readonly tcasFailed = Subject.create<boolean>(true);
private readonly tcasFailed = ConsumerSubject.create(this.sub.on('tcasFail'), true);

private readonly tcasTaraSelectedIndex = Subject.create<number | null>(0);
private readonly tcasTaraSelectedIndex = Subject.create<number | null>(2);

private readonly tcasNormAbvBlwSelectedIndex = Subject.create<number | null>(0);

Expand Down Expand Up @@ -100,6 +100,10 @@ export class MfdSurvControls extends DisplayComponent<MfdSurvControlsProps> {
this.xpdrState.sub(() => this.xpdrStatusChanged(), true);
this.xpdrSetAltReportingRequest.sub(() => this.xpdrStatusChanged(), true);

sub.on('mfd_tcas_alert_level').handle((val) => this.tcasTaraSelectedIndex.set(2 - val));

sub.on('mfd_tcas_alt_select').handle((val) => this.tcasNormAbvBlwSelectedIndex.set(val));

sub
.on('gpwsTerrOff')
.whenChanged()
Expand Down Expand Up @@ -154,7 +158,6 @@ export class MfdSurvControls extends DisplayComponent<MfdSurvControlsProps> {
}

if (!this.tcasFailed.get()) {
// FIXME replace with appropriate events
this.tcasTaraSelectedIndex.set(0);
this.tcasNormAbvBlwSelectedIndex.set(0);
}
Expand Down Expand Up @@ -250,21 +253,25 @@ export class MfdSurvControls extends DisplayComponent<MfdSurvControlsProps> {
<div class="mfd-surv-controls-tcas-left">
<RadioButtonGroup
values={['TA/RA', 'TA ONLY', 'STBY']}
onModified={(val) =>
this.props.bus.getPublisher<MfdSurvEvents>().pub('mfd_tcas_alert_level', 2 - val, true)
}
selectedIndex={this.tcasTaraSelectedIndex}
idPrefix={`${this.props.mfd.uiService.captOrFo}_MFD_survControlsTcasTara`}
additionalVerticalSpacing={10}
color={Subject.create('green')}
valuesDisabled={Subject.create(Array(3).fill(true))}
/>
</div>
<div class="mfd-surv-controls-tcas-right">
<RadioButtonGroup
values={['NORM', 'ABV', 'BLW']}
selectedIndex={this.tcasNormAbvBlwSelectedIndex}
onModified={(val) =>
this.props.bus.getPublisher<MfdSurvEvents>().pub('mfd_tcas_alt_select', val, true)
}
idPrefix={`${this.props.mfd.uiService.captOrFo}_MFD_survControlsTcasNormAbvBlw`}
additionalVerticalSpacing={10}
color={Subject.create('green')}
valuesDisabled={Subject.create(Array(3).fill(true))}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type MfdSimvars = {
xpdrAvail: boolean;
xpdrCode: number;
xpdrState: number;
tcasFail: boolean;
gpwsTerrOff: boolean;
gpwsSysOff: boolean;
gpwsGsInhibit: boolean;
Expand Down Expand Up @@ -54,6 +55,7 @@ export enum MfdVars {
xpdrAvail = 'TRANSPONDER AVAILABLE',
xpdrCode = 'TRANSPONDER CODE:1',
xpdrState = 'TRANSPONDER STATE:1',
tcasFail = 'L:A32NX_TCAS_FAULT',
gpwsTerrOff = 'L:A32NX_GPWS_TERR_OFF',
gpwsSysOff = 'L:A32NX_GPWS_SYS_OFF',
gpwsGsInhibit = 'L:A32NX_GPWS_GS_OFF',
Expand Down Expand Up @@ -87,6 +89,7 @@ export class MfdSimvarPublisher extends SimVarPublisher<MfdSimvars> {
['xpdrAvail', { name: MfdVars.xpdrAvail, type: SimVarValueType.Bool }],
['xpdrCode', { name: MfdVars.xpdrCode, type: SimVarValueType.Number }],
['xpdrState', { name: MfdVars.xpdrState, type: SimVarValueType.Enum }],
['tcasFail', { name: MfdVars.tcasFail, type: SimVarValueType.Bool }],
['gpwsTerrOff', { name: MfdVars.gpwsTerrOff, type: SimVarValueType.Bool }],
['gpwsSysOff', { name: MfdVars.gpwsSysOff, type: SimVarValueType.Bool }],
['gpwsGsInhibit', { name: MfdVars.gpwsGsInhibit, type: SimVarValueType.Bool }],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ export interface MfdSurvEvents {
mfd_xpdr_set_auto: boolean;
/** (MFD SURV -> RMP) Altitude reporting ON/OFF */
mfd_xpdr_set_alt_reporting: boolean;
/** (MFD SURV -> TCAS) TCAS Alert Level 0 - STBY | 1 - TA ONLY | 2 - TARA */
mfd_tcas_alert_level: number;
/** (MFD SURV -> TCAS) TCAS Alt Select 0 - NORM | 1 - ABV | 2 - BLW */
mfd_tcas_alt_select: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class FmsSymbolsPublisher extends BasePublisher<FmsSymbolsData> {
this.events.push(
new GenericDataListenerSync((ev, data: NdTraffic[]) => {
this.publish('traffic', data);
}, 'A32NX_TCAS_TRAFFIC'),
}, `A32NX_TCAS_${side}_TRAFFIC`),
);
}
}
3 changes: 3 additions & 0 deletions fbw-a380x/src/systems/systems-host/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { LegacyGpws } from 'systems-host/systems/LegacyGpws';
import { LegacyFwc } from 'systems-host/systems/LegacyFwc';
import { LegacyFuelInit } from 'systems-host/systems/LegacyFuelInit';
import { LegacySoundManager } from 'systems-host/systems/LegacySoundManager';
import { LegacyTcasComputer } from 'systems-host/systems/tcas/components/LegacyTcasComputer';
import { VhfRadio } from 'systems-host/systems/Communications/VhfRadio';
import { FailuresConsumer, PilotSeatPublisher, VhfComIndices } from '@flybywiresim/fbw-sdk';
import { AudioManagementUnit } from 'systems-host/systems/Communications/AudioManagementUnit';
Expand Down Expand Up @@ -119,6 +120,8 @@ class SystemsHost extends BaseInstrument {
this.gpws = new LegacyGpws(this.soundManager);
this.gpws.init();

this.backplane.addInstrument('TcasComputer', new LegacyTcasComputer(this.bus, this.soundManager));

let lastUpdateTime: number;
// TODO this is really fast for the FWC...
this.bus
Expand Down
Loading

0 comments on commit 29c52a9

Please sign in to comment.