# adamvojtus/scintillasimulation architecture

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

- Interactive diagram: https://gitdiagram.com/adamvojtus/scintillasimulation
- Repository: https://github.com/adamvojtus/scintillasimulation

## Overview

This is an ESP32 Arduino controller for a combustion/flight test rig. Its principal workflow samples pressure, thrust and battery telemetry, monitors start/stop and serial communication, and actuates valves and an igniter. The source also includes sensor/battery initialization checks and telemetry scaling. Evidence is limited to the two sampled source files; the tree and excerpts do not establish further subsystems or reliable call relationships between the duplicate Arduino entry points.

Main entry points: [`src/main.cpp`](https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp) (Flight control loop), [`src/control.cpp`](https://github.com/adamvojtus/scintillasimulation/blob/main/src/control.cpp) (Start/stop inputs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Control and safety"]
  node_start_stop["Start/stop inputs<br/>[control.cpp]"]
  node_flight_control["Flight control loop<br/>[main.cpp]"]
  node_valves_igniter["Valves and igniter<br/>[main.cpp]"]
  node_safety_abort["Abort and pressure checks<br/>[main.cpp]"]
end

subgraph group_sensing["Sensors and telemetry"]
  node_sensor_sampling["Telemetry sampling<br/>[main.cpp]"]
  node_sensor_init["Sensor initialization checks<br/>[main.cpp]"]
  node_telemetry["Telemetry data<br/>[main.cpp]"]
end

subgraph group_comms["Serial communication"]
  node_serial_setup["Serial setup<br/>[control.cpp]"]
  node_serial_handshake["Handshake checks<br/>[main.cpp]"]
  node_serial_runtime["Runtime serial monitor<br/>[main.cpp]"]
end

node_operator(("Operator"))
node_instrument_system(("Instruments system"))

node_operator -->|"presses controls"| node_start_stop
node_start_stop -->|"reads inputs"| node_flight_control
node_flight_control -->|"samples telemetry"| node_sensor_sampling
node_sensor_sampling -->|"updates readings"| node_telemetry
node_sensor_init -->|"requests readings"| node_sensor_sampling
node_flight_control -->|"actuates"| node_valves_igniter
node_flight_control -->|"checks limits"| node_safety_abort
node_safety_abort -->|"stops valves"| node_valves_igniter
node_serial_setup -->|"opens serial link"| node_instrument_system
node_serial_handshake -->|"checks response"| node_instrument_system
node_serial_runtime -->|"stops on loss"| node_valves_igniter
node_flight_control -->|"monitors serial"| node_serial_runtime

click node_start_stop "https://github.com/adamvojtus/scintillasimulation/blob/main/src/control.cpp"
click node_flight_control "https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp"
click node_valves_igniter "https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp"
click node_safety_abort "https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp"
click node_sensor_sampling "https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp"
click node_sensor_init "https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp"
click node_telemetry "https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp"
click node_serial_setup "https://github.com/adamvojtus/scintillasimulation/blob/main/src/control.cpp"
click node_serial_handshake "https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp"
click node_serial_runtime "https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.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_start_stop,node_flight_control,node_valves_igniter,node_safety_abort toneBlue
class node_sensor_sampling,node_sensor_init,node_telemetry toneAmber
class node_serial_setup,node_serial_handshake,node_serial_runtime toneMint
class node_operator,node_instrument_system toneIndigo
```

## Components

### Control and safety

- [Start/stop inputs](https://github.com/adamvojtus/scintillasimulation/blob/main/src/control.cpp): `src/control.cpp`
- [Flight control loop](https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp): `src/main.cpp`
- [Valves and igniter](https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp): `src/main.cpp`
- [Abort and pressure checks](https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp): `src/main.cpp`

### Sensors and telemetry

- [Telemetry sampling](https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp): `src/main.cpp`
- [Sensor initialization checks](https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp): `src/main.cpp`
- [Telemetry data](https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp): `src/main.cpp`

### Serial communication

- [Serial setup](https://github.com/adamvojtus/scintillasimulation/blob/main/src/control.cpp): `src/control.cpp`
- [Handshake checks](https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp): `src/main.cpp`
- [Runtime serial monitor](https://github.com/adamvojtus/scintillasimulation/blob/main/src/main.cpp): `src/main.cpp`

### Other components

- **Operator**
- **Instruments system**

## Connections

- Operator → Start/stop inputs: presses controls (evidence: `src/control.cpp`)
- Start/stop inputs → Flight control loop: reads inputs (evidence: `src/main.cpp`)
- Flight control loop → Telemetry sampling: samples telemetry (evidence: `src/main.cpp`)
- Telemetry sampling → Telemetry data: updates readings (evidence: `src/main.cpp`)
- Sensor initialization checks → Telemetry sampling: requests readings (evidence: `src/main.cpp`)
- Flight control loop → Valves and igniter: actuates (evidence: `src/main.cpp`)
- Flight control loop → Abort and pressure checks: checks limits (evidence: `src/main.cpp`)
- Abort and pressure checks → Valves and igniter: stops valves (evidence: `src/main.cpp`)
- Serial setup → Instruments system: opens serial link (evidence: `src/control.cpp`)
- Handshake checks → Instruments system: checks response (evidence: `src/main.cpp`)
- Runtime serial monitor → Valves and igniter: stops on loss (evidence: `src/main.cpp`)
- Flight control loop → Runtime serial monitor: monitors serial (evidence: `src/main.cpp`)
