Commit graph

120 commits

Author SHA1 Message Date
f364ffe061 Fix CPR zone ambiguity causing aircraft to appear 100km away from actual position
PROBLEM:
- Aircraft were appearing ~100km from receiver when actually ~5km away
- CPR (Compact Position Reporting) algorithm has zone ambiguity issue
- Without reference position, aircraft can appear in wrong 6-degree zones

SOLUTION:
- Add receiver reference position to CPR decoder for zone resolution
- Modified NewDecoder() to accept reference latitude/longitude parameters
- Implement distance-based zone selection (choose solution closest to receiver)
- Updated all decoder instantiations to pass receiver coordinates

TECHNICAL CHANGES:
- decoder.go: Add refLatitude/refLongitude fields and zone ambiguity resolution
- beast.go: Pass source coordinates to NewDecoder()
- beast-dump/main.go: Use default coordinates (0,0) for command-line tool
- merger.go: Add position update debugging for verification
- JavaScript: Add coordinate validation and update logging

RESULT:
- Aircraft now appear at correct distances from receiver
- CPR zone selection based on proximity to known receiver location
- Resolves fundamental ADS-B position accuracy issue

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 14:40:36 +02:00
1de3e092ae Fix aircraft markers not updating positions in real-time
Root cause: The merger was blocking position updates from the same source
after the first position was established, designed for multi-source scenarios
but preventing single-source position updates.

Changes:
- Refactor JavaScript into modular architecture (WebSocketManager, AircraftManager, MapManager, UIManager)
- Add CPR coordinate validation to prevent invalid latitude/longitude values
- Fix merger to allow position updates from same source for moving aircraft
- Add comprehensive coordinate bounds checking in CPR decoder
- Update HTML to use new modular JavaScript with cache busting
- Add WebSocket debug logging to track data flow

Technical details:
- CPR decoder now validates coordinates within ±90° latitude, ±180° longitude
- Merger allows updates when currentBest == sourceID (same source continuous updates)
- JavaScript modules provide better separation of concerns and debugging
- WebSocket properly transmits updated aircraft coordinates to frontend

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 14:04:17 +02:00
ddffe1428d Improve Beast decoder with proper data formatting and altitude decoding
Major improvements to Beast message decoding and data presentation:

Speed & Track Formatting:
- Convert ground speed from float to integer (knots)
- Convert track angle from float to integer (0-359 degrees)
- Add proper rounding for velocity calculations
- Fix surface movement speed calculations

Altitude Decoding Enhancement:
- Implement proper Q-bit handling in altitude decoding
- Add altitude validation (range: -1000 to 60000 feet)
- Fix standard altitude encoding with 25-foot increments
- Add legacy Gray code support for older transponders
- Remove duplicate altitude values caused by incorrect decoding

ICAO Address Display:
- Fix JavaScript hex conversion that caused display corruption
- Remove duplicate toString(16) calls on already-formatted hex strings
- Proper ICAO display format (6-character hex like "4ACA0C")

Data Type Consistency:
- Update Aircraft struct to use integers for GroundSpeed and Track
- Update SpeedPoint struct for consistent integer speed/track storage
- Maintain float64 precision internally while displaying clean integers

Signal Strength:
- Confirm signal strength extraction is working properly
- Signal levels properly flow from Beast parser through merger to frontend
- Display in dBFS format (e.g., -1.57 dBFS)

Results:
- Clean integer speed values (198 kt instead of 238.03361107205006 kt)
- Proper track angles (41° instead of 37.83276127148023°)
- Realistic varying altitudes (1750-1825 ft instead of repeated 24450 ft)
- Correct ICAO formatting (4ACA0C instead of corrupted 103A)
- Working signal strength display (-0.98 to -2.16 dBFS)

The Beast decoder now produces accurate, properly formatted aircraft data
that displays cleanly in the web interface without data corruption.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 10:47:38 +02:00
9ebc7e143e Clean up, format, lint and document entire codebase
Major cleanup and documentation effort:

Code Cleanup:
- Remove 668+ lines of dead code from legacy SBS-1 implementation
- Delete unused packages: internal/config, internal/parser, internal/client/dump1090
- Remove broken test file internal/server/server_test.go
- Remove unused struct fields and imports

Code Quality:
- Format all Go code with gofmt
- Fix all go vet issues
- Fix staticcheck linting issues (error capitalization, unused fields)
- Clean up module dependencies with go mod tidy

