From f367c8093688481008662480a84d2f6a10dfd4ba Mon Sep 17 00:00:00 2001 From: "Nabeel S." <99736+nabeelio@users.noreply.github.com> Date: Mon, 16 Nov 2026 12:55:54 -0600 Subject: [PATCH] fix(pmdg): read FSUIPC light switches as bytes PMDG SDK switch fields are one byte each, packed back to back. The client reads FeatureType.Int as four bytes, so each light picked up its neighbours and `== 1` failed as soon as any of them was on: landing swallowed the other two landing lights and the beacon, beacon swallowed nav/logo/wing, taxi swallowed strobe. Taxi only "worked" because strobes are off while taxiing. 777 nav was also 0x650B, the 747's address; on the 777 that byte is the chronograph selector. The 777 nav switch is 0x6489. Landing lights stay Int: the 777 has three switch bytes and the 747 four, so one Int read covers them and the method masks to "any on". --- src/aircraft/PMDG_747_FSUIPC.ts | 16 +++++++++++----- src/aircraft/PMDG_777_FSUIPC.ts | 18 +++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/aircraft/PMDG_747_FSUIPC.ts b/src/aircraft/PMDG_747_FSUIPC.ts index ccddd90..095722b 100644 --- a/src/aircraft/PMDG_747_FSUIPC.ts +++ b/src/aircraft/PMDG_747_FSUIPC.ts @@ -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, } @@ -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 { diff --git a/src/aircraft/PMDG_777_FSUIPC.ts b/src/aircraft/PMDG_777_FSUIPC.ts index bc5ec2b..113ea36 100644 --- a/src/aircraft/PMDG_777_FSUIPC.ts +++ b/src/aircraft/PMDG_777_FSUIPC.ts @@ -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, } @@ -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 {