Skip to content

QNH tracking#10

Merged
BenWalker01 merged 2 commits intoVATSIM-UK:masterfrom
19wintersp:qnh-tracker
Mar 13, 2026
Merged

QNH tracking#10
BenWalker01 merged 2 commits intoVATSIM-UK:masterfrom
19wintersp:qnh-tracker

Conversation

@19wintersp
Copy link

Tracks last received QNH per aircraft. Controller can see the last received QNH and whether it is the latest (via new tag item 451), update to the latest QNH (tag function 551), or reset the tracker (552).

On the code: QNH is tracked by a new singleton class which stores each QNH entry as a combination of QNH value, as the two least-significant ASCII digits of the pressure value, and a serial value, to mark a received pressure as stale if the aerodrome QNH changes to a new value, then changes back. The serial will overflow after about a year of continuous half-hourly updates. It probably would be nicer to use a packed representation for the QNH (eg. a short containing BCD values) instead of a pair of chars, but the chars can be copied directly from the METAR and to the tag item string, and the memcpy will probably be optimised to a register copy anyway. The QNH is extracted from the METAR on the assumption that the first occurrence of the string Q in the METAR string precedes the QNH, which is true of any valid METAR under Annex 3 (Q alone does not suffice because of the SQ condition).

Will look to test this at some point when I have time to do so

Copy link
Author

@19wintersp 19wintersp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor issues worth considering

@19wintersp
Copy link
Author

Seems to work fine

image

@BenWalker01 BenWalker01 merged commit c0bdb4b into VATSIM-UK:master Mar 13, 2026
1 check passed
@19wintersp 19wintersp deleted the qnh-tracker branch March 13, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants