11// @ts -strict-ignore
22import {
3- Arinc429Register ,
43 Arinc429Word ,
54 NXLogicConfirmNode ,
65 NXLogicMemoryNode ,
@@ -9,13 +8,8 @@ import {
98
109// FIXME move to PseudoFWC
1110export class A32NX_FWC {
12- // momentary
13- private toConfigTest = false ; // WTOCT
14-
1511 // persistent
1612 private flightPhase = null ;
17- private ldgMemo = null ;
18- private toMemo = null ;
1913
2014 // ESDL 1. 0. 60
2115 private gndMemo = new NXLogicConfirmNode ( 1 ) ; // outptuts ZGND
@@ -46,34 +40,8 @@ export class A32NX_FWC {
4640 private phase5Memo = new NXLogicTriggeredMonostableNode ( 120 ) ; // MTRIG 01
4741 private phase67Memo = new NXLogicTriggeredMonostableNode ( 180 ) ; // MTRIG 02
4842
49- // ESDL 1. 0.180
50- private memoTo_conf01 = new NXLogicConfirmNode ( 120 , true ) ; // CONF 01
51- private memoTo_memo = new NXLogicMemoryNode ( false ) ;
52-
53- // ESDL 1. 0.190
54- private memoLdgMemo_conf01 = new NXLogicConfirmNode ( 1 , true ) ; // CONF 01
55- private memoLdgMemo_inhibit = new NXLogicMemoryNode ( false ) ;
56- private memoLdgMemo_conf02 = new NXLogicConfirmNode ( 10 , true ) ; // CONF 01
57- private memoLdgMemo_below2000ft = new NXLogicMemoryNode ( true ) ;
58-
59- // ESDL 1. 0.310
60- private memoToInhibit_conf01 = new NXLogicConfirmNode ( 3 , true ) ; // CONF 01
61-
62- // ESDL 1. 0.320
63- private memoLdgInhibit_conf01 = new NXLogicConfirmNode ( 3 , true ) ; // CONF 01
64-
65- private readonly ecpWarningButtonStatus = Arinc429Register . empty ( ) ;
66-
6743 update ( _deltaTime , _core ) {
6844 this . _updateFlightPhase ( _deltaTime ) ;
69- this . _updateButtons ( _deltaTime ) ;
70- this . _updateTakeoffMemo ( _deltaTime ) ;
71- this . _updateLandingMemo ( _deltaTime ) ;
72- }
73-
74- _updateButtons ( _deltaTime ) {
75- this . ecpWarningButtonStatus . setFromSimVar ( 'L:A32NX_ECP_WARNING_SWITCH_WORD' ) ;
76- this . toConfigTest = this . ecpWarningButtonStatus . bitValue ( 18 ) ;
7745 }
7846
7947 _updateFlightPhase ( _deltaTime ) {
@@ -226,62 +194,4 @@ export class A32NX_FWC {
226194 this . flightPhase = flightPhase ;
227195 SimVar . SetSimVarValue ( 'L:A32NX_FWC_FLIGHT_PHASE' , 'Enum' , this . flightPhase || 0 ) ;
228196 }
229-
230- _updateTakeoffMemo ( _deltaTime ) {
231- /// FWC ESLD 1.0.180
232- const setFlightPhaseMemo = this . flightPhase === 2 && this . toConfigTest ;
233- const resetFlightPhaseMemo =
234- this . flightPhase === 10 || this . flightPhase === 3 || this . flightPhase === 1 || this . flightPhase === 6 ;
235- const flightPhaseMemo = this . memoTo_memo . write ( setFlightPhaseMemo , resetFlightPhaseMemo ) ;
236-
237- const eng1NotRunning = SimVar . GetSimVarValue ( 'ENG N1 RPM:1' , 'Percent' ) < 15 ;
238- const eng2NotRunning = SimVar . GetSimVarValue ( 'ENG N1 RPM:2' , 'Percent' ) < 15 ;
239- const toTimerElapsed = this . memoTo_conf01 . write ( ! eng1NotRunning && ! eng2NotRunning , _deltaTime ) ;
240-
241- this . toMemo = flightPhaseMemo || ( this . flightPhase === 2 && toTimerElapsed ) ;
242- SimVar . SetSimVarValue ( 'L:A32NX_FWC_TOMEMO' , 'Bool' , this . toMemo ) ;
243- }
244-
245- _updateLandingMemo ( _deltaTime ) {
246- const radioHeight1 = Arinc429Word . fromSimVarValue ( 'L:A32NX_RA_1_RADIO_ALTITUDE' ) ;
247- const radioHeight2 = Arinc429Word . fromSimVarValue ( 'L:A32NX_RA_2_RADIO_ALTITUDE' ) ;
248- const radioHeight1Invalid = radioHeight1 . isFailureWarning ( ) || radioHeight1 . isNoComputedData ( ) ;
249- const radioHeight2Invalid = radioHeight2 . isFailureWarning ( ) || radioHeight2 . isNoComputedData ( ) ;
250- const gearDownlocked = SimVar . GetSimVarValue ( 'GEAR TOTAL PCT EXTENDED' , 'percent' ) > 0.95 ;
251-
252- // FWC ESLD 1.0.190
253- const setBelow2000ft =
254- ( radioHeight1 . value < 2000 && ! radioHeight1Invalid ) || ( radioHeight2 . value < 2000 && ! radioHeight2Invalid ) ;
255- const resetBelow2000ft =
256- ( radioHeight1 . value > 2200 || radioHeight1Invalid ) && ( radioHeight2 . value > 2200 || radioHeight2Invalid ) ;
257- const memo2 = this . memoLdgMemo_below2000ft . write ( setBelow2000ft , resetBelow2000ft ) ;
258-
259- const setInhibitMemo = this . memoLdgMemo_conf01 . write (
260- resetBelow2000ft && ! radioHeight1Invalid && ! radioHeight2Invalid ,
261- _deltaTime ,
262- ) ;
263- const resetInhibitMemo = ! ( this . flightPhase === 7 || this . flightPhase === 8 || this . flightPhase === 6 ) ;
264- const memo1 = this . memoLdgMemo_inhibit . write ( setInhibitMemo , resetInhibitMemo ) ;
265-
266- const showInApproach = memo1 && memo2 && this . flightPhase === 6 ;
267-
268- const invalidRadioMemo = this . memoLdgMemo_conf02 . write (
269- radioHeight1Invalid && radioHeight2Invalid && gearDownlocked && this . flightPhase === 6 ,
270- _deltaTime ,
271- ) ;
272-
273- this . ldgMemo = showInApproach || invalidRadioMemo || this . flightPhase === 8 || this . flightPhase === 7 ;
274- SimVar . SetSimVarValue ( 'L:A32NX_FWC_LDGMEMO' , 'Bool' , this . ldgMemo ) ;
275- }
276-
277- hasAltitudeConstraint ( ) {
278- // FIXME SUSSY code reading an LVar that's never written
279- if (
280- Simplane . getAutoPilotAltitudeManaged ( ) &&
281- SimVar . GetSimVarValue ( 'L:AP_CURRENT_TARGET_ALTITUDE_IS_CONSTRAINT' , 'number' ) != 0
282- ) {
283- return false ;
284- }
285- return true ;
286- }
287197}
0 commit comments