mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
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:
1 parent
15de9d738c
commit
ea1b0d8d55
3 files changed
+19
-3
No files matched your search
+3
-3
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user