fix(voice): leave out an unreported altitude instead of saying 0 feet

select_nearest_aircraft passes altitudeM: null for an airborne contact
without a barometric altitude (military rows from adsb.lol can lack
alt_baro). The speech builder coerced it with Number(), and Number(null)
is 0, so the reply said "..., 0 feet." and the voice card showed
"Altitude 0 feet". Read the altitude only when it is a finite number,
so an unknown one is left out as the builder already intends.
This commit is contained in:
Aditya committed 2026-10-27 15:54:36 +05:30
1 parent 15de9d738c
commit ea1b0d8d55
3 files changed
+19 -3

No files matched your search

+3 -3
View File
@@ -74,9 +74,9 @@ function listPhrase(items) {
}
function feetRounded(meters) {
const value = Number(meters);
return Number.isFinite(value)
? Math.round((value * 3.28084) / 100) * 100
// A missing altitude is unknown, not sea level: Number(null) is 0.
return Number.isFinite(meters)
? Math.round((meters * 3.28084) / 100) * 100
: null;
}