# olliw42/mlrs architecture

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

- Interactive diagram: https://gitdiagram.com/olliw42/mlrs
- Repository: https://github.com/olliw42/mlrs

## Overview

mLRS is embedded firmware for a bidirectional LoRa radio link combining remote-control channels with serial data, including MAVLink/MSP-focused capabilities. A typical workflow carries radio input through transmitter firmware, over the RF link, and through receiver firmware to an autopilot or serial device; data also travels in the reverse direction. The README documents protocol, configuration, diversity, and GCS options. Sampled board entry points call `main_main()`, but the shared runtime implementations were not sampled, so internal flow beyond those calls is kept conservative.

Main entry points: [`mLRS/CommonTx`](https://github.com/olliw42/mlrs/tree/main/mLRS/CommonTx) (TX runtime), [`mLRS/Common`](https://github.com/olliw42/mlrs/tree/main/mLRS/Common) (LoRa RF link), [`mLRS/tx-R9M-f103c8/Core/Src/main.cpp`](https://github.com/olliw42/mlrs/blob/main/mLRS/tx-R9M-f103c8/Core/Src/main.cpp) (TX board entry), [`mLRS/rx-R9M-f103c8/Core/Src/main.cpp`](https://github.com/olliw42/mlrs/blob/main/mLRS/rx-R9M-f103c8/Core/Src/main.cpp) (RX board entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tx["Transmitter firmware"]
  node_tx_entry["TX board entry<br/>[main.cpp]"]
  node_tx_runtime["TX runtime"]
  node_tx_inputs["Input interfaces<br/>[in.h]"]
  node_tx_config["TX setup<br/>[setup_tx.h]"]
end

subgraph group_link["Radio link"]
  node_rf["LoRa RF link"]
  node_rf_drivers["Semtech drivers"]
  node_link_arq["ARQ and diversity<br/>[arq.h]"]
end

subgraph group_rx["Receiver firmware"]
  node_rx_entry["RX board entry<br/>[main.cpp]"]
  node_rx_runtime["RX runtime"]
  node_rx_outputs["Output interfaces<br/>[out.h]"]
end

subgraph group_features["Protocols and configuration"]
  node_mavlink["MAVLink support"]
  node_msp["MSP support<br/>[msp_interface_tx.h]"]
  node_crsf["CRSF support"]
  node_bridges["Wireless bridges<br/>[esp-wifi-bridge.h]"]
  node_receiver_setup["Remote parameters"]
  node_display_cli["CLI and display"]
end

node_radio_user(("Pilot radio"))
node_autopilot(("Autopilot / serial device"))
node_gcs(("Ground station"))

node_radio_user -->|"provides control"| node_tx_entry
node_tx_entry -->|"calls main_main"| node_tx_runtime
node_tx_runtime -.->|"accepts input"| node_tx_inputs
node_tx_runtime -->|"transmits link data"| node_rf
node_rf -->|"delivers RF"| node_rx_entry
node_rx_entry -->|"calls main_main"| node_rx_runtime
node_rx_runtime -.->|"routes output"| node_rx_outputs
node_rx_outputs -->|"provides serial data"| node_autopilot
node_rf -.->|"supports chip drivers"| node_rf_drivers
node_rf -->|"supports retransmission"| node_link_arq
node_tx_runtime -.->|"uses settings"| node_tx_config
node_tx_runtime -->|"supports MAVLink"| node_mavlink
node_tx_runtime -->|"supports MSP"| node_msp
node_tx_runtime -->|"supports CRSF"| node_crsf
node_tx_runtime -->|"supports wireless GCS"| node_bridges
node_tx_runtime -->|"offers configuration"| node_display_cli
node_tx_runtime -->|"sets receiver parameters"| node_receiver_setup
node_gcs -->|"connects wirelessly"| node_bridges

click node_tx_entry "https://github.com/olliw42/mlrs/blob/main/mLRS/tx-R9M-f103c8/Core/Src/main.cpp"
click node_tx_runtime "https://github.com/olliw42/mlrs/tree/main/mLRS/CommonTx"
click node_tx_inputs "https://github.com/olliw42/mlrs/blob/main/mLRS/CommonTx/in.h"
click node_tx_config "https://github.com/olliw42/mlrs/blob/main/mLRS/CommonTx/setup_tx.h"
click node_rf "https://github.com/olliw42/mlrs/tree/main/mLRS/Common"
click node_rf_drivers "https://github.com/olliw42/mlrs/tree/main/mLRS/Common/sx-drivers"
click node_link_arq "https://github.com/olliw42/mlrs/blob/main/mLRS/Common/arq.h"
click node_rx_entry "https://github.com/olliw42/mlrs/blob/main/mLRS/rx-R9M-f103c8/Core/Src/main.cpp"
click node_rx_runtime "https://github.com/olliw42/mlrs/tree/main/mLRS/CommonRx"
click node_rx_outputs "https://github.com/olliw42/mlrs/blob/main/mLRS/CommonRx/out.h"
click node_mavlink "https://github.com/olliw42/mlrs/blob/main/mLRS/CommonTx/mavlink_interface_tx.h"
click node_msp "https://github.com/olliw42/mlrs/blob/main/mLRS/CommonTx/msp_interface_tx.h"
click node_crsf "https://github.com/olliw42/mlrs/blob/main/mLRS/CommonTx/crsf_interface_tx.h"
click node_bridges "https://github.com/olliw42/mlrs/blob/main/mLRS/CommonTx/esp-wifi-bridge.h"
click node_receiver_setup "https://github.com/olliw42/mlrs/tree/main/mLRS/CommonRx"
click node_display_cli "https://github.com/olliw42/mlrs/tree/main/mLRS/CommonTx"

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_tx_entry,node_tx_runtime,node_tx_inputs,node_tx_config toneBlue
class node_rf,node_rf_drivers,node_link_arq toneAmber
class node_rx_entry,node_rx_runtime,node_rx_outputs toneMint
class node_mavlink,node_msp,node_crsf,node_bridges,node_receiver_setup,node_display_cli toneRose
class node_radio_user,node_autopilot,node_gcs toneIndigo
```

## Components

### Transmitter firmware

- [TX board entry](https://github.com/olliw42/mlrs/blob/main/mLRS/tx-R9M-f103c8/Core/Src/main.cpp): `mLRS/tx-R9M-f103c8/Core/Src/main.cpp`
- [TX runtime](https://github.com/olliw42/mlrs/tree/main/mLRS/CommonTx): `mLRS/CommonTx`
- [Input interfaces](https://github.com/olliw42/mlrs/blob/main/mLRS/CommonTx/in.h): `mLRS/CommonTx/in.h`
- [TX setup](https://github.com/olliw42/mlrs/blob/main/mLRS/CommonTx/setup_tx.h): `mLRS/CommonTx/setup_tx.h`

### Radio link

- [LoRa RF link](https://github.com/olliw42/mlrs/tree/main/mLRS/Common): `mLRS/Common`
- [Semtech drivers](https://github.com/olliw42/mlrs/tree/main/mLRS/Common/sx-drivers): `mLRS/Common/sx-drivers`
- [ARQ and diversity](https://github.com/olliw42/mlrs/blob/main/mLRS/Common/arq.h): `mLRS/Common/arq.h`

### Receiver firmware

- [RX board entry](https://github.com/olliw42/mlrs/blob/main/mLRS/rx-R9M-f103c8/Core/Src/main.cpp): `mLRS/rx-R9M-f103c8/Core/Src/main.cpp`
- [RX runtime](https://github.com/olliw42/mlrs/tree/main/mLRS/CommonRx): `mLRS/CommonRx`
- [Output interfaces](https://github.com/olliw42/mlrs/blob/main/mLRS/CommonRx/out.h): `mLRS/CommonRx/out.h`

### Protocols and configuration

- [MAVLink support](https://github.com/olliw42/mlrs/blob/main/mLRS/CommonTx/mavlink_interface_tx.h): `mLRS/CommonTx/mavlink_interface_tx.h`
- [MSP support](https://github.com/olliw42/mlrs/blob/main/mLRS/CommonTx/msp_interface_tx.h): `mLRS/CommonTx/msp_interface_tx.h`
- [CRSF support](https://github.com/olliw42/mlrs/blob/main/mLRS/CommonTx/crsf_interface_tx.h): `mLRS/CommonTx/crsf_interface_tx.h`
- [Wireless bridges](https://github.com/olliw42/mlrs/blob/main/mLRS/CommonTx/esp-wifi-bridge.h): `mLRS/CommonTx/esp-wifi-bridge.h`
- [Remote parameters](https://github.com/olliw42/mlrs/tree/main/mLRS/CommonRx): `mLRS/CommonRx`
- [CLI and display](https://github.com/olliw42/mlrs/tree/main/mLRS/CommonTx): `mLRS/CommonTx`

### Other components

- **Pilot radio**
- **Autopilot / serial device**
- **Ground station**

## Connections

- Pilot radio → TX board entry: provides control
- TX board entry → TX runtime: calls main_main (evidence: `mLRS/tx-R9M-f103c8/Core/Src/main.cpp`)
- TX runtime → Input interfaces: accepts input
- TX runtime → LoRa RF link: transmits link data
- LoRa RF link → RX board entry: delivers RF
- RX board entry → RX runtime: calls main_main
- RX runtime → Output interfaces: routes output
- Output interfaces → Autopilot / serial device: provides serial data
- LoRa RF link → Semtech drivers: supports chip drivers
- LoRa RF link → ARQ and diversity: supports retransmission
- TX runtime → TX setup: uses settings
- TX runtime → MAVLink support: supports MAVLink
- TX runtime → MSP support: supports MSP
- TX runtime → CRSF support: supports CRSF
- TX runtime → Wireless bridges: supports wireless GCS
- TX runtime → CLI and display: offers configuration
- TX runtime → Remote parameters: sets receiver parameters
- Ground station → Wireless bridges: connects wirelessly
