generated from phpvms/acars-pdk
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathFlyByWireA380X.ts
141 lines (123 loc) · 4.38 KB
/
FlyByWireA380X.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import { AircraftConfigSimType, AircraftFeature, FeatureType } from '../defs'
import {
AircraftConfig,
FeatureAddresses,
FeatureState,
FlapNames,
Meta,
} from '../interface/aircraft'
export default class FlyByWireA380X extends AircraftConfig {
meta: Meta = {
id: 'flybywire_a380x',
name: 'FlyByWire A380X',
sim: AircraftConfigSimType.MsFs,
enabled: true,
priority: 2,
author: 'Arthur Parienté <https://github.com/arthurpar06>'
}
features: FeatureAddresses = {
[AircraftFeature.BeaconLights]: {
LIGHTING_BEACON_0: FeatureType.Int,
},
[AircraftFeature.LandingLights]: {
LIGHTING_LANDING_2: FeatureType.Int,
},
[AircraftFeature.LogoLights]: {
// Lhe logo light isn't available in the FBW A380X at the moment; in the sim, the navigation light currently controls the logo ligh
LIGHTING_NAV_0: FeatureType.Int,
},
[AircraftFeature.NavigationLights]: {
LIGHTING_NAV_0: FeatureType.Int,
},
[AircraftFeature.StrobeLights]: {
LIGHTING_STROBE_0: FeatureType.Int,
},
[AircraftFeature.TaxiLights]: {
LIGHTING_LANDING_1: FeatureType.Int,
},
[AircraftFeature.WingLights]: {
LIGHTING_WING_0: FeatureType.Int,
},
[AircraftFeature.APU]: {
A32NX_OVHD_APU_MASTER_SW_PB_IS_ON: FeatureType.Int,
A32NX_OVHD_APU_START_SW_PB_IS_ON: FeatureType.Int,
},
[AircraftFeature.Battery]: {
A32NX_OVHD_ELEC_BAT_1_PB_IS_AUTO: FeatureType.Int,
A32NX_OVHD_ELEC_BAT_2_PB_IS_AUTO: FeatureType.Int,
A32NX_OVHD_ELEC_BAT_ESS_PB_IS_AUTO: FeatureType.Int,
A32NX_OVHD_ELEC_BAT_APU_PB_IS_AUTO: FeatureType.Int,
},
[AircraftFeature.Seatbelts]: {
XMLVAR_SWITCH_OVHD_INTLT_SEATBELT_Position: FeatureType.Int,
A32NX_FLAPS_HANDLE_INDEX: FeatureType.Int,
A32NX_GEAR_HANDLE_POSITION: FeatureType.Int,
},
[AircraftFeature.EmergencyLights]: {
XMLVAR_SWITCH_OVHD_INTLT_EMEREXIT_Position: FeatureType.Int,
},
[AircraftFeature.AntiIce]: {
XMLVAR_Momentary_PUSH_OVHD_ANTIICE_ENG1_Pressed: FeatureType.Int,
XMLVAR_Momentary_PUSH_OVHD_ANTIICE_ENG2_Pressed: FeatureType.Int,
XMLVAR_Momentary_PUSH_OVHD_ANTIICE_ENG3_Pressed: FeatureType.Int,
XMLVAR_Momentary_PUSH_OVHD_ANTIICE_ENG4_Pressed: FeatureType.Int,
XMLVAR_Momentary_PUSH_OVHD_ANTIICE_WING_Pressed: FeatureType.Int,
}
}
flapNames: FlapNames = {
0: 'UP',
1: 'CONF 1',
2: 'CONF 1+F',
3: 'CONF 2',
4: 'CONF 3',
5: 'FULL',
}
match(title: string, icao: string, config_path: string): boolean {
if (!title.includes('a380')) {
return false;
}
return ['fbw', 'flybywire'].some((w) => title.includes(w));
}
beaconLights(value: number): FeatureState {
return value === 1;
}
landingLights(value: number): FeatureState {
return value === 1;
}
logoLights(value: number): FeatureState {
return value === 1;
}
navigationLights(value: number): FeatureState {
return value === 1;
}
strobeLights(value: number): FeatureState {
if (value === 1) {
return null;
}
return value === 0;
}
wingLights(value: number): FeatureState {
return value === 1;
}
taxiLights(value: number): FeatureState {
return value === 0 || value === 1;
}
APU(mastersw: number, startsw: number): FeatureState {
return mastersw === 1 && startsw === 1;
}
battery(bat1: number, bat2: number, ess: number, apu: number): FeatureState {
return bat1 === 1 || bat2 === 1 || ess === 1 || apu === 1
}
emergencyLights(value: number): FeatureState {
return value !== 2;
}
seatbelts(value: number, flapsPosition: number, gearPosition: number): FeatureState {
if (value === 1) {
return flapsPosition !== 0 || gearPosition === 1;
}
return value === 0;
}
antiIce(eng1: number, eng2: number, eng3: number, eng4: number, wing: number): FeatureState {
return eng1 === 1 || eng2 === 1 || eng3 === 1 || eng4 === 1 || wing === 1;
}
}