Skip to content

Commit

Permalink
feat(pfd): (a32nx, third try): Add vertical deviation indicator, ROW/…
Browse files Browse the repository at this point in the history
…ROP/OANS warnings v3 (#8733)

* linting

* port LinearDeviationIndicator from a32nx PFD

* add PFD warnings for ROW, ROP, OANS

* add speed margins to a380x

* add ROP/ROW/OANS PFD warnings to a32nx

* update two-line message, fix bug in getDisplayIndex()

* make RWY TOO SHORT smaller

* Disable second ISIS; update colors for PFD tapes, PFD horizon, EWD THR gauges

* restructure code, add A380X-only warnings

* refactor Publisher structure, leave only data with existing sources

* switch to data words for ROS/ROP and OANS PFD alerts

* clean up

* feat: add some A429 utils

* fix(pfd): tidy up publishers

* feat: add fwc publisher

* fix(pfd): use fwc data for stall warning

* A380X: GPWS PFD alerts, ROP/ROW aural alerts,
A32NX: Add GPWS discrete word to GPWS,
Both: warnings position update

* use correct discrete word bit fields

* Add ROP/ROW aural alerts to A32NX

* fix lint after rebase

* lint-fix

* update font for IF WET RWY TOO SHORT (fix for a32nx)

* lint + lint-fixes

* add LS reminder for ILS, frequency of ILS information has same font size before and after decimal point

* consolidate to single definitions.scss, use standard colors for thrust gauge and PFD tapes

* move ISIS changes to other PR

* move logic from A32NX_FWC.js to PseudoFWC

* inhibit single chimes for the first two seconds after power-on

* call correct gpwsUpdateDiscreteWords function in A32NX

* fix: wrong speedtape failure indication

* use Arinc429RegisterSubject for rowRop and oans words

* disable global FBW_TYPECHECK

* make compatible with RMP PR

* a32nx fixes

* a32nx: add stallwarningpublisher again

* fix stall warning

* fix: add missing setBitValue

* use setBitValue as intended

* inhibit master caution/warning during PseudoFWC startup

* clear timer if FWC shuts down before timer elapsed

* remove a380x parts 1

* fix the issue

---------

Co-authored-by: Michael Corcoran <tracer@outlook.co.nz>
Co-authored-by: Saschl <sascharudolf46@gmail.com>
Co-authored-by: Saschl <19493808+Saschl@users.noreply.github.com>
  • Loading branch information
4 people committed Jul 8, 2024
1 parent cc89848 commit de2903c
Show file tree
Hide file tree
Showing 15 changed files with 466 additions and 144 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
1. [ND] Fix color of navaids at the active leg termination - @BlueberryKing (BlueberryKing)
1. [EFB] Added a takeoff performance calculator - @donstim (donbikes), @tracernz (Mike)
1. [MCDU] Removed V-speed auto-fill function - @tracernz (Mike)
1. [PFD] Implement alerts within artificial horizon (ROP, ROW, OANS, stall, windshear) @flogross89 (Flo)

## 0.11.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2306,15 +2306,50 @@
</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>

<!-- AvionicSounds ========================================================================================== -->

<AvionicSounds>
<Sound WwiseData="true" WwiseEvent="cchordshort" Continuous="false" NodeName="PEDALS_LEFT" ViewPoint="Inside"/>
<Sound WwiseData="true" WwiseEvent="cchordloop" Continuous="true" NodeName="PEDALS_LEFT" ViewPoint="Inside"/>
<Sound WwiseData="true" WwiseEvent="aural_stall" />
<Sound WwiseData="true" WwiseEvent="aural_stall_new" NodeName="PEDALS_LEFT" ViewPoint="Inside" />
<Sound WwiseData="true" WwiseEvent="aural_pull_up" />
<Sound WwiseData="true" WwiseEvent="aural_pullup_new" Continuous="false" NodeName="PEDALS_LEFT" ViewPoint="Inside"/>
<Sound WwiseData="true" WwiseEvent="aural_overspeed" />
Expand Down Expand Up @@ -2388,13 +2423,6 @@
<Sound WwiseData="true" WwiseEvent="traffic_traffic" NodeName="Wiper_Base_l" />
<Sound WwiseData="true" WwiseEvent="TCAS_sys_test_OK" NodeName="Wiper_Base_l" />

<!-- ROPS callouts ==================================================================================== -->

<Sound WwiseData="true" WwiseEvent="brake_max_braking" NodeName="Wiper_Base_l" />
<Sound WwiseData="true" WwiseEvent="keep_max_reverse" NodeName="Wiper_Base_l" />
<Sound WwiseData="true" WwiseEvent="runway_too_short" NodeName="Wiper_Base_l" />
<Sound WwiseData="true" WwiseEvent="set_max_reverse" NodeName="Wiper_Base_l" />

</AvionicSounds>

<!-- AnimationSounds ========================================================================================== -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class A32NX_GPWS {
{},
],
onChange: (current, _) => {
SimVar.SetSimVarValue("L:A32NX_GPWS_GS_Warning_Active", "Bool", current >= 1);
this.setGlideSlopeWarning(current >= 1);
}
}
];
Expand All @@ -109,15 +109,53 @@ class A32NX_GPWS {
this.AltCallState.setState("ground");
this.RetardState = A32NX_Util.createMachine(RetardStateMachine);
this.RetardState.setState("landed");

this.egpwsAlertDiscreteWord1 = Arinc429Word.empty();
this.egpwsAlertDiscreteWord2 = Arinc429Word.empty();
}