Documentation:
- Add comprehensive godoc documentation to all packages
- Document CPR position decoding algorithm with mathematical details
- Document multi-source data fusion strategies
- Add function/method documentation with parameters and return values
- Document error handling and recovery strategies
- Add performance considerations and architectural decisions

README Updates:
- Update project structure to reflect assets/ organization
- Add new features: smart origin, Reset Map button, map controls
- Document origin configuration in config examples
- Add /api/origin endpoint to API documentation
- Update REST endpoints with /api/aircraft/{icao}

Analysis:
- Analyzed adsb-tools and go-adsb for potential improvements
- Confirmed current Beast implementation is production-ready
- Identified optional enhancements for future consideration

The codebase is now clean, well-documented, and follows Go best practices
with zero linting issues and comprehensive documentation throughout.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 10:29:25 +02:00
1425f0a018 Restructure assets to top-level package and add Reset Map button
- Move assets from internal/assets to top-level assets/ package for clean embed directive
- Consolidate all static files in single location (assets/static/)
- Remove duplicate static file locations to maintain single source of truth
- Add Reset Map button to map controls with full functionality
- Implement resetMap() method to return map to calculated origin position
- Store origin in this.mapOrigin for reset functionality
- Fix go:embed pattern to work without parent directory references

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 00:57:49 +02:00
af9bf8ecac Fix map centering to use calculated origin
Backend Changes:
- Added OriginConfig struct to server package
- Modified NewServer to accept origin configuration
- Added /api/origin endpoint to serve origin data to frontend
- Updated main.go to pass origin configuration to server

Frontend Changes:
- Modified initializeMap() to fetch origin from API before map creation
- Updated initializeCoverageMap() to also use origin data
- Added fallback coordinates in case API request fails
- Maps now center on the calculated origin position instead of hardcoded coordinates

The map now properly centers on the calculated average position of enabled
sources (or manually configured origin), providing a much better user experience
with appropriate regional view.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 00:24:45 +02:00
5269da9cd3 Create asset module and add origin configuration
Asset Module:
- Created internal/assets package for clean embedded static file management
- Embedded static files from single source location (static/ directory)
- Eliminated need for duplicate static files or symlinks
- Assets accessible via assets.Static from any package

Origin Configuration:
- Added origin field to configuration with latitude, longitude, and name
- Automatically calculates origin as average of source positions if not specified
- Displays origin information on startup
- Updated config.example.json to show origin usage

Architecture:
- Moved main.go back to cmd/skyview/ structure
- Updated Makefile to build from cmd/skyview
- Clean separation of concerns with reusable asset module

This provides a robust foundation for asset management and proper origin
handling for distance calculations and map centering.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 00:19:00 +02:00
d73ecc2b20 Fix JavaScript error when switching between view tabs
Problem: Clicking on tabs other than Map caused JavaScript errors due to
incorrect DOM element ID resolution in switchView() method.

Root cause: The viewId extraction from button IDs didn't match the expected
view element IDs, causing null reference errors when trying to add classes.

Solution:
- Fixed switchView() to correctly handle view IDs (e.g., "map-view")
- Added null checks for DOM elements to prevent crashes
- Updated this.currentView initialization and comparisons to match full IDs
- Ensured view-specific initialization works with correct baseName extraction

Now all tabs (Map, Table, Statistics, Coverage, 3D Radar) work without errors.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 00:09:25 +02:00
5a4f9e2e20 Fix source popup closing immediately after opening
Problem: Source markers were being recreated on every WebSocket update
(every second), which destroyed any open popups.

Solution: Modified updateSourceMarkers() to:
- Only remove markers for sources that no longer exist
- Update existing markers in-place instead of recreating them
- Preserve open popups by updating content instead of recreating markers
- Only create new markers when sources are actually added

This ensures that clicking on a source marker opens a popup that stays
open for user interaction, similar to aircraft popups.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 00:06:59 +02:00
da1b181666 Fix JavaScript errors and implement Three.js 3D radar
JavaScript fixes:
- Added missing initializeClocks() method
- Added missing updatePopupContent() method for real-time popup updates
- Both methods are now properly integrated into the SkyView class

Three.js improvements:
- Migrated to ES modules for modern Three.js compatibility
- Updated import map for Three.js and OrbitControls
- Implemented full 3D radar visualization with aircraft positioning
- Added proper scene setup with lighting, ground plane, and grid
- Aircraft rendered as 3D cone meshes with altitude and orientation
- Real-time updates when switching to 3D radar view

