Fix false emergency alerts and ACARS compatibility

- Fix emergency alerts triggering for non-emergency squawk codes (VFR 1200/7000, etc.)
  by checking squawkInfo.type === 'emergency' before alerting
- Fix emergency filter to only show actual emergency squawk codes
- Add acarsdec version detection to support both -j (newer) and -o 4 (older) JSON flags

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-01-16 08:57:21 +00:00
parent 407d5c1d25
commit 4c1690dd28
2 changed files with 30 additions and 6 deletions
+2 -2
View File
@@ -540,7 +540,7 @@
const squawkInfo = checkSquawkCode(ac);
const onWatchlist = isOnWatchlist(ac);
if (squawkInfo) {
if (squawkInfo && squawkInfo.type === 'emergency') {
alertedAircraft[icao] = 'emergency';
playAlertSound('emergency');
showAlertBanner(`EMERGENCY: ${squawkInfo.name} - ${ac.callsign || icao}`, '#ff0000');
@@ -1905,7 +1905,7 @@ ACARS: ${r.statistics.acarsMessages} messages`;
const squawkInfo = checkSquawkCode(ac);
if (currentFilter === 'military') return militaryInfo.military;
if (currentFilter === 'civil') return !militaryInfo.military;
if (currentFilter === 'emergency') return !!squawkInfo;
if (currentFilter === 'emergency') return squawkInfo && squawkInfo.type === 'emergency';
if (currentFilter === 'watchlist') return isOnWatchlist(ac);
return true;
}