gpwsUpdateDiscreteWords() {
this.egpwsAlertDiscreteWord1.ssm = Arinc429Word.SignStatusMatrix.NormalOperation;
this.egpwsAlertDiscreteWord1.setBitValue(11, this.modes[0].current === 1);
this.egpwsAlertDiscreteWord1.setBitValue(12, this.modes[0].current === 2);
this.egpwsAlertDiscreteWord1.setBitValue(13, this.modes[1].current === 1);
this.egpwsAlertDiscreteWord1.setBitValue(12, this.modes[1].current === 2);
this.egpwsAlertDiscreteWord1.setBitValue(14, this.modes[2].current === 1);
this.egpwsAlertDiscreteWord1.setBitValue(15, this.modes[3].current === 1);
this.egpwsAlertDiscreteWord1.setBitValue(16, this.modes[3].current === 2);
this.egpwsAlertDiscreteWord1.setBitValue(17, this.modes[3].current === 3);
this.egpwsAlertDiscreteWord1.setBitValue(18, this.modes[4].current === 1);
Arinc429Word.toSimVarValue('L:A32NX_EGPWS_ALERT_1_DISCRETE_WORD_1', this.egpwsAlertDiscreteWord1.value, this.egpwsAlertDiscreteWord1.ssm);
Arinc429Word.toSimVarValue('L:A32NX_EGPWS_ALERT_2_DISCRETE_WORD_1', this.egpwsAlertDiscreteWord1.value, this.egpwsAlertDiscreteWord1.ssm);

this.egpwsAlertDiscreteWord2.ssm = Arinc429Word.SignStatusMatrix.NormalOperation;
this.egpwsAlertDiscreteWord2.setBitValue(14, false);
Arinc429Word.toSimVarValue('L:A32NX_EGPWS_ALERT_1_DISCRETE_WORD_2', this.egpwsAlertDiscreteWord2.value, this.egpwsAlertDiscreteWord2.ssm);
Arinc429Word.toSimVarValue('L:A32NX_EGPWS_ALERT_2_DISCRETE_WORD_2', this.egpwsAlertDiscreteWord2.value, this.egpwsAlertDiscreteWord2.ssm);
}

