Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/aircraft/PMDG_747_FSUIPC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,26 @@ export default class PMDG_747_FSUIPC extends AircraftConfig {
}

features: FeatureAddresses = {
// PMDG SDK switch fields are single bytes packed back to back. An Int read
// is four bytes, so it swallows the neighbouring switches and `== 1` fails as
// soon as any of them is on. Read them as bytes.
[AircraftFeature.BeaconLights]: {
'0x650A': FeatureType.Int,
'0x650A': FeatureType.Byte,
},
// LTS_LandingLights_Sw_ON[4]: four bytes at 0x6506-0x6509, so one Int read
// covers exactly the four switches.
[AircraftFeature.LandingLights]: {
'0x6506': FeatureType.Int,
},
[AircraftFeature.LogoLights]: false,
[AircraftFeature.NavigationLights]: {
'0x650B': FeatureType.Int,
'0x650B': FeatureType.Byte,
},
[AircraftFeature.StrobeLights]: {
'0x6511': FeatureType.Int,
'0x6511': FeatureType.Byte,
},
[AircraftFeature.TaxiLights]: {
'0x6510': FeatureType.Int,
'0x6510': FeatureType.Byte,
},
[AircraftFeature.WingLights]: false,
}
Expand All @@ -54,7 +59,8 @@ export default class PMDG_747_FSUIPC extends AircraftConfig {
}

landingLights(value: number): FeatureState {
return value == 1
// Any of the four landing-light switches on.
return value != 0
}

navigationLights(value: number): FeatureState {
Expand Down
18 changes: 13 additions & 5 deletions src/aircraft/PMDG_777_FSUIPC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,28 @@ export default class PMDG_777_FSUIPC extends AircraftConfig {
}

features: FeatureAddresses = {
// PMDG SDK switch fields are single bytes packed back to back. An Int read
// is four bytes, so it swallows the neighbouring switches and `== 1` fails as
// soon as any of them is on (landing: the other two landing lights + beacon;
// beacon: nav/logo/wing; taxi: strobe). Read them as bytes.
[AircraftFeature.BeaconLights]: {
'0x6488': FeatureType.Int,
'0x6488': FeatureType.Byte,
},
// LTS_LandingLights_Sw_ON[3]: left/right/nose, three bytes at 0x6485-0x6487.
// Read all three (plus the beacon byte at 0x6488) in one Int and mask it.
[AircraftFeature.LandingLights]: {
'0x6485': FeatureType.Int,
},
[AircraftFeature.LogoLights]: false,
// 0x650B is the 747 nav switch; on the 777 that address is the chronograph.
[AircraftFeature.NavigationLights]: {
'0x650B': FeatureType.Int,
'0x6489': FeatureType.Byte,
},
[AircraftFeature.StrobeLights]: {
'0x648F': FeatureType.Int,
'0x648F': FeatureType.Byte,
},
[AircraftFeature.TaxiLights]: {
'0x648E': FeatureType.Int,
'0x648E': FeatureType.Byte,
},
[AircraftFeature.WingLights]: false,
}
Expand All @@ -54,7 +61,8 @@ export default class PMDG_777_FSUIPC extends AircraftConfig {
}

landingLights(value: number): FeatureState {
return value == 1
// Any of the three landing-light bytes on; the top byte is the beacon.
return (value & 0xffffff) != 0
}

navigationLights(value: number): FeatureState {
Expand Down
Loading