# maxritter/diy-thermocam architecture

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

- Interactive diagram: https://gitdiagram.com/maxritter/diy-thermocam
- Repository: https://github.com/maxritter/diy-thermocam

## Overview

DIY-Thermocam V3 is an open-source FLIR Lepton thermal imager, with firmware for device operation and a separate desktop live viewer. The firmware startup initializes hardware and proceeds through setup and settings into live mode; the tree also identifies thermal capture, display, file, and menu capabilities. USB file transfer is implemented as a distinct MTP mode. Wiring beyond the sampled startup and mass-storage code is shown only where supported; the remaining feature nodes reflect named modules, not inspected call paths.

Main entry points: [`firmware/3.0/src/gui/livemode.cpp`](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/gui/livemode.cpp) (Live mode), [`firmware/3.0/src/main.cpp`](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/main.cpp) (Firmware setup), [`firmware/3.0/src/thermal/thermal.cpp`](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/thermal/thermal.cpp) (Thermal processing), [`firmware/3.0/src/thermal/create.cpp`](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/thermal/create.cpp) (Create captures)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Device startup"]
  node_main["Firmware setup<br/>[main.cpp]"]
  node_hardware["Hardware initialization<br/>[hardware.cpp]"]
  node_firststart["First-start setup<br/>[firststart.cpp]"]
end

subgraph group_thermal["Thermal imaging"]
  node_live["Live mode<br/>[livemode.cpp]"]
  node_lepton["Lepton sensor<br/>[lepton.cpp]"]
  node_thermalcore["Thermal processing<br/>[thermal.cpp]"]
  node_temperature["Temperature<br/>[temperature.cpp]"]
  node_colors["Color schemes<br/>[colorschemes.cpp]"]
  node_capture["Create captures<br/>[create.cpp]"]
end

subgraph group_interface["Device interface"]
  node_gui["GUI framework<br/>[gui.cpp]"]
  node_menus["Menus and settings<br/>[mainmenu.cpp]"]
  node_display["Display<br/>[display.cpp]"]
  node_touch["Touch input<br/>[touchscreen.cpp]"]
end

subgraph group_storage["Storage and transfer"]
  node_files["Capture save and load<br/>[save.cpp]"]
  node_sd[("SD card<br/>[sdcard.cpp]")]
  node_mtp["MTP file transfer<br/>[massstorage.cpp]"]
end

subgraph group_desktop["Desktop viewer"]
  node_viewerapp["Viewer launcher<br/>[main.py]"]
  node_viewer["Live image viewer<br/>[liveviewer.py]"]
  node_viewercolors["Viewer color maps<br/>[colorschemes.py]"]
end

node_user(("Device user"))
node_pc(("Connected computer"))

node_main -->|"initializes"| node_hardware
node_main -->|"runs if needed"| node_firststart
node_main -->|"enters"| node_live
node_user -->|"operates"| node_live
node_live -->|"reads sensor"| node_lepton
node_live -->|"processes frames"| node_thermalcore
node_thermalcore -->|"derives readings"| node_temperature
node_thermalcore -->|"colorizes image"| node_colors
node_live -->|"updates interface"| node_gui
node_gui -->|"renders"| node_display
node_user -->|"touches"| node_touch
node_touch -->|"provides input"| node_menus
node_menus -->|"initiates capture"| node_capture
node_capture -->|"saves capture"| node_files
node_files -->|"reads and writes"| node_sd
node_user -->|"requests transfer"| node_mtp
node_mtp -->|"serves files"| node_pc
node_user -->|"launches"| node_viewerapp
node_viewerapp -->|"starts viewer"| node_viewer
node_viewer -->|"uses color maps"| node_viewercolors

