Skip to content

Commit

Permalink
Merge branch 'master' into A380X/feat/FCU-window-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
heclak authored Dec 7, 2024
2 parents a26eb27 + 5c8071b commit b540725
Show file tree
Hide file tree
Showing 30 changed files with 773 additions and 570 deletions.
7 changes: 7 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
1. [A380X/PFD] Add T/D Reached PFD message - @BravoMike99 (bruno_pt99)
1. [A380X/CAMERA] Showcase & pilot view camera fixes @LunakisDev (LunakisLeaks)
1. [A380X/LIGHTS] Added cockpit ambient bounce lights - @ImenesFBW (Imenes)
1. [A380X/FWS] Fix green dot speed for high weights and altitudes, fix FMS speed target for GD > climb speed limit - @flogross89 (floridude)
1. [A380X/PRIM] Fix max. spoiler deflection based on flap conf - @flogross89 (floridude)
1. [A380X/PERF] Changed managed speeds to more realistic numbers - @slightlyclueles (abnormaltoast)
1. [A380X/MFD] Add ATCCOM connect page - @heclak (heclak)
Expand All @@ -72,12 +73,18 @@
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. [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)
1. [A32NX] Fixed appearance of FCU decals on MSFS2024 - @tracernz (Mike)
1. [FMS] Fixed issue with airport loading timing out on MSFS2024 - @tracernz (Mike)
1. [A32NX] Fixed APU fire detection - @tracernz (Mike)
1. [A380X/COND] Fix wasm crash during rapid decompression - @mjuhe (Miquel Juhe)
1. [A32NX/EWD] Corrected fuel flow step to 20kg/40lbs per hour - @BravoMike99 (bruno_pt99)
1. [A380X] Fix EWD avail. thrust fill area & PFD rudder trim visibility on ground - @flogross89 (floridude)
1. [A380X/LIGHTS] Fix function of FCU brightness knobs - @heclak (Heclak)
1. [A380X/FWS] Fix "NO ZFW OR ZFWCG DATA" ECAM alert after landing - @flogross89 (floridude)
1. [A380X/SD] Add brake temperature color change to amber when brakes are hot - @heclak (Heclak)
1. [A380X/FCU] Fix display of values on FCU during light test - @heclak (Heclak)

## 0.12.0
Expand Down
2 changes: 1 addition & 1 deletion fbw-a32nx/docs/a320-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@

- A32NX.FCU_EFIS_{side}_BARO_SET
- Triggered to set the baro value on FCU
- Value is expected as the first parameter, in hPa.
- Value is expected as the first parameter, in hPa * 16 (i.e. with a factor 16 applied, same as KOHLSMANN_SET).
- side = L, R

- A32NX.FCU_EFIS_{side}_BARO_PUSH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,17 @@
<POTENTIOMETER>87</POTENTIOMETER>
</UseTemplate>

<UseTemplate Name="ASOBO_LIGHTING_Potentiometer_Emissive_Template">
<NODE_ID>SCREEN_AUTOPILOT</NODE_ID>
<POTENTIOMETER>87</POTENTIOMETER>
<!-- ref FBW-22-06 C/B 5LF -->
<EMISSIVE_CODE>(L:A32NX_ELEC_AC_1_BUS_IS_POWERED, Bool)</EMISSIVE_CODE>
</UseTemplate>
<Component ID="SCREEN_AUTOPILOT" Node="SCREEN_AUTOPILOT">
<UseTemplate Name="ASOBO_GT_Material_Emissive_Code">
<!-- ref FBW-22-06 C/B 5LF -->
<EMISSIVE_CODE>
(L:A32NX_AMBIENT_BRIGHTNESS) * 0.05 * 0.01 max
(L:A32NX_ELEC_AC_1_BUS_IS_POWERED, Bool) if{
(A:LIGHT POTENTIOMETER:87, percent over 100) max
}
</EMISSIVE_CODE>
</UseTemplate>
</Component>
<CameraTitle>PA</CameraTitle>

<!-- CPT CONSOLE/FLOOR LT -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2152,9 +2152,7 @@

<Sound WwiseData="true" WwiseEvent="CRC" NodeName="Wiper_Base_l" ViewPoint="Inside" LocalVar="A32NX_MASTER_WARNING">
<Range LowerBound="0.5" />
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>

