# twotoz/c5vrx architecture

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

- Interactive diagram: https://gitdiagram.com/twotoz/c5vrx
- Repository: https://github.com/twotoz/c5vrx

## Overview

C5VRX-5 is an experimental ESP32-C5 analog 5.8 GHz FPV receiver: it receives RF, demodulates and processes the signal, then produces PAL/NTSC composite video through a passive six-bit DAC. Its principal workflow is accompanied by calibration, gain control, settings, diagnostics, and browser-based flashing and receiver controls. The tree also contains earlier receiver generations and research tools; only substantial legacy runtime pipelines are shown here. Relationships are limited to calls visible in excerpts or capabilities explicitly described in the README; unsampled internals are not inferred.

Main entry points: [`main/main.c`](https://github.com/twotoz/c5vrx/blob/main/main/main.c) (Boot orchestration), [`web/app.js`](https://github.com/twotoz/c5vrx/blob/main/web/app.js) (Web controls), [`main/rf.c`](https://github.com/twotoz/c5vrx/blob/main/main/rf.c) (RF reception), [`main/transport.c`](https://github.com/twotoz/c5vrx/blob/main/main/transport.c) (Demodulation transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["Receiver firmware"]
  node_boot["Boot orchestration<br/>[main.c]"]
  node_rf["RF reception<br/>[rf.c]"]
  node_receiver["Receiver control<br/>[receiver.c]"]
  node_transport["Demodulation transport<br/>[transport.c]"]
  node_video["CVBS output<br/>[phy.c]"]
  node_calibration["Calibration<br/>[calibration.c]"]
  node_profile["Receive profiles<br/>[profile.c]"]
  node_settings["Persistent settings<br/>[settings.c]"]
  node_menu["On-screen menu<br/>[menu.c]"]
  node_console["Diagnostics console<br/>[console.c]"]
  node_flightlog["Flight logging<br/>[flightlog.c]"]
end

subgraph group_web["Browser interface"]
  node_webapp["Web controls<br/>[app.js]"]
  node_flasher["Serial flashing<br/>[esptool.js]"]
  node_serial["Serial terminal<br/>[serial-terminal.js]"]
  node_webconsole["Receiver console UI"]
  node_webflight["Flight-log decoding<br/>[flight-log.js]"]
end

subgraph group_legacy["Legacy firmware"]
  node_legacy1["C5VRX-1 live pipeline"]
  node_legacy3["C5VRX-3 gain controller"]
  node_legacy4["C5VRX-4 pipeline<br/>[pipeline.c]"]
end

node_operator(("Operator"))
node_browser(("Browser user"))

node_operator -.->|"supplies video signal"| node_rf
node_rf -.->|"feeds received signal"| node_transport
node_transport -.->|"produces composite video"| node_video
node_boot -->|"starts RF"| node_rf
node_boot -->|"starts calibration"| node_calibration
node_boot -->|"loads and selects"| node_profile
node_boot -->|"starts transport"| node_transport
node_boot -->|"starts receiver"| node_receiver
node_boot -->|"starts logging"| node_flightlog
node_browser -.->|"uses controls"| node_webapp
node_webapp -->|"invokes flashing"| node_flasher
node_webapp -->|"uses terminal"| node_serial
node_webapp -->|"uses receiver UI"| node_webconsole
node_webapp -->|"decodes logs"| node_webflight
node_boot -.->|"legacy generation"| node_legacy1
node_boot -.->|"legacy generation"| node_legacy3
node_boot -.->|"legacy generation"| node_legacy4

click node_boot "https://github.com/twotoz/c5vrx/blob/main/main/main.c"
click node_rf "https://github.com/twotoz/c5vrx/blob/main/main/rf.c"
click node_receiver "https://github.com/twotoz/c5vrx/blob/main/main/receiver.c"
click node_transport "https://github.com/twotoz/c5vrx/blob/main/main/transport.c"
click node_video "https://github.com/twotoz/c5vrx/blob/main/main/phy.c"
click node_calibration "https://github.com/twotoz/c5vrx/blob/main/main/calibration.c"
click node_profile "https://github.com/twotoz/c5vrx/blob/main/main/profile.c"
click node_settings "https://github.com/twotoz/c5vrx/blob/main/main/settings.c"
click node_menu "https://github.com/twotoz/c5vrx/blob/main/main/menu.c"
click node_console "https://github.com/twotoz/c5vrx/blob/main/main/console.c"
click node_flightlog "https://github.com/twotoz/c5vrx/blob/main/main/flightlog.c"
click node_webapp "https://github.com/twotoz/c5vrx/blob/main/web/app.js"
click node_flasher "https://github.com/twotoz/c5vrx/blob/main/web/esptool.js"
click node_serial "https://github.com/twotoz/c5vrx/blob/main/web/serial-terminal.js"
click node_webconsole "https://github.com/twotoz/c5vrx/blob/main/web/receiver-console.js"
click node_webflight "https://github.com/twotoz/c5vrx/blob/main/web/flight-log.js"
click node_legacy1 "https://github.com/twotoz/c5vrx/blob/main/legacy/c5vrx1/main/c5vrx_live_pipeline.c"
click node_legacy3 "https://github.com/twotoz/c5vrx/blob/main/legacy/c5vrx3/main/arc_v3_controller.c"
click node_legacy4 "https://github.com/twotoz/c5vrx/blob/main/legacy/c5vrx4/pipeline.c"

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_boot,node_rf,node_receiver,node_transport,node_video,node_calibration,node_profile,node_settings,node_menu,node_console,node_flightlog,node_browser toneBlue
class node_webapp,node_flasher,node_serial,node_webconsole,node_webflight toneAmber
class node_legacy1,node_legacy3,node_legacy4 toneMint
class node_operator toneIndigo
```

## Components

### Receiver firmware

- [Boot orchestration](https://github.com/twotoz/c5vrx/blob/main/main/main.c): `main/main.c`
- [RF reception](https://github.com/twotoz/c5vrx/blob/main/main/rf.c): `main/rf.c`
- [Receiver control](https://github.com/twotoz/c5vrx/blob/main/main/receiver.c): `main/receiver.c`
- [Demodulation transport](https://github.com/twotoz/c5vrx/blob/main/main/transport.c): `main/transport.c`
- [CVBS output](https://github.com/twotoz/c5vrx/blob/main/main/phy.c): `main/phy.c`
- [Calibration](https://github.com/twotoz/c5vrx/blob/main/main/calibration.c): `main/calibration.c`
- [Receive profiles](https://github.com/twotoz/c5vrx/blob/main/main/profile.c): `main/profile.c`
- [Persistent settings](https://github.com/twotoz/c5vrx/blob/main/main/settings.c): `main/settings.c`
- [On-screen menu](https://github.com/twotoz/c5vrx/blob/main/main/menu.c): `main/menu.c`
- [Diagnostics console](https://github.com/twotoz/c5vrx/blob/main/main/console.c): `main/console.c`
- [Flight logging](https://github.com/twotoz/c5vrx/blob/main/main/flightlog.c): `main/flightlog.c`

### Browser interface

- [Web controls](https://github.com/twotoz/c5vrx/blob/main/web/app.js): `web/app.js`
- [Serial flashing](https://github.com/twotoz/c5vrx/blob/main/web/esptool.js): `web/esptool.js`
- [Serial terminal](https://github.com/twotoz/c5vrx/blob/main/web/serial-terminal.js): `web/serial-terminal.js`
- [Receiver console UI](https://github.com/twotoz/c5vrx/blob/main/web/receiver-console.js): `web/receiver-console.js`
- [Flight-log decoding](https://github.com/twotoz/c5vrx/blob/main/web/flight-log.js): `web/flight-log.js`

### Legacy firmware

- [C5VRX-1 live pipeline](https://github.com/twotoz/c5vrx/blob/main/legacy/c5vrx1/main/c5vrx_live_pipeline.c): `legacy/c5vrx1/main/c5vrx_live_pipeline.c`
- [C5VRX-3 gain controller](https://github.com/twotoz/c5vrx/blob/main/legacy/c5vrx3/main/arc_v3_controller.c): `legacy/c5vrx3/main/arc_v3_controller.c`
- [C5VRX-4 pipeline](https://github.com/twotoz/c5vrx/blob/main/legacy/c5vrx4/pipeline.c): `legacy/c5vrx4/pipeline.c`

### Other components

- **Operator**
- **Browser user**

## Connections

- Operator → RF reception: supplies video signal
- RF reception → Demodulation transport: feeds received signal
- Demodulation transport → CVBS output: produces composite video
- Boot orchestration → RF reception: starts RF (evidence: `main/main.c`)
- Boot orchestration → Calibration: starts calibration (evidence: `main/main.c`)
- Boot orchestration → Receive profiles: loads and selects (evidence: `main/main.c`)
- Boot orchestration → Demodulation transport: starts transport (evidence: `main/main.c`)
- Boot orchestration → Receiver control: starts receiver (evidence: `main/main.c`)
- Boot orchestration → Flight logging: starts logging (evidence: `main/main.c`)
- Browser user → Web controls: uses controls
- Web controls → Serial flashing: invokes flashing (evidence: `web/app.js`)
- Web controls → Serial terminal: uses terminal (evidence: `web/app.js`)
- Web controls → Receiver console UI: uses receiver UI (evidence: `web/app.js`)
- Web controls → Flight-log decoding: decodes logs (evidence: `web/app.js`)
- Boot orchestration → C5VRX-1 live pipeline: legacy generation
- Boot orchestration → C5VRX-3 gain controller: legacy generation
- Boot orchestration → C5VRX-4 pipeline: legacy generation