setGlideSlopeWarning(state) {
SimVar.SetSimVarValue('L:A32NX_GPWS_GS_Warning_Active', 'Bool', state ? 1 : 0); // Still need this for XML
this.egpwsAlertDiscreteWord2.setBitValue(11, state);
Arinc429Word.toSimVarValue('L:A32NX_EGPWS_ALERT_1_DISCRETE_WORD_2', this.egpwsAlertDiscreteWord2.value, this.egpwsAlertDiscreteWord2.ssm);
Arinc429Word.toSimVarValue('L:A32NX_EGPWS_ALERT_2_DISCRETE_WORD_2', this.egpwsAlertDiscreteWord2.value, this.egpwsAlertDiscreteWord2.ssm);
}

setGpwsWarning(state) {
SimVar.SetSimVarValue('L:A32NX_GPWS_Warning_Active', 'Bool', state ? 1 : 0); // Still need this for XML
this.egpwsAlertDiscreteWord2.setBitValue(12, state);
this.egpwsAlertDiscreteWord2.setBitValue(13, state);
Arinc429Word.toSimVarValue('L:A32NX_EGPWS_ALERT_1_DISCRETE_WORD_2', this.egpwsAlertDiscreteWord2.value, this.egpwsAlertDiscreteWord2.ssm);
Arinc429Word.toSimVarValue('L:A32NX_EGPWS_ALERT_2_DISCRETE_WORD_2', this.egpwsAlertDiscreteWord2.value, this.egpwsAlertDiscreteWord2.ssm);
}

init() {
console.log('A32NX_GPWS init');

this.radnav.init(NavMode.FOUR_SLOTS);

SimVar.SetSimVarValue("L:A32NX_GPWS_GS_Warning_Active", "Bool", 0);
SimVar.SetSimVarValue("L:A32NX_GPWS_Warning_Active", "Bool", 0);
this.setGlideSlopeWarning(false);
this.setGpwsWarning(false);

NXDataStore.getAndSubscribe('CONFIG_A32NX_FWC_RADIO_AUTO_CALL_OUT_PINS', (k, v) => k === 'CONFIG_A32NX_FWC_RADIO_AUTO_CALL_OUT_PINS' && (this.autoCallOutPins = v), DEFAULT_RADIO_AUTO_CALL_OUTS);
}
Expand Down Expand Up @@ -171,11 +209,12 @@ class A32NX_GPWS {
this.Mode4MaxRAAlt = NaN;
}

SimVar.SetSimVarValue("L:A32NX_GPWS_GS_Warning_Active", "Bool", 0);
SimVar.SetSimVarValue("L:A32NX_GPWS_Warning_Active", "Bool", 0);
this.setGlideSlopeWarning(false);
this.setGpwsWarning(false);
}

this.GPWSComputeLightsAndCallouts();
this.gpwsUpdateDiscreteWords();

if ((mda !== 0 || (dh !== -1 && dh !== -2) && phase === FmgcFlightPhases.APPROACH)) {
let minimumsDA; //MDA or DH
Expand Down Expand Up @@ -276,7 +315,7 @@ class A32NX_GPWS {
}

const illuminateGpwsLight = activeTypes.some((type) => type.gpwsLight);
SimVar.SetSimVarValue("L:A32NX_GPWS_Warning_Active", "Bool", illuminateGpwsLight);
this.setGpwsWarning(illuminateGpwsLight);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ class NavSystem extends BaseInstrument {
}
try {
this.onUpdate(this.accumulatedDeltaTime);
} catch (e) {}
} catch (e) {
console.log("Uncaught exception", e);
}
const t = performance.now() - t0;
NavSystem.maxTimeUpdateAllTime = Math.max(t, NavSystem.maxTimeUpdateAllTime);
NavSystem.maxTimeUpdate = Math.max(t, NavSystem.maxTimeUpdate);
Expand Down
Loading

0 comments on commit de2903c

Please sign in to comment.