From 73ac74a9d69c2a16c9e120dee4d44cfcfb698926 Mon Sep 17 00:00:00 2001 From: Smittix Date: Thu, 8 Jan 2026 21:03:42 +0000 Subject: [PATCH] Add clickable squawk code reference on aircraft dashboard Click any aircraft's squawk code to see its meaning and a full reference table of common codes. Emergency codes highlighted in red. Co-Authored-By: Claude Opus 4.5 --- templates/adsb_dashboard.html | 256 +++++++++++++++++++++++++++++++++- 1 file changed, 252 insertions(+), 4 deletions(-) diff --git a/templates/adsb_dashboard.html b/templates/adsb_dashboard.html index 0a1b014..930054f 100644 --- a/templates/adsb_dashboard.html +++ b/templates/adsb_dashboard.html @@ -298,11 +298,44 @@ ]; const SQUAWK_CODES = { - '7500': { type: 'hijack', name: 'HIJACK' }, - '7600': { type: 'radio', name: 'RADIO FAILURE' }, - '7700': { type: 'mayday', name: 'EMERGENCY' } + // Emergency codes + '7500': { type: 'emergency', name: 'HIJACK', desc: 'Aircraft is being hijacked', color: '#ff0000' }, + '7600': { type: 'emergency', name: 'RADIO FAILURE', desc: 'Lost communication with ATC', color: '#ff6600' }, + '7700': { type: 'emergency', name: 'EMERGENCY', desc: 'General emergency (mayday)', color: '#ff0000' }, + // Special codes + '7777': { type: 'special', name: 'MILITARY INTERCEPT', desc: 'Military interceptor operations', color: '#ff00ff' }, + '7000': { type: 'vfr', name: 'VFR (EU)', desc: 'Visual Flight Rules - Europe', color: '#00d4ff' }, + '1200': { type: 'vfr', name: 'VFR (US/CA)', desc: 'Visual Flight Rules - North America', color: '#00d4ff' }, + '2000': { type: 'standard', name: 'UNASSIGNED', desc: 'No assigned code / entering controlled airspace', color: '#888888' }, + '1000': { type: 'standard', name: 'IFR (EU)', desc: 'Instrument Flight Rules with no assigned code', color: '#00ff88' }, + '0000': { type: 'special', name: 'DISCRETE', desc: 'Military/special operations', color: '#ff00ff' }, + '4000': { type: 'special', name: 'FERRY/DELIVERY', desc: 'Aircraft ferry/delivery flight', color: '#ffaa00' }, + '5000': { type: 'special', name: 'MILITARY (UK)', desc: 'UK military operations', color: '#556b2f' }, + '0033': { type: 'special', name: 'PARACHUTE OPS', desc: 'Parachute dropping in progress', color: '#ffaa00' }, + '7001': { type: 'special', name: 'VFR INTRUSION', desc: 'VFR aircraft entering controlled airspace', color: '#ffaa00' }, + '7004': { type: 'special', name: 'AEROBATIC', desc: 'Aerobatic flight display', color: '#00d4ff' }, + '7010': { type: 'special', name: 'RADIO EQUIPPED', desc: 'IFR flight (UK zones)', color: '#00ff88' } }; + const SQUAWK_REFERENCE = [ + { code: '7500', name: 'Hijack', desc: 'Aircraft is being hijacked - do not acknowledge' }, + { code: '7600', name: 'Radio Failure', desc: 'Two-way radio communication failure' }, + { code: '7700', name: 'Emergency', desc: 'General emergency (mayday/pan-pan)' }, + { code: '7777', name: 'Military Intercept', desc: 'Active military intercept operations' }, + { code: '---', name: '---', desc: '---' }, + { code: '1200', name: 'VFR (US/Canada)', desc: 'Visual flight rules - North America' }, + { code: '7000', name: 'VFR (Europe)', desc: 'Visual flight rules - ICAO/Europe' }, + { code: '2000', name: 'Conspicuity', desc: 'Entering airspace, no code assigned' }, + { code: '1000', name: 'IFR (Europe)', desc: 'Instrument flight rules, no code assigned' }, + { code: '---', name: '---', desc: '---' }, + { code: '0000', name: 'Discrete', desc: 'Military/special operations' }, + { code: '0033', name: 'Parachute Ops', desc: 'Parachute dropping operations' }, + { code: '4000', name: 'Ferry Flight', desc: 'Aircraft delivery/repositioning' }, + { code: '5000', name: 'Military (UK)', desc: 'UK military low-level operations' }, + { code: '7001', name: 'VFR Intrusion', desc: 'VFR aircraft entering controlled space' }, + { code: '7004', name: 'Aerobatic', desc: 'Aerobatic display flight' } + ]; + function isMilitaryAircraft(icao, callsign) { const icaoNum = parseInt(icao, 16); for (const range of MILITARY_RANGES) { @@ -1607,7 +1640,7 @@ sudo make install
Squawk
-
${squawk}
+
${squawk}
Lat
@@ -2062,6 +2095,221 @@ sudo make install // Initialize airband on page load document.addEventListener('DOMContentLoaded', initAirband); + + // ============================================ + // SQUAWK CODE REFERENCE + // ============================================ + function showSquawkInfo(code) { + const modal = document.getElementById('squawkModal'); + const codeInfo = document.getElementById('squawkCodeInfo'); + const refTable = document.getElementById('squawkRefTable'); + + // Show info for the clicked code + let infoHtml = ''; + if (code && code !== 'N/A' && SQUAWK_CODES[code]) { + const info = SQUAWK_CODES[code]; + infoHtml = ` +
+
${code}
+
${info.name}
+
${info.desc}
+
+ `; + } else if (code && code !== 'N/A') { + infoHtml = ` +
+
${code}
+
ASSIGNED CODE
+
Discrete code assigned by ATC for identification
+
+ `; + } + codeInfo.innerHTML = infoHtml; + + // Build reference table + let tableHtml = ''; + SQUAWK_REFERENCE.forEach(item => { + if (item.code === '---') { + tableHtml += ``; + } else { + const isEmergency = ['7500', '7600', '7700'].includes(item.code); + tableHtml += ` + + ${item.code} + ${item.name} + ${item.desc} + + `; + } + }); + refTable.innerHTML = tableHtml; + + modal.classList.add('active'); + } + + function closeSquawkModal() { + document.getElementById('squawkModal').classList.remove('active'); + } + + // Close modal on overlay click + document.getElementById('squawkModal')?.addEventListener('click', (e) => { + if (e.target.id === 'squawkModal') closeSquawkModal(); + }); + + +
+
+
+ SQUAWK CODE REFERENCE + +
+
+
+ + + + + + + + + +
CodeNameDescription
+
+
+
+ +