</Sound>

<!-- Passengers ==================================================================================== -->
Expand Down Expand Up @@ -2279,69 +2277,51 @@

<Sound WwiseData="true" WwiseEvent="improved_tone_caution" NodeName="PEDALS_LEFT" ViewPoint="Inside" LocalVar="A32NX_MASTER_CAUTION" Continuous="false">
<Range LowerBound="0.5" />
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>

</Sound>

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

<Sound WwiseData="true" WwiseEvent="cchordloop" NodeName="PEDALS_LEFT" ViewPoint="Inside" LocalVar="A32NX_ALT_DEVIATION" Continuous="true">
<Range LowerBound="1" />
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>

</Sound>

<Sound WwiseData="true" WwiseEvent="cchordshort" NodeName="PEDALS_LEFT" ViewPoint="Inside" LocalVar="A32NX_ALT_DEVIATION_SHORT" Continuous="false">
<Range LowerBound="1" />
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>

</Sound>

<Sound WwiseEvent="3click" WwiseData="true" NodeName="PEDALS_LEFT" LocalVar="A32NX_FMA_TRIPLE_CLICK" Continuous="false">
<Range LowerBound="1"/>
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>

</Sound>

<!-- Stall warning =====================================================================-->
<Sound WwiseEvent="aural_stall_new" WwiseData="true" NodeName="PEDALS_LEFT" LocalVar="A32NX_AUDIO_STALL_WARNING" Continuous="true">
<Range LowerBound="1"/>
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>

</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"/>
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>

</Sound>

<Sound WwiseEvent="set_max_reverse" WwiseData="true" NodeName="Wiper_Base_l" LocalVar="A32NX_AUDIO_ROW_SET_MAX_REVERSE" Continuous="true">
<Range LowerBound="1"/>
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>

</Sound>

<Sound WwiseEvent="keep_max_reverse" WwiseData="true" NodeName="Wiper_Base_l" LocalVar="A32NX_AUDIO_ROP_KEEP_MAX_REVERSE" Continuous="false">
<Range LowerBound="1"/>
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>

</Sound>

<Sound WwiseEvent="runway_too_short" WwiseData="true" NodeName="Wiper_Base_l" LocalVar="A32NX_AUDIO_ROW_RWY_TOO_SHORT" Continuous="true">
<Range LowerBound="1"/>
<Requires SimVar="ELECTRICAL MAIN BUS VOLTAGE" Units="VOLTS" Index="1">
<Range LowerBound="28" />
</Requires>

</Sound>

