Decodes a 13-bit Mode-S altitude code (the AC field of DF0/4/16/20
surveillance replies) to feet, per ICAO Annex 10 Vol. IV / RTCA DO-260.
The field supports two encodings, selected by the Q bit: a 25-foot
linear encoding (Q=1), or a 100-foot Gillham (Gray code) encoding
(Q=0) - the legacy scheme shared with Mode-C. Bit layout, MSB first:
C1 A1 C2 A2 C4 A4 M B1 Q B2 D2 B4 D4.
Parameters
altitudeCode: number
The raw 13-bit AC field, 0-8191.
Returns number|undefined
Altitude in feet, or undefined if the field is all-zero (altitude unknown), reports the rare M (metric) encoding, or contains an invalid Gillham value.
Decodes a 13-bit Mode-S altitude code (the AC field of DF0/4/16/20 surveillance replies) to feet, per ICAO Annex 10 Vol. IV / RTCA DO-260.
The field supports two encodings, selected by the Q bit: a 25-foot linear encoding (Q=1), or a 100-foot Gillham (Gray code) encoding (Q=0) - the legacy scheme shared with Mode-C. Bit layout, MSB first:
C1 A1 C2 A2 C4 A4 M B1 Q B2 D2 B4 D4.