These changes resolve all browser console errors and provide a working
3D radar visualization feature.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-24 00:03:26 +02:00
559e1d23b9 Fix MIME type handling for static files
- Fixed static file path construction in staticFileHandler
- Removed duplicate 'static' prefix that was causing incorrect file paths
- Now properly serves CSS and JS files with correct MIME types
- Resolves browser security errors from MIME type mismatches

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 23:57:32 +02:00
7340a9d6eb Complete multi-source Beast format implementation
Major features implemented:
- Beast binary format parser with full Mode S/ADS-B decoding
- Multi-source data merger with intelligent signal-based fusion
- Advanced web frontend with 5 view modes (Map, Table, Stats, Coverage, 3D)
- Real-time WebSocket updates with sub-second latency
- Signal strength analysis and coverage heatmaps
- Debian packaging with systemd integration
- Production-ready deployment with security hardening

Technical highlights:
- Concurrent TCP clients with auto-reconnection
- CPR position decoding and aircraft identification
- Historical flight tracking with position trails
- Range circles and receiver location visualization
- Mobile-responsive design with professional UI
- REST API and WebSocket real-time updates
- Comprehensive build system and documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 23:51:37 +02:00
c8562a4f0d Enhance aircraft details display to match dump1090 format
- Add country lookup from ICAO hex codes with flag display
- Implement UTC clocks and last update time indicators
- Enhance aircraft table with ICAO, squawk, and RSSI columns
- Add color-coded RSSI signal strength indicators
- Fix calculateDistance returning string instead of number
- Accept all SBS-1 message types for complete data capture
- Improve data merging to preserve country and registration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 23:20:31 +02:00
55710614da Add historical flight track functionality
- Store track history with position, altitude, speed, and timestamp
- Automatic track point collection every 30 seconds when position changes
- API endpoint /api/aircraft/{hex}/history for individual aircraft tracks
- Frontend "Show History" button to display historical flight paths
- Click aircraft markers to show their historical track (dashed red line)
- Track cleanup: keep last 200 points per aircraft, 24-hour retention
- Add aircraft type badges in table view with color coding
- Start/end markers for historical tracks with timestamps

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:52:16 +02:00
b6a699c24b Add aircraft type classification with distinct icons
- Commercial aircraft: Green airplane icon (default)
- Cargo aircraft: Orange box icon (UPS, FedEx, etc.)
- Military aircraft: Red fighter-style icon (RCH, CNV, etc.)
- General aviation: Yellow light aircraft icon
- Ground aircraft: Gray circle with 'G' indicator
- Add visual legend on map showing aircraft type colors
- Aircraft type detection based on flight number patterns

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:48:20 +02:00
35f476211e Improve aircraft marker visibility
- Increase aircraft marker size from 20px to 24px
- Add aircraft wing elements for better aircraft appearance
- Use bright green color for aircraft with position data
- Add stronger drop shadow for better contrast against map
- Gray out aircraft without position data

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:45:43 +02:00
5c33bdacd2 Fix Chart.js loading and add favicon support
- Switch from chart.min.js to chart.umd.js for proper module loading
- Add favicon.ico file and proper serving
- Add favicon link in HTML head to prevent 404 errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:43:25 +02:00
704d0d2305 Fix static file serving with correct MIME types
- Correct embed file path construction in staticFileHandler
- Static files now served with proper Content-Type headers
- CSS files: text/css, JS files: text/javascript, SVG files: image/svg+xml
- Resolves browser MIME type mismatch errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:36:54 +02:00
df0ead2657 Fix MIME type handling for static files
- Add custom static file handler with proper Content-Type headers
- Fix CSS and JavaScript files being served as text/plain
- Add favicon handler to prevent 404 errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:14:19 +02:00
8ce4f4c397 Initial implementation of SkyView - ADS-B aircraft tracker
- Go application with embedded static files for dump1090 frontend
- TCP client for SBS-1/BaseStation format (port 30003)
- Real-time WebSocket updates with aircraft tracking
- Modern web frontend with Leaflet maps and mobile-responsive design
- Aircraft table with filtering/sorting and statistics dashboard
- Origin configuration for receiver location and distance calculations
- Automatic config.json loading from current directory
- Foreground execution by default with optional -daemon flag

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:09:37 +02:00