</SimVarSounds>
Expand Down
2 changes: 1 addition & 1 deletion fbw-a32nx/src/systems/instruments/src/EWD/FF.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class FF extends DisplayComponent<FFProps> {
.atFrequency(1)
.handle((ff) => {
const metric = this.props.metric.get();
this.ff.set(fuelForDisplay(ff, metric ? '1' : '0'));
this.ff.set(fuelForDisplay(ff, metric ? '1' : '0', 1, 2));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class EisDisplay extends DisplayComponent<EisDisplayProps> {
} else if (baroValueMode === 0) {
return 'Std';
} else if (baroValueMode === 1) {
return Math.round(baroValue).toString();
return Math.round(baroValue).toString().padStart(4, '0');
} else {
return baroValue.toFixed(2);
}
Expand Down
33 changes: 22 additions & 11 deletions fbw-a32nx/src/systems/instruments/src/FCU/FCU.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,42 @@ import {
} from '@microsoft/msfs-sdk';
import { EisDisplay } from 'instruments/src/FCU/Components/EisDisplay';
import { AfsDisplay } from 'instruments/src/FCU/Components/AfsDisplay';
import { FcuSimvars } from 'instruments/src/FCU/shared/FcuSimvarPublisher';
import { A32NXElectricalSystemEvents } from '../../../shared/src/publishers/A32NXElectricalSystemPublisher';

import './style.scss';
import { FcuSimvars } from 'instruments/src/FCU/shared/FcuSimvarPublisher';

interface FCUProps extends ComponentProps {
bus: EventBus;
}

export class FCUComponent extends DisplayComponent<FCUProps> {
private fcuHealthy = ConsumerSubject.create(null, false);
private readonly sub = this.props.bus.getSubscriber<A32NXElectricalSystemEvents & FcuSimvars>();

onAfterRender(node: VNode): void {
super.onAfterRender(node);
private readonly fcuHealthy = ConsumerSubject.create(this.sub.on('fcuHealthy'), false);

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

this.fcuHealthy.setConsumer(sub.on('fcuHealthy'));
}
private readonly isBacklightPowered = ConsumerSubject.create(this.sub.on('a32nx_elec_ac_1_bus_is_powered'), false);

render(): VNode {
return (
<>
<img id="fcu-background" src="coui://html_ui/Images/fbw-a32nx/FCU/fcu-background.png" />
<svg class="fcu-svg" version="1.1" viewBox="0 0 1280 640" xmlns="http://www.w3.org/2000/svg">
<g class={{ Hide: this.fcuHealthy.map(SubscribableMapFunctions.not()) }}>
<img
id="fcu-background"
src="coui://html_ui/Images/fbw-a32nx/FCU/fcu-background.png"
class={{
Hide: this.isBacklightPowered.map(SubscribableMapFunctions.not()),
}}
/>
<svg
class={{
'fcu-svg': true,
Hide: this.fcuHealthy.map(SubscribableMapFunctions.not()),
}}
version="1.1"
viewBox="0 0 1280 640"
xmlns="http://www.w3.org/2000/svg"
>
<g>
<AfsDisplay bus={this.props.bus} />
<EisDisplay isCaptSide x={0} y={438} bus={this.props.bus} />
<EisDisplay isCaptSide={false} x={920} y={438} bus={this.props.bus} />
Expand Down
5 changes: 4 additions & 1 deletion fbw-a32nx/src/systems/instruments/src/FCU/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"index": "./instrument.tsx",
"isInteractive": false
"isInteractive": false,
"extraDeps": [
"../../../shared/src/publishers"
]
}
70 changes: 35 additions & 35 deletions fbw-a32nx/src/systems/instruments/src/FCU/instrument.tsx
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
import { EventBus, FSComponent, Subject } from '@microsoft/msfs-sdk';
// Copyright (c) 2024 FlyByWire Simulations
// SPDX-License-Identifier: GPL-3.0

import { ConsumerSubject, EventBus, FSComponent, InstrumentBackplane, Subject } from '@microsoft/msfs-sdk';
import { FCUSimvarPublisher } from './shared/FcuSimvarPublisher';
import { FCUComponent } from './FCU';
import { calculateSunAzimuthElevation, lerp, calculateAmbientBrightness } from './SunAngle';
import { MsfsAircraftSystemEvents, MsfsAircraftSystemPublisher } from '@flybywiresim/fbw-sdk';
import {
A32NXElectricalSystemEvents,
A32NXElectricalSystemPublisher,
} from '../../../shared/src/publishers/A32NXElectricalSystemPublisher';

// eslint-disable-next-line camelcase
class A32NX_FCU extends BaseInstrument {
private bus: EventBus;
private readonly bus = new EventBus();
private readonly backplane = new InstrumentBackplane();

private simVarPublisher: FCUSimvarPublisher;
private sub = this.bus.getSubscriber<A32NXElectricalSystemEvents & MsfsAircraftSystemEvents>();

/**
* "mainmenu" = 0
* "loading" = 1
* "briefing" = 2
* "ingame" = 3
*/
private gameState = 0;
private readonly simVarPublisher = new FCUSimvarPublisher(this.bus);
private readonly msfsAircraftSystemPublisher = new MsfsAircraftSystemPublisher(this.bus);
private readonly a32nxElecSystemPublisher = new A32NXElectricalSystemPublisher(this.bus);

private simTime = new Date();

private solarParams = calculateSunAzimuthElevation(this.simTime, 0, 0);

private ambientBrightness = Subject.create(0, (a, b) => Math.abs(a - b) < 0.01);
private readonly ambientBrightness = Subject.create(0, (a, b) => Math.abs(a - b) < 0.01);

private readonly backlightBrightness = ConsumerSubject.create(this.sub.on('msfs_light_potentiometer_87'), 0);

private screenBrightess = Subject.create(0, (a, b) => Math.abs(a - b) < 0.01);
private readonly isBacklightPowered = ConsumerSubject.create(this.sub.on('a32nx_elec_ac_1_bus_is_powered'), false);

constructor() {
super();
this.bus = new EventBus();
this.simVarPublisher = new FCUSimvarPublisher(this.bus);

this.backplane.addPublisher('SimVarPublisher', this.simVarPublisher);
this.backplane.addPublisher('MsfsAircraftSystem', this.msfsAircraftSystemPublisher);
this.backplane.addPublisher('A32NXElectricalSystemPublisher', this.a32nxElecSystemPublisher);

this.ambientBrightness.sub((ambientBrightness) => {
SimVar.SetSimVarValue('L:A32NX_AMBIENT_BRIGHTNESS', 'number', ambientBrightness);
this.updateDisplayBrightness();
});

this.screenBrightess.sub(this.updateDisplayBrightness.bind(this), true);

// need to run this at high speed to avoid jumps when the knob is rotated
setInterval(() => {
const screenBrightess = SimVar.GetSimVarValue('A:LIGHT POTENTIOMETER:87', 'percent over 100');
this.screenBrightess.set(screenBrightess);
});
const updateDisplayBrightness = this.updateDisplayBrightness.bind(this);
this.isBacklightPowered.sub(updateDisplayBrightness);
this.backlightBrightness.sub(updateDisplayBrightness, true);
}

get templateID(): string {
Expand All @@ -50,18 +55,19 @@ class A32NX_FCU extends BaseInstrument {

private updateDisplayBrightness() {
const ambientBrightness = this.ambientBrightness.get();
const screenBrightess = this.screenBrightess.get();
const backlightBrightness = this.isBacklightPowered.get() ? this.backlightBrightness.get() : 0;

const saturation = lerp(ambientBrightness * (1.05 - screenBrightess), 1, 0.6, 10, 100);
const luminosity = lerp(ambientBrightness * (1.05 - screenBrightess), 1, 0.6, 80, 55);
const saturation =
backlightBrightness > 0 ? lerp(ambientBrightness * (1.05 - backlightBrightness), 1, 0.6, 0, 100) : 0;
const luminosity = lerp(ambientBrightness * (1.05 - backlightBrightness), 1, 0.6, 80, 55);
const colour = `hsl(31, ${saturation.toFixed(1)}%, ${luminosity.toFixed(1)}%)`;
document.documentElement.style.setProperty('--main-display-colour', colour);

const textShadowOpacity = lerp(screenBrightess, 0, 1, 0, 0.3) * lerp(ambientBrightness, 0, 0.9, 1, 0);
const textShadowOpacity = lerp(backlightBrightness, 0, 1, 0, 0.3) * lerp(ambientBrightness, 0, 0.9, 1, 0);
const textShadow = `rgba(207, 110, 0, ${textShadowOpacity.toFixed(2)})`;
document.documentElement.style.setProperty('--main-text-shadow-colour', textShadow);

const backgroundOpacity = lerp(screenBrightess, 0, 1, 0, 0.3) * lerp(ambientBrightness, 0, 0.8, 1, 0.1);
const backgroundOpacity = lerp(backlightBrightness, 0, 1, 0, 0.3) * lerp(ambientBrightness, 0, 0.8, 1, 0.1);
document.documentElement.style.setProperty('--main-background-opacity', backgroundOpacity.toString());
}

Expand All @@ -72,20 +78,14 @@ class A32NX_FCU extends BaseInstrument {

// Remove "instrument didn't load" text
document.getElementById('FCU_CONTENT').querySelector(':scope > h1').remove();

this.backplane.init();
}

public Update(): void {
super.Update();

if (this.gameState !== 3) {
const gamestate = this.getGameState();
if (gamestate === 3) {
this.simVarPublisher.startPublish();
}
this.gameState = gamestate;
} else {
this.simVarPublisher.onUpdate();
}
this.backplane.onUpdate();

const lat = SimVar.GetSimVarValue('PLANE LATITUDE', 'degrees');
const lon = SimVar.GetSimVarValue('PLANE LONGITUDE', 'degrees');
Expand Down
Loading

0 comments on commit b540725

Please sign in to comment.