Skip to content

Commit

Permalink
fix(fws): Sound scheduling for FWS, triple click on capability downgr…
Browse files Browse the repository at this point in the history
…ade (flybywiresim#9555)

* Implement FwsSoundManager

* add altitude callouts

* a380x fixes

* move PseudoFWC to systems-host; Implement AP + A/THR disconnect logic

* fix triple clicks

* fix a320/a380 differences

* review fixes

* BravoMike's review findings

* fix AUTO_THROTTLE_DISCONNECT

* single chime for A/THR OFF memo

* another event forward

* update a32nx sounds

* change single chime back to a32nx variant

* consider land armed for CAT 2 -> CAT 1 downgrades

* don't break before event emission :)

* Revert "update a32nx sounds"

This reverts commit 4833704.

* replace exec calculator code with simconnect call

* add athr disconnect event, improve sendEvent call (no this)

* first cavcharge fix

* remove sound elec bus dependency

* keep showing AP OFF alert unless AP re-engaged or flight is restarted

* listen to ATS discrete word

* pause before triple click

* timing update

* use FMGC discrete for AP engagement

* add THR LEVERS ... MOVE

* Don't instantly interrupt when continuous, only when higher prio

* ECAM warning: Separate sound from AP OFF fault line

* A380X: adapt timing, play first cav charge for at least 0.3s

* fix alt c chord

* a380x: fix short c-chord
  • Loading branch information
flogross89 authored Dec 18, 2024
1 parent cb7b806 commit 22b5854
Show file tree
Hide file tree
Showing 26 changed files with 2,262 additions and 1,298 deletions.
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
1. [FMS] Fix Pause at T/D not working in selected speed - @BlueberryKing (BlueberryKing)
1. [MISC] Replaced brake temperature simulation with physics based model of brakes - @Gurgel100 (Pascal)
1. [A32NX/MCDU] Suppress TMPY FPLN when no modifications made in airways page - @robertxing2004 (robeet)
1. [A380X/FWS] No "auto brake off" callout when double pressing A/THR instinctive disconnect - @flogross89 (floridude)
1. [A380X/FWS] Improve landing capability downgrade triple click logic (#9008) - @flogross89 (floridude)
1. [A32NX/FWS] Add "auto brake off" callout, improve AP/ATHR disconnect aural alert logic - @flogross89 (floridude)
1. [A32NX/FCU] The FCU LCD is now still visible with ambient light when the backlight is off @tracernz (Mike)
1. [A380X/FMC] Fix reset of perf data on done phase or database swap - @tracernz (Mike)
1. [A32NX/ATC] Fixed ATC/TCAS power supply - @tracernz (Mike)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,6 @@
<WwiseRTPC LocalVar="A32NX_SOUND_EXTERIOR_MASTER" Units="number" Index="0" RTPCName="LOCALVAR_A32NX_EXTERIOR_VOLUME" />
</Sound>

<Sound WwiseData="true" WwiseEvent="AP_DC_new" Continuous="false" NodeName="PEDALS_LEFT" LocalVar="A32NX_AUTOPILOT_ACTIVE" Units="BOOL" Index="0">
<Range UpperBound="0" />
</Sound>

<Sound WwiseData="true" WwiseEvent="APUnlock" NodeName="PUSH_YOKE_LEFT" ViewPoint="Inside" Continuous="false" LocalVar="A32NX_STICK_LOCK_ACTIVE" Units="BOOL" Index="0">
<Range UpperBound="0" />
</Sound>
Expand Down Expand Up @@ -2150,7 +2146,7 @@

<!-- CRC and Caution ========================================================================================-->

<Sound WwiseData="true" WwiseEvent="CRC" NodeName="Wiper_Base_l" ViewPoint="Inside" LocalVar="A32NX_MASTER_WARNING">
<Sound WwiseData="true" WwiseEvent="CRC" NodeName="Wiper_Base_l" ViewPoint="Inside" LocalVar="A32NX_FWC_CRC">
<Range LowerBound="0.5" />

</Sound>
Expand Down Expand Up @@ -2274,54 +2270,55 @@
<WwiseRTPC LocalVar="A32NX_SOUND_ANNOUNCEMENTS_ENABLED" Units="number" Index="0" RTPCName="LOCALVAR_A32NX_ANNOUNCEMENT_TOGGLE" />
</Sound>

<!-- Cavalry charge ===============================================================================-->

<Sound WwiseData="true" WwiseEvent="improved_tone_caution" NodeName="PEDALS_LEFT" ViewPoint="Inside" LocalVar="A32NX_MASTER_CAUTION" Continuous="false">
<Sound WwiseData="true" WwiseEvent="cavcharge" NodeName="WIPER_BASE_L" ViewPoint="Inside" LocalVar="A32NX_FWC_CAVALRY_CHARGE" Continuous="true">
<Range LowerBound="0.5" />

<WwiseRTPC LocalVar="A32NX_FWS_AUDIO_VOLUME" Units="number" Index="0" RTPCName="LOCALVAR_FWC_VOLUME" />
</Sound>

<!-- Altitude deviation warning =====================================================================-->

<Sound WwiseData="true" WwiseEvent="cchordloop" NodeName="PEDALS_LEFT" ViewPoint="Inside" LocalVar="A32NX_ALT_DEVIATION" Continuous="true">
<Range LowerBound="1" />

</Sound>

<Sound WwiseData="true" WwiseEvent="cchordshort" NodeName="PEDALS_LEFT" ViewPoint="Inside" LocalVar="A32NX_ALT_DEVIATION_SHORT" Continuous="false">
<Range LowerBound="1" />

</Sound>

<Sound WwiseEvent="3click" WwiseData="true" NodeName="PEDALS_LEFT" LocalVar="A32NX_FMA_TRIPLE_CLICK" Continuous="false">
<Range LowerBound="1"/>

</Sound>

<!-- Stall warning =====================================================================-->
<Sound WwiseEvent="aural_stall_new" WwiseData="true" NodeName="PEDALS_LEFT" LocalVar="A32NX_AUDIO_STALL_WARNING" Continuous="true">
<Range LowerBound="1"/>

</Sound>

<!-- ROP/ROW warnings =====================================================================-->
<Sound WwiseEvent="brake_max_braking" WwiseData="true" NodeName="Wiper_Base_l" LocalVar="A32NX_AUDIO_ROP_MAX_BRAKING" Continuous="true">
<Range LowerBound="1"/>

</Sound>

<Sound WwiseEvent="set_max_reverse" WwiseData="true" NodeName="Wiper_Base_l" LocalVar="A32NX_AUDIO_ROW_SET_MAX_REVERSE" Continuous="true">
<Range LowerBound="1"/>

</Sound>

<Sound WwiseEvent="keep_max_reverse" WwiseData="true" NodeName="Wiper_Base_l" LocalVar="A32NX_AUDIO_ROP_KEEP_MAX_REVERSE" Continuous="false">
<Range LowerBound="1"/>

</Sound>

<Sound WwiseEvent="runway_too_short" WwiseData="true" NodeName="Wiper_Base_l" LocalVar="A32NX_AUDIO_ROW_RWY_TOO_SHORT" Continuous="true">
<Range LowerBound="1"/>
</Sound>

<Sound WwiseEvent="autobrake_off" WwiseData="true" NodeName="Wiper_Base_l" LocalVar="A32NX_AUDIO_AUTOBRAKE_OFF" Continuous="false">
<Range LowerBound="1"/>
</Sound>

<Sound WwiseData="true" WwiseEvent="improved_tone_caution" NodeName="PEDALS_LEFT" ViewPoint="Inside" LocalVar="A32NX_FWC_SC" Continuous="false">
<Range LowerBound="0.5" />
</Sound>

</SimVarSounds>
Expand Down
6 changes: 6 additions & 0 deletions fbw-a32nx/src/systems/instruments/src/Common/EWDMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const EWDMessages = {
'000002010': ' \x1b<3mFLAPS FULL',
'000002011': ' \x1b<3mFLAPS\x1b<5m.....CONF 3',
'000002012': ' \x1b<3mFLAPS CONF 3',
'320000001': '\x1b<4mAUTO BRK OFF',
'000002201': '\x1b<3mAUTO BRK LO',
'000002202': '\x1b<3mAUTO BRK MED',
'000002203': '\x1b<3mAUTO BRK MAX',
Expand Down Expand Up @@ -192,6 +193,11 @@ const EWDMessages = {
'216330503': '\x1b<4m -FWD CAB TRIM VALVE',
'216330504': '\x1b<4m -AFT CAB TRIM VALVE',
'216330505': '\x1b<4m -TRIM AIR HI PR',
'220000001': '\x1b<2mAP OFF',
'220000002': '\x1b<4mA/THR OFF',
'220800001': '\x1b<2m\x1b4mAUTO FLT\x1bm AP OFF',
'220800004': '\x1b<4m\x1b4mAUTO FLT\x1bm A/THR OFF',
'220800005': '\x1b<5m -THR LEVERS........MOVE',
'220020201': '\x1b<4m\x1b4mAUTO FLT\x1bm FCU 1+2 FAULT',
'220020202': '\x1b<5m -PFD BARO REF: STD ONLY',
'220021001': '\x1b<4m\x1b4mAUTO FLT\x1bm FCU 1 FAULT',
Expand Down
21 changes: 1 addition & 20 deletions fbw-a32nx/src/systems/instruments/src/EWD/instrument.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,11 @@
//
// SPDX-License-Identifier: GPL-3.0

import {
AdcPublisher,
Clock,
EventBus,
FSComponent,
InstrumentBackplane,
StallWarningPublisher,
} from '@microsoft/msfs-sdk';
import { AdcPublisher, Clock, EventBus, FSComponent, InstrumentBackplane } from '@microsoft/msfs-sdk';
import { FuelSystemPublisher } from 'instruments/src/MsfsAvionicsCommon/providers/FuelSystemPublisher';
import { ArincValueProvider } from './shared/ArincValueProvider';
import { EwdComponent } from './EWD';
import { EwdSimvarPublisher } from './shared/EwdSimvarPublisher';
import { A32NXFcuBusPublisher } from '@shared/publishers/A32NXFcuBusPublisher';
import { PseudoFWC } from './PseudoFWC';

import './style.scss';

Expand All @@ -34,23 +25,13 @@ class A32NX_EWD extends BaseInstrument {

private readonly adcPublisher = new AdcPublisher(this.bus);

private readonly stallWarningPublisher = new StallWarningPublisher(this.bus, 0.9);

private readonly a32nxFcuBusPublisher = new A32NXFcuBusPublisher(this.bus);

private readonly pseudoFwc = new PseudoFWC(this.bus, this);

constructor() {
super();

this.backplane.addInstrument('Clock', this.clock);
this.backplane.addPublisher('SimVars', this.simVarPublisher);
this.backplane.addPublisher('FuelSystem', this.fuelSystemPublisher);
this.backplane.addPublisher('adc', this.adcPublisher);
this.backplane.addPublisher('stallWarning', this.stallWarningPublisher);
this.backplane.addPublisher('A32NXFcuBus', this.a32nxFcuBusPublisher);

this.backplane.addInstrument('Fwc', this.pseudoFwc);
}

get templateID(): string {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) 2021-2023 FlyByWire Simulations
//
// SPDX-License-Identifier: GPL-3.0

import { EventBus, SimVarDefinition, SimVarValueType, SimVarPublisher } from '@microsoft/msfs-sdk';

export type PseudoFwcSimvars = {
engine1Master: number;
engine2Master: number;
engine3Master: number;
engine4Master: number;
fmgc1DiscreteWord3: number;
fmgc2DiscreteWord3: number;
fmgc1DiscreteWord4: number;
fmgc2DiscreteWord4: number;
};

export class PseudoFwcSimvarPublisher extends SimVarPublisher<PseudoFwcSimvars> {
private static simvars = new Map<keyof PseudoFwcSimvars, SimVarDefinition>([
['engine1Master', { name: 'A:FUELSYSTEM VALVE SWITCH:1', type: SimVarValueType.Bool }],
['engine2Master', { name: 'A:FUELSYSTEM VALVE SWITCH:2', type: SimVarValueType.Bool }],
['engine3Master', { name: 'A:FUELSYSTEM VALVE SWITCH:3', type: SimVarValueType.Bool }],
['engine4Master', { name: 'A:FUELSYSTEM VALVE SWITCH:4', type: SimVarValueType.Bool }],
['fmgc1DiscreteWord3', { name: 'L:A32NX_FMGC_1_DISCRETE_WORD_3', type: SimVarValueType.Number }],
['fmgc2DiscreteWord3', { name: 'L:A32NX_FMGC_2_DISCRETE_WORD_3', type: SimVarValueType.Number }],
['fmgc1DiscreteWord4', { name: 'L:A32NX_FMGC_1_DISCRETE_WORD_4', type: SimVarValueType.Number }],
['fmgc2DiscreteWord4', { name: 'L:A32NX_FMGC_2_DISCRETE_WORD_4', type: SimVarValueType.Number }],
]);

public constructor(bus: EventBus) {
super(PseudoFwcSimvarPublisher.simvars, bus);
}
}
69 changes: 53 additions & 16 deletions fbw-a32nx/src/systems/systems-host/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,43 @@
//
// SPDX-License-Identifier: GPL-3.0

import { EventBus, HEventPublisher } from '@microsoft/msfs-sdk';
import {
Clock,
ClockEvents,
EventBus,
HEventPublisher,
InstrumentBackplane,
StallWarningPublisher,
} from '@microsoft/msfs-sdk';
import { AtsuSystem } from './systems/atsu';
import { PowerSupplyBusses } from './systems/powersupply';
import { PseudoFWC } from 'systems-host/systems/FWC/PseudoFWC';
import { FuelSystemPublisher } from 'instruments/src/MsfsAvionicsCommon/providers/FuelSystemPublisher';
import { A32NXFcuBusPublisher } from '@shared/publishers/A32NXFcuBusPublisher';
import { PseudoFwcSimvarPublisher } from 'instruments/src/MsfsAvionicsCommon/providers/PseudoFwcPublisher';

class SystemsHost extends BaseInstrument {
private readonly bus: EventBus;
private readonly bus = new EventBus();

private readonly hEventPublisher: HEventPublisher;
private readonly backplane = new InstrumentBackplane();

private readonly powerSupply: PowerSupplyBusses;
private readonly clock = new Clock(this.bus);

private readonly atsu: AtsuSystem;
private readonly hEventPublisher = new HEventPublisher(this.bus);

private readonly powerSupply = new PowerSupplyBusses(this.bus);

private readonly atsu = new AtsuSystem(this.bus);

private readonly fuelSystemPublisher = new FuelSystemPublisher(this.bus);

private readonly stallWarningPublisher = new StallWarningPublisher(this.bus, 0.9);

private readonly a32nxFcuBusPublisher = new A32NXFcuBusPublisher(this.bus);

private readonly pseudoFwcPublisher = new PseudoFwcSimvarPublisher(this.bus);

private readonly pseudoFwc = new PseudoFWC(this.bus, this);

/**
* "mainmenu" = 0
Expand All @@ -26,10 +51,26 @@ class SystemsHost extends BaseInstrument {
constructor() {
super();

this.bus = new EventBus();
this.hEventPublisher = new HEventPublisher(this.bus);
this.powerSupply = new PowerSupplyBusses(this.bus);
this.atsu = new AtsuSystem(this.bus);
this.backplane.addInstrument('Clock', this.clock);
this.backplane.addInstrument('AtsuSystem', this.atsu);
this.backplane.addPublisher('FuelSystem', this.fuelSystemPublisher);
this.backplane.addPublisher('PowerPublisher', this.powerSupply);
this.backplane.addPublisher('stallWarning', this.stallWarningPublisher);
this.backplane.addPublisher('a32nxFcuBusPublisher', this.a32nxFcuBusPublisher);
this.backplane.addPublisher('PseudoFwcPublisher', this.pseudoFwcPublisher);

this.pseudoFwc.init();
let lastUpdateTime: number;
this.bus
.getSubscriber<ClockEvents>()
.on('simTimeHiFreq')
.atFrequency(50)
.handle((now) => {
const dt = lastUpdateTime === undefined ? 0 : now - lastUpdateTime;
lastUpdateTime = now;

this.pseudoFwc.update(dt);
});
}

get templateID(): string {
Expand All @@ -47,9 +88,6 @@ class SystemsHost extends BaseInstrument {
public connectedCallback(): void {
super.connectedCallback();

this.powerSupply.connectedCallback();
this.atsu.connectedCallback();

// Needed to fetch METARs from the sim
RegisterViewListener(
'JS_LISTENER_FACILITY',
Expand All @@ -58,6 +96,8 @@ class SystemsHost extends BaseInstrument {
},
true,
);

this.backplane.init();
}

public Update(): void {
Expand All @@ -67,14 +107,11 @@ class SystemsHost extends BaseInstrument {
const gamestate = this.getGameState();
if (gamestate === 3) {
this.hEventPublisher.startPublish();
this.powerSupply.startPublish();
this.atsu.startPublish();
}
this.gameState = gamestate;
}

this.powerSupply.update();
this.atsu.update();
this.backplane.onUpdate();
}
}

Expand Down
Loading

0 comments on commit 22b5854

Please sign in to comment.