mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
fix(local-adsb): show a decoder feed's GNSS-sourced vertical rate
dump1090-fa and readsb file an aircraft's vertical rate under geom_rate instead of baro_rate when its source is GNSS. The decoder-feed adapter read only baro_rate, so those aircraft showed "V/S —" on the Local ADS-B card. It now falls back to geom_rate; a sent baro_rate still wins.
This commit is contained in:
1 parent
a4d3701c3c
commit
c7377362a5
3 files changed
+20
-2
No files matched your search
@@ -6134,7 +6134,9 @@ Receivers publish one record shape from `src/sources/adsbRecords.js`
|
||||
`lastMessageAt`, `messageCount`, `rssiDbfs`, `band`, `source`). `band` is `1090` or `978`; `source` is
|
||||
`webusb` (browser SDR) or `feed` (decoder feed).
|
||||
`normalizeDump1090Aircraft(json, nowMs, { band })` maps a dump1090/readsb/
|
||||
skyaware978 `aircraft.json` document into the same records. Voice
|
||||
skyaware978 `aircraft.json` document into the same records; a row without
|
||||
`baro_rate` reads its vertical rate from `geom_rate`, where a GNSS-sourced rate
|
||||
is sent. Voice
|
||||
`set_layer_visibility` accepts `local-adsb` ("local ADS-B", "my receiver",
|
||||
"my antenna").
|
||||
|
||||
|
||||
@@ -247,7 +247,9 @@ export function normalizeDump1090Aircraft(json, nowMs, { band = '1090' } = {}) {
|
||||
altitudeFt: altitude,
|
||||
groundSpeedKt: finiteOrNull(entry.gs),
|
||||
trackDeg: normalizeTrack(entry.track),
|
||||
verticalRateFpm: finiteOrNull(entry.baro_rate),
|
||||
// A GNSS-sourced rate is sent as geom_rate instead of baro_rate.
|
||||
verticalRateFpm:
|
||||
finiteOrNull(entry.baro_rate) ?? finiteOrNull(entry.geom_rate),
|
||||
lastPositionAt: hasPosition
|
||||
? receivedAt - Math.max(0, seenPosS) * 1000
|
||||
: null,
|
||||
|
||||
@@ -169,6 +169,20 @@ test('a feed document names its band on every record', () => {
|
||||
assert.ok(uat.every((record) => record.source === 'feed'));
|
||||
});
|
||||
|
||||
test('a decoder feed reads a GNSS-sourced vertical rate when no baro rate is sent', () => {
|
||||
// dump1090-fa and readsb file a velocity message's rate under geom_rate
|
||||
// instead of baro_rate when its source bit says GNSS.
|
||||
const rate = (fields) =>
|
||||
normalizeDump1090Aircraft(
|
||||
{ aircraft: [{ hex: 'abc123', seen: 1, ...fields }] },
|
||||
10_000,
|
||||
)[0].verticalRateFpm;
|
||||
assert.equal(rate({ geom_rate: -832 }), -832);
|
||||
assert.equal(rate({ baro_rate: -768, geom_rate: -832 }), -768);
|
||||
assert.equal(rate({ baro_rate: 0, geom_rate: -832 }), 0);
|
||||
assert.equal(rate({}), null);
|
||||
});
|
||||
|
||||
function heard(overrides = {}) {
|
||||
return {
|
||||
icao: 'abc123',
|
||||
|
||||
Reference in new issue
Block a user