click node_main "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/main.cpp"
click node_hardware "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/hardware/hardware.cpp"
click node_firststart "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/gui/firststart.cpp"
click node_live "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/gui/livemode.cpp"
click node_lepton "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/hardware/lepton.cpp"
click node_thermalcore "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/thermal/thermal.cpp"
click node_temperature "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/thermal/temperature.cpp"
click node_colors "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/general/colorschemes.cpp"
click node_capture "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/thermal/create.cpp"
click node_gui "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/gui/gui.cpp"
click node_menus "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/gui/mainmenu.cpp"
click node_display "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/hardware/display/display.cpp"
click node_touch "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/hardware/touchscreen/touchscreen.cpp"
click node_files "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/thermal/save.cpp"
click node_sd "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/hardware/sdcard.cpp"
click node_mtp "https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/hardware/massstorage.cpp"
click node_viewerapp "https://github.com/maxritter/diy-thermocam/blob/master/software/thermal_live_viewer/3.0/main.py"
click node_viewer "https://github.com/maxritter/diy-thermocam/blob/master/software/thermal_live_viewer/3.0/src/liveviewer.py"
click node_viewercolors "https://github.com/maxritter/diy-thermocam/blob/master/software/thermal_live_viewer/3.0/src/colorschemes.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_hardware,node_firststart,node_user toneBlue
class node_live,node_lepton,node_thermalcore,node_temperature,node_colors,node_capture toneAmber
class node_gui,node_menus,node_display,node_touch toneMint
class node_files,node_sd,node_mtp toneRose
class node_viewerapp,node_viewer,node_viewercolors,node_pc toneIndigo
```

## Components

### Device startup

- [Firmware setup](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/main.cpp): `firmware/3.0/src/main.cpp`
- [Hardware initialization](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/hardware/hardware.cpp): `firmware/3.0/src/hardware/hardware.cpp`
- [First-start setup](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/gui/firststart.cpp): `firmware/3.0/src/gui/firststart.cpp`

### Thermal imaging

- [Live mode](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/gui/livemode.cpp): `firmware/3.0/src/gui/livemode.cpp`
- [Lepton sensor](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/hardware/lepton.cpp): `firmware/3.0/src/hardware/lepton.cpp`
- [Thermal processing](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/thermal/thermal.cpp): `firmware/3.0/src/thermal/thermal.cpp`
- [Temperature](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/thermal/temperature.cpp): `firmware/3.0/src/thermal/temperature.cpp`
- [Color schemes](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/general/colorschemes.cpp): `firmware/3.0/src/general/colorschemes.cpp`
- [Create captures](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/thermal/create.cpp): `firmware/3.0/src/thermal/create.cpp`

### Device interface

- [GUI framework](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/gui/gui.cpp): `firmware/3.0/src/gui/gui.cpp`
- [Menus and settings](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/gui/mainmenu.cpp): `firmware/3.0/src/gui/mainmenu.cpp`
- [Display](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/hardware/display/display.cpp): `firmware/3.0/src/hardware/display/display.cpp`
- [Touch input](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/hardware/touchscreen/touchscreen.cpp): `firmware/3.0/src/hardware/touchscreen/touchscreen.cpp`

### Storage and transfer

- [Capture save and load](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/thermal/save.cpp): `firmware/3.0/src/thermal/save.cpp`
- [SD card](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/hardware/sdcard.cpp): `firmware/3.0/src/hardware/sdcard.cpp`
- [MTP file transfer](https://github.com/maxritter/diy-thermocam/blob/master/firmware/3.0/src/hardware/massstorage.cpp): `firmware/3.0/src/hardware/massstorage.cpp`

### Desktop viewer

- [Viewer launcher](https://github.com/maxritter/diy-thermocam/blob/master/software/thermal_live_viewer/3.0/main.py): `software/thermal_live_viewer/3.0/main.py`
- [Live image viewer](https://github.com/maxritter/diy-thermocam/blob/master/software/thermal_live_viewer/3.0/src/liveviewer.py): `software/thermal_live_viewer/3.0/src/liveviewer.py`
- [Viewer color maps](https://github.com/maxritter/diy-thermocam/blob/master/software/thermal_live_viewer/3.0/src/colorschemes.py): `software/thermal_live_viewer/3.0/src/colorschemes.py`

### Other components

- **Device user**
- **Connected computer**

## Connections

- Firmware setup → Hardware initialization: initializes
- Firmware setup → First-start setup: runs if needed
- Firmware setup → Live mode: enters
- Device user → Live mode: operates
- Live mode → Lepton sensor: reads sensor
- Live mode → Thermal processing: processes frames
- Thermal processing → Temperature: derives readings
- Thermal processing → Color schemes: colorizes image
- Live mode → GUI framework: updates interface
- GUI framework → Display: renders
- Device user → Touch input: touches
- Touch input → Menus and settings: provides input
- Menus and settings → Create captures: initiates capture
- Create captures → Capture save and load: saves capture
- Capture save and load → SD card: reads and writes
- Device user → MTP file transfer: requests transfer
- MTP file transfer → Connected computer: serves files
- Device user → Viewer launcher: launches
- Viewer launcher → Live image viewer: starts viewer
- Live image viewer → Viewer color maps: uses color maps
