# willyancesar/redline-gauge architecture

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

- Interactive diagram: https://gitdiagram.com/willyancesar/redline-gauge
- Repository: https://github.com/willyancesar/redline-gauge

## Overview

REDLINE is ESP32 firmware for a motorsport digital dash. The principal workflow selects a data source, publishes vehicle readings, derives display state, and renders the themed gauge; users can configure the dash and time acceleration runs. The graph also preserves the documented simulator, OBD, sensor-input, settings, splash, and timer capabilities. Some source implementations were not sampled, so uncertain source-to-bus and timer-display links are dashed.

Main entry points: [`src/main.cpp`](https://github.com/willyancesar/redline-gauge/blob/main/src/main.cpp) (Firmware runtime), [`src/data/gauge_bus.h`](https://github.com/willyancesar/redline-gauge/blob/main/src/data/gauge_bus.h) (Gauge data bus), [`src/ui/gauge_ui.cpp`](https://github.com/willyancesar/redline-gauge/blob/main/src/ui/gauge_ui.cpp) (Gauge renderer), [`src/data/custom_source.cpp`](https://github.com/willyancesar/redline-gauge/blob/main/src/data/custom_source.cpp) (Custom sensors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime orchestration"]
  node_main["Firmware runtime<br/>[main.cpp]"]
  node_config["Dash configuration<br/>[config.h]"]
  node_bus["Gauge data bus<br/>[gauge_bus.h]"]
end

subgraph group_sources["Vehicle data sources"]
  node_sim["Physics simulator<br/>[sim_source.cpp]"]
  node_obd["OBD Bluetooth<br/>[obd_source.cpp]"]
  node_serial["Serial input<br/>[serial_source.cpp]"]
  node_custom["Custom sensors<br/>[custom_source.cpp]"]
  node_honda["Honda K-line<br/>[honda_source.cpp]"]
  node_sensor_api["Sensor interface<br/>[gauge_input.h]"]
end

subgraph group_display["Dash display"]
  node_model["Gauge model<br/>[gauge_model.cpp]"]
  node_gauge_ui["Gauge renderer<br/>[gauge_ui.cpp]"]
  node_canvas["Screen canvas<br/>[canvas.cpp]"]
  node_theme["Color themes<br/>[theme.cpp]"]
  node_splash["Boot splash<br/>[splash_ui.cpp]"]
end

subgraph group_interaction["Settings and controls"]
  node_settings["Settings screen<br/>[settings_ui.cpp]"]
  node_preferences["Saved settings<br/>[settings.h]"]
  node_touch_cal["Touch calibration<br/>[touch_cal_ui.cpp]"]
end

subgraph group_timing["Performance timer"]
  node_timer["Drag timer<br/>[drag_timer.cpp]"]
  node_timer_ui["Timer display<br/>[timer_ui.cpp]"]
end

node_driver(("Driver"))

node_driver -->|"uses dash"| node_main
node_main -->|"selects and polls"| node_sim
node_main -->|"selects and polls"| node_obd
node_main -->|"selects and polls"| node_serial
node_main -->|"selects and polls"| node_custom
node_main -->|"selects and polls"| node_honda
node_sim -.->|"publishes readings"| node_bus
node_obd -.->|"publishes readings"| node_bus
node_serial -.->|"publishes readings"| node_bus
node_custom -.->|"publishes readings"| node_bus
node_honda -.->|"publishes readings"| node_bus
node_sensor_api -->|"feeds sensors"| node_custom
node_bus -.->|"supplies snapshots"| node_model
node_model -->|"provides view"| node_gauge_ui
node_gauge_ui -->|"draws regions"| node_canvas
node_gauge_ui -->|"uses theme"| node_theme
node_main -->|"shows at boot"| node_splash
node_driver -->|"configures dash"| node_settings
node_main -->|"routes settings"| node_settings
node_settings -->|"saves choices"| node_preferences
node_driver -->|"calibrates touch"| node_touch_cal
node_main -->|"opens calibration"| node_touch_cal
node_main -->|"updates runs"| node_timer
node_timer -.->|"supplies timer state"| node_timer_ui
node_driver -->|"views run results"| node_timer_ui

click node_main "https://github.com/willyancesar/redline-gauge/blob/main/src/main.cpp"
click node_config "https://github.com/willyancesar/redline-gauge/blob/main/src/config.h"
click node_bus "https://github.com/willyancesar/redline-gauge/blob/main/src/data/gauge_bus.h"
click node_sim "https://github.com/willyancesar/redline-gauge/blob/main/src/data/sim_source.cpp"
click node_obd "https://github.com/willyancesar/redline-gauge/blob/main/src/data/obd_source.cpp"
click node_serial "https://github.com/willyancesar/redline-gauge/blob/main/src/data/serial_source.cpp"
click node_custom "https://github.com/willyancesar/redline-gauge/blob/main/src/data/custom_source.cpp"
click node_honda "https://github.com/willyancesar/redline-gauge/blob/main/src/data/honda_source.cpp"
click node_sensor_api "https://github.com/willyancesar/redline-gauge/blob/main/src/gauge_input.h"
click node_model "https://github.com/willyancesar/redline-gauge/blob/main/src/ui/gauge_model.cpp"
click node_gauge_ui "https://github.com/willyancesar/redline-gauge/blob/main/src/ui/gauge_ui.cpp"
click node_canvas "https://github.com/willyancesar/redline-gauge/blob/main/src/ui/canvas.cpp"
click node_theme "https://github.com/willyancesar/redline-gauge/blob/main/src/ui/theme.cpp"
click node_splash "https://github.com/willyancesar/redline-gauge/blob/main/src/ui/splash_ui.cpp"
click node_settings "https://github.com/willyancesar/redline-gauge/blob/main/src/ui/settings_ui.cpp"
click node_preferences "https://github.com/willyancesar/redline-gauge/blob/main/src/settings.h"
click node_touch_cal "https://github.com/willyancesar/redline-gauge/blob/main/src/ui/touch_cal_ui.cpp"
click node_timer "https://github.com/willyancesar/redline-gauge/blob/main/src/ui/drag_timer.cpp"
click node_timer_ui "https://github.com/willyancesar/redline-gauge/blob/main/src/ui/timer_ui.cpp"

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_bus toneBlue
class node_sim,node_obd,node_serial,node_custom,node_honda,node_sensor_api toneAmber
class node_model,node_gauge_ui,node_canvas,node_theme,node_splash toneMint
class node_settings,node_preferences,node_touch_cal toneRose
class node_timer,node_timer_ui,node_driver toneIndigo
```

## Components

### Runtime orchestration

- [Firmware runtime](https://github.com/willyancesar/redline-gauge/blob/main/src/main.cpp): `src/main.cpp`
- [Dash configuration](https://github.com/willyancesar/redline-gauge/blob/main/src/config.h): `src/config.h`
- [Gauge data bus](https://github.com/willyancesar/redline-gauge/blob/main/src/data/gauge_bus.h): `src/data/gauge_bus.h`

### Vehicle data sources

- [Physics simulator](https://github.com/willyancesar/redline-gauge/blob/main/src/data/sim_source.cpp): `src/data/sim_source.cpp`
- [OBD Bluetooth](https://github.com/willyancesar/redline-gauge/blob/main/src/data/obd_source.cpp): `src/data/obd_source.cpp`
- [Serial input](https://github.com/willyancesar/redline-gauge/blob/main/src/data/serial_source.cpp): `src/data/serial_source.cpp`
- [Custom sensors](https://github.com/willyancesar/redline-gauge/blob/main/src/data/custom_source.cpp): `src/data/custom_source.cpp`
- [Honda K-line](https://github.com/willyancesar/redline-gauge/blob/main/src/data/honda_source.cpp): `src/data/honda_source.cpp`
- [Sensor interface](https://github.com/willyancesar/redline-gauge/blob/main/src/gauge_input.h): `src/gauge_input.h`

### Dash display

- [Gauge model](https://github.com/willyancesar/redline-gauge/blob/main/src/ui/gauge_model.cpp): `src/ui/gauge_model.cpp`
- [Gauge renderer](https://github.com/willyancesar/redline-gauge/blob/main/src/ui/gauge_ui.cpp): `src/ui/gauge_ui.cpp`
- [Screen canvas](https://github.com/willyancesar/redline-gauge/blob/main/src/ui/canvas.cpp): `src/ui/canvas.cpp`
- [Color themes](https://github.com/willyancesar/redline-gauge/blob/main/src/ui/theme.cpp): `src/ui/theme.cpp`
- [Boot splash](https://github.com/willyancesar/redline-gauge/blob/main/src/ui/splash_ui.cpp): `src/ui/splash_ui.cpp`

### Settings and controls

- [Settings screen](https://github.com/willyancesar/redline-gauge/blob/main/src/ui/settings_ui.cpp): `src/ui/settings_ui.cpp`
- [Saved settings](https://github.com/willyancesar/redline-gauge/blob/main/src/settings.h): `src/settings.h`
- [Touch calibration](https://github.com/willyancesar/redline-gauge/blob/main/src/ui/touch_cal_ui.cpp): `src/ui/touch_cal_ui.cpp`

### Performance timer

- [Drag timer](https://github.com/willyancesar/redline-gauge/blob/main/src/ui/drag_timer.cpp): `src/ui/drag_timer.cpp`
- [Timer display](https://github.com/willyancesar/redline-gauge/blob/main/src/ui/timer_ui.cpp): `src/ui/timer_ui.cpp`

### Other components

- **Driver**

## Connections

- Driver → Firmware runtime: uses dash (evidence: `README.md`)
- Firmware runtime → Physics simulator: selects and polls (evidence: `src/main.cpp`)
- Firmware runtime → OBD Bluetooth: selects and polls (evidence: `src/main.cpp`)
- Firmware runtime → Serial input: selects and polls (evidence: `src/main.cpp`)
- Firmware runtime → Custom sensors: selects and polls (evidence: `src/main.cpp`)
- Firmware runtime → Honda K-line: selects and polls (evidence: `src/main.cpp`)
- Physics simulator → Gauge data bus: publishes readings (evidence: `src/data/sim_source.cpp`)
- OBD Bluetooth → Gauge data bus: publishes readings (evidence: `src/data/obd_source.cpp`)
- Serial input → Gauge data bus: publishes readings
- Custom sensors → Gauge data bus: publishes readings
- Honda K-line → Gauge data bus: publishes readings (evidence: `src/data/honda_source.cpp`)
- Sensor interface → Custom sensors: feeds sensors
- Gauge data bus → Gauge model: supplies snapshots
- Gauge model → Gauge renderer: provides view
- Gauge renderer → Screen canvas: draws regions (evidence: `src/ui/gauge_ui.cpp`)
- Gauge renderer → Color themes: uses theme (evidence: `src/ui/gauge_ui.cpp`)
- Firmware runtime → Boot splash: shows at boot
- Driver → Settings screen: configures dash (evidence: `README.md`)
- Firmware runtime → Settings screen: routes settings (evidence: `src/main.cpp`)
- Settings screen → Saved settings: saves choices (evidence: `README.md`)
- Driver → Touch calibration: calibrates touch (evidence: `README.md`)
- Firmware runtime → Touch calibration: opens calibration (evidence: `src/main.cpp`)
- Firmware runtime → Drag timer: updates runs (evidence: `src/main.cpp`)
- Drag timer → Timer display: supplies timer state
- Driver → Timer display: views run results (evidence: `README.md`)
