# laeq/onemetreplus architecture

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

- Interactive diagram: https://gitdiagram.com/laeq/onemetreplus
- Repository: https://github.com/laeq/onemetreplus

## Overview

One Metre Plus is Raspberry Pi bicycle-sensor software, operated through a serial touch-screen interface. The primary workflow configures capture, responds to touch-screen commands, records video/GPS/distance (and, in the alternate async entry point, audio), then offers conversion, export, and deletion. Core sensor, UI, and file-management implementations are shown; conversion/export and some supporting modules are indexed but not excerpted, so those documented-in-code connections are limited to relationships visible in main.py.

Main entry points: [`main.py`](https://github.com/laeq/onemetreplus/blob/master/main.py) (Capture controller), [`async/main_async.py`](https://github.com/laeq/onemetreplus/blob/master/async/main_async.py) (Async controller), [`utils/filemanager.py`](https://github.com/laeq/onemetreplus/blob/master/utils/filemanager.py) (Capture file manager), [`utils/screen.py`](https://github.com/laeq/onemetreplus/blob/master/utils/screen.py) (Touch-screen UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Control and configuration"]
  node_main["Capture controller<br/>[main.py]"]
  node_asyncmain["Async controller<br/>[main_async.py]"]
  node_config["Settings<br/>[config.py]"]
  node_screen["Touch-screen UI<br/>[screen.py]"]
end

subgraph group_sensing["Sensor capture"]
  node_camera["Camera capture<br/>[camera.py]"]
  node_gps["GPS capture<br/>[gps.py]"]
  node_lidar["Distance capture<br/>[lidar.py]"]
  node_microphone["Audio capture<br/>[microphone.py]"]
  node_switch["Switch capture<br/>[switch.py]"]
end

subgraph group_storage["Capture management"]
  node_files["Capture file manager<br/>[filemanager.py]"]
  node_capture_store[("Capture files")]
end

subgraph group_post["Post-capture"]
  node_converter["Video conversion<br/>[videoconverter.py]"]
  node_exporter["Data export<br/>[export.py]"]
  node_export_store[("Export files")]
end

node_rider(("Bicycle operator"))

node_rider -->|"sends commands"| node_screen
node_main -->|"reads and updates"| node_screen
node_main -->|"loads settings"| node_config
node_main -->|"creates capture paths"| node_files
node_main -->|"starts recording"| node_camera
node_main -->|"starts recording"| node_gps
node_main -->|"starts recording"| node_lidar
node_main -->|"starts recording"| node_switch
node_main -->|"converts videos"| node_converter
node_main -->|"exports captures"| node_exporter
node_main -->|"deletes captures"| node_files
node_files -->|"organizes paths"| node_capture_store
node_camera -.->|"writes video"| node_capture_store
node_gps -->|"writes GPS data"| node_capture_store
node_lidar -->|"writes distance data"| node_capture_store
node_lidar -->|"updates distance display"| node_screen
node_gps -->|"updates GPS indicator"| node_screen
node_asyncmain -->|"reads commands"| node_screen
node_asyncmain -->|"creates capture paths"| node_files
node_asyncmain -->|"starts recording"| node_camera
node_asyncmain -->|"starts recording"| node_microphone
node_asyncmain -->|"starts recording"| node_lidar
node_asyncmain -->|"starts recording"| node_gps
node_files -->|"lists export files"| node_export_store
node_converter -.->|"produces converted video"| node_export_store
node_exporter -.->|"writes exports"| node_export_store

click node_main "https://github.com/laeq/onemetreplus/blob/master/main.py"
click node_asyncmain "https://github.com/laeq/onemetreplus/blob/master/async/main_async.py"
click node_config "https://github.com/laeq/onemetreplus/blob/master/utils/config.py"
click node_screen "https://github.com/laeq/onemetreplus/blob/master/utils/screen.py"
click node_camera "https://github.com/laeq/onemetreplus/blob/master/utils/camera.py"
click node_gps "https://github.com/laeq/onemetreplus/blob/master/utils/gps.py"
click node_lidar "https://github.com/laeq/onemetreplus/blob/master/utils/lidar.py"
click node_microphone "https://github.com/laeq/onemetreplus/blob/master/utils/microphone.py"
click node_switch "https://github.com/laeq/onemetreplus/blob/master/utils/switch.py"
click node_files "https://github.com/laeq/onemetreplus/blob/master/utils/filemanager.py"
click node_converter "https://github.com/laeq/onemetreplus/blob/master/utils/videoconverter.py"
click node_exporter "https://github.com/laeq/onemetreplus/blob/master/utils/export.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_asyncmain,node_config,node_screen toneBlue
class node_camera,node_gps,node_lidar,node_microphone,node_switch toneAmber
class node_files,node_capture_store toneMint
class node_converter,node_exporter,node_export_store toneRose
class node_rider toneIndigo
```

## Components

### Control and configuration

- [Capture controller](https://github.com/laeq/onemetreplus/blob/master/main.py): `main.py`
- [Async controller](https://github.com/laeq/onemetreplus/blob/master/async/main_async.py): `async/main_async.py`
- [Settings](https://github.com/laeq/onemetreplus/blob/master/utils/config.py): `utils/config.py`
- [Touch-screen UI](https://github.com/laeq/onemetreplus/blob/master/utils/screen.py): `utils/screen.py`

### Sensor capture

- [Camera capture](https://github.com/laeq/onemetreplus/blob/master/utils/camera.py): `utils/camera.py`
- [GPS capture](https://github.com/laeq/onemetreplus/blob/master/utils/gps.py): `utils/gps.py`
- [Distance capture](https://github.com/laeq/onemetreplus/blob/master/utils/lidar.py): `utils/lidar.py`
- [Audio capture](https://github.com/laeq/onemetreplus/blob/master/utils/microphone.py): `utils/microphone.py`
- [Switch capture](https://github.com/laeq/onemetreplus/blob/master/utils/switch.py): `utils/switch.py`

### Capture management

- [Capture file manager](https://github.com/laeq/onemetreplus/blob/master/utils/filemanager.py): `utils/filemanager.py`
- **Capture files**

### Post-capture

- [Video conversion](https://github.com/laeq/onemetreplus/blob/master/utils/videoconverter.py): `utils/videoconverter.py`
- [Data export](https://github.com/laeq/onemetreplus/blob/master/utils/export.py): `utils/export.py`
- **Export files**

### Other components

- **Bicycle operator**

## Connections

- Bicycle operator → Touch-screen UI: sends commands
- Capture controller → Touch-screen UI: reads and updates (evidence: `main.py`)
- Capture controller → Settings: loads settings (evidence: `main.py`)
- Capture controller → Capture file manager: creates capture paths (evidence: `main.py`)
- Capture controller → Camera capture: starts recording (evidence: `main.py`)
- Capture controller → GPS capture: starts recording (evidence: `main.py`)
- Capture controller → Distance capture: starts recording (evidence: `main.py`)
- Capture controller → Switch capture: starts recording (evidence: `main.py`)
- Capture controller → Video conversion: converts videos (evidence: `main.py`)
- Capture controller → Data export: exports captures (evidence: `main.py`)
- Capture controller → Capture file manager: deletes captures (evidence: `main.py`)
- Capture file manager → Capture files: organizes paths (evidence: `utils/filemanager.py`)
- Camera capture → Capture files: writes video
- GPS capture → Capture files: writes GPS data (evidence: `utils/gps.py`)
- Distance capture → Capture files: writes distance data (evidence: `utils/lidar.py`)
- Distance capture → Touch-screen UI: updates distance display (evidence: `utils/lidar.py`)
- GPS capture → Touch-screen UI: updates GPS indicator (evidence: `utils/gps.py`)
- Async controller → Touch-screen UI: reads commands (evidence: `async/main_async.py`)
- Async controller → Capture file manager: creates capture paths (evidence: `async/main_async.py`)
- Async controller → Camera capture: starts recording (evidence: `async/main_async.py`)
- Async controller → Audio capture: starts recording (evidence: `async/main_async.py`)
- Async controller → Distance capture: starts recording (evidence: `async/main_async.py`)
- Async controller → GPS capture: starts recording (evidence: `async/main_async.py`)
- Capture file manager → Export files: lists export files (evidence: `utils/filemanager.py`)
- Video conversion → Export files: produces converted video
- Data export → Export files: writes exports
