Read an ADS-B vertical rate from one shared field reader

This commit is contained in:
Sameh Khamis committed 2026-11-02 00:09:18 -08:00
1 parent 780d8903ee
commit d479c1c6f6
8 files changed
+68 -9

No files matched your search

+3 -3
View File
@@ -30,6 +30,8 @@
* This module is portable: no Cesium, DOM, network or storage access.
*/
import { readAdsbVerticalRateFpm } from './adsbFields.js';
/** A marker is dropped once its newest position is this old. */
export const LOCAL_ADSB_POSITION_STALE_MS = 60_000;
/** An aircraft is forgotten once no message has arrived for this long. */
@@ -247,9 +249,7 @@ export function normalizeDump1090Aircraft(json, nowMs, { band = '1090' } = {}) {
altitudeFt: altitude,
groundSpeedKt: finiteOrNull(entry.gs),
trackDeg: normalizeTrack(entry.track),
// A GNSS-sourced rate is sent as geom_rate instead of baro_rate.
verticalRateFpm:
finiteOrNull(entry.baro_rate) ?? finiteOrNull(entry.geom_rate),
verticalRateFpm: readAdsbVerticalRateFpm(entry),
lastPositionAt: hasPosition
? receivedAt - Math.max(0, seenPosS) * 1000
: null,