# phasta352/flight-radar architecture

> Architecture diagram of the GitHub repository phasta352/flight-radar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/phasta352/flight-radar
- Repository: https://github.com/phasta352/flight-radar

## Overview

This is a Raspberry Pi e-ink flight radar. Its main loop loads configuration, refreshes nearby aircraft and runway data, renders a radar frame, and sends it to the display; it also switches to setup screens when setup mode is active. A separate settings portal lets users configure location, display options, and Wi-Fi, while the setup hotspot supports first-time network setup. The graph includes documented external data sources and settings capabilities. Some source is only partially excerpted, so uncertain internal links are omitted.

Main entry points: [`flightradar/__main__.py`](https://github.com/phasta352/flight-radar/blob/main/flightradar/__main__.py) (Radar loop), [`flightradar/data.py`](https://github.com/phasta352/flight-radar/blob/main/flightradar/data.py) (Flight fetcher), [`flightradar/portal.py`](https://github.com/phasta352/flight-radar/blob/main/flightradar/portal.py) (Settings portal), [`flightradar/runways.py`](https://github.com/phasta352/flight-radar/blob/main/flightradar/runways.py) (Runway finder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_radar["Radar runtime"]
  node_main["Radar loop<br/>[__main__.py]"]
  node_config["Configuration loader<br/>[config.py]"]
  node_renderer["Radar renderer<br/>[render.py]"]
end

subgraph group_data["Flight and map data"]
  node_fetcher["Flight fetcher<br/>[data.py]"]
  node_adsb{{"ADS-B networks"}}
  node_route_services{{"Route lookup services"}}
  node_runways["Runway finder<br/>[runways.py]"]
  node_ourairports{{"OurAirports data"}}
end

subgraph group_setup["Setup and settings"]
  node_settings_file["Saved settings<br/>[settings.py]"]
  node_setup_screen["Setup screen renderer<br/>[setupscreen.py]"]
  node_portal["Settings portal<br/>[portal.py]"]
  node_wifi["Wi-Fi manager<br/>[wifi.py]"]
end

subgraph group_hardware["Display output"]
  node_display["Display driver<br/>[display.py]"]
end

node_user(("Radar user"))
node_browser(("Phone or browser"))
node_network{{"Wi-Fi networks"}}
node_geocoder{{"OpenStreetMap geocoder"}}

node_main -->|"loads configuration"| node_config
node_config -->|"overlays settings"| node_settings_file
node_main -->|"updates runway search"| node_runways
node_runways -->|"downloads runway data"| node_ourairports
node_runways -->|"uses distance helper"| node_fetcher
node_main -->|"fetches aircraft"| node_fetcher
node_fetcher -->|"tries data sources"| node_adsb
node_fetcher -->|"looks up routes"| node_route_services
node_main -->|"renders radar frame"| node_renderer
node_renderer -->|"uses aircraft data"| node_fetcher
node_main -->|"shows rendered frame"| node_display
node_main -->|"renders setup state"| node_setup_screen
node_setup_screen -->|"uses drawing helpers"| node_renderer
node_user -->|"opens settings"| node_browser
node_browser -->|"submits settings"| node_portal
node_portal -->|"reads and saves"| node_settings_file
node_portal -->|"manages Wi-Fi setup"| node_wifi
node_wifi -->|"scans and connects"| node_network
node_portal -->|"geocodes address"| node_geocoder

click node_main "https://github.com/phasta352/flight-radar/blob/main/flightradar/__main__.py"
click node_config "https://github.com/phasta352/flight-radar/blob/main/flightradar/config.py"
click node_settings_file "https://github.com/phasta352/flight-radar/blob/main/flightradar/settings.py"
click node_fetcher "https://github.com/phasta352/flight-radar/blob/main/flightradar/data.py"
click node_runways "https://github.com/phasta352/flight-radar/blob/main/flightradar/runways.py"
click node_renderer "https://github.com/phasta352/flight-radar/blob/main/flightradar/render.py"
click node_setup_screen "https://github.com/phasta352/flight-radar/blob/main/flightradar/setupscreen.py"
click node_display "https://github.com/phasta352/flight-radar/blob/main/flightradar/display.py"
click node_portal "https://github.com/phasta352/flight-radar/blob/main/flightradar/portal.py"
click node_wifi "https://github.com/phasta352/flight-radar/blob/main/flightradar/wifi.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_config,node_renderer,node_user,node_browser toneBlue
class node_fetcher,node_adsb,node_route_services,node_runways,node_ourairports toneAmber
class node_settings_file,node_setup_screen,node_portal,node_wifi toneMint
class node_display toneRose
class node_network,node_geocoder toneIndigo
```

## Components

### Radar runtime

- [Radar loop](https://github.com/phasta352/flight-radar/blob/main/flightradar/__main__.py): `flightradar/__main__.py`
- [Configuration loader](https://github.com/phasta352/flight-radar/blob/main/flightradar/config.py): `flightradar/config.py`
- [Radar renderer](https://github.com/phasta352/flight-radar/blob/main/flightradar/render.py): `flightradar/render.py`

### Flight and map data

- [Flight fetcher](https://github.com/phasta352/flight-radar/blob/main/flightradar/data.py): `flightradar/data.py`
- **ADS-B networks**
- **Route lookup services**
- [Runway finder](https://github.com/phasta352/flight-radar/blob/main/flightradar/runways.py): `flightradar/runways.py`
- **OurAirports data**

### Setup and settings

- [Saved settings](https://github.com/phasta352/flight-radar/blob/main/flightradar/settings.py): `flightradar/settings.py`
- [Setup screen renderer](https://github.com/phasta352/flight-radar/blob/main/flightradar/setupscreen.py): `flightradar/setupscreen.py`
- [Settings portal](https://github.com/phasta352/flight-radar/blob/main/flightradar/portal.py): `flightradar/portal.py`
- [Wi-Fi manager](https://github.com/phasta352/flight-radar/blob/main/flightradar/wifi.py): `flightradar/wifi.py`

### Display output

- [Display driver](https://github.com/phasta352/flight-radar/blob/main/flightradar/display.py): `flightradar/display.py`

### Other components

- **Radar user**
- **Phone or browser**
- **Wi-Fi networks**
- **OpenStreetMap geocoder**

## Connections

- Radar loop → Configuration loader: loads configuration (evidence: `flightradar/__main__.py`)
- Configuration loader → Saved settings: overlays settings (evidence: `flightradar/config.py`)
- Radar loop → Runway finder: updates runway search (evidence: `flightradar/__main__.py`)
- Runway finder → OurAirports data: downloads runway data (evidence: `flightradar/runways.py`)
- Runway finder → Flight fetcher: uses distance helper (evidence: `flightradar/runways.py`)
- Radar loop → Flight fetcher: fetches aircraft (evidence: `flightradar/__main__.py`)
- Flight fetcher → ADS-B networks: tries data sources (evidence: `README.md`)
- Flight fetcher → Route lookup services: looks up routes (evidence: `README.md`)
- Radar loop → Radar renderer: renders radar frame (evidence: `flightradar/__main__.py`)
- Radar renderer → Flight fetcher: uses aircraft data (evidence: `flightradar/render.py`)
- Radar loop → Display driver: shows rendered frame (evidence: `flightradar/__main__.py`)
- Radar loop → Setup screen renderer: renders setup state (evidence: `flightradar/__main__.py`)
- Setup screen renderer → Radar renderer: uses drawing helpers (evidence: `flightradar/setupscreen.py`)
- Radar user → Phone or browser: opens settings (evidence: `README.md`)
- Phone or browser → Settings portal: submits settings (evidence: `README.md`)
- Settings portal → Saved settings: reads and saves (evidence: `flightradar/portal.py`)
- Settings portal → Wi-Fi manager: manages Wi-Fi setup (evidence: `flightradar/portal.py`)
- Wi-Fi manager → Wi-Fi networks: scans and connects (evidence: `flightradar/wifi.py`)
- Settings portal → OpenStreetMap geocoder: geocodes address (evidence: `flightradar/portal.py`)
