# yangosoft/dpf architecture

> Architecture diagram of the GitHub repository yangosoft/dpf, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yangosoft/dpf
- Repository: https://github.com/yangosoft/dpf

## Overview

##### Main Components
- ESP32 Firmware (located in src/dpf.cpp and src/dpf.hpp) – This is the central logic that reads diagnostic information, interacts with the peripherals, and manages the user interface.
- Hardware Peripherals:
- TFT Screen (ILI9341 based): The code drives the screen via defined GPIO connections (pins 15, 4, 23, 18, 2, etc. as per the README pinout table).
- ELM327 Bluetooth Module: Provides OBD interfacing to communicate diagnostic data.
- WiFi Access Point: Built-in functionality to allow configuration changes, such as modifying the Bluetooth device, PIN, etc.
- Schematics and Physical Design:
- PCB Design files (in schema/dpf1): Designed with Eagle, these represent the printed circuit board.
- Supporting Files:
- PlatformIO configuration (platformio.ini) defines the build, flashing, and debugging settings.
- CI/CD Workflows (.github/workflows/main.yml), documentation (doc folder), and additional hardware design files.

##### Relationships and Interactions
- The ESP32 microcontroller is the system’s core; it interfaces directly with all hardware components.
- The firmware running on the ESP32 handles:
- Data acquisition from the vehicle’s diagnostic signals (via ELM327 Bluetooth)
- Displaying information on the TFT screen.
- Providing a WiFi access point for configuration and possibly remote monitoring.
- The README’s external links and prototypes images indicate that the system was built iteratively, suggesting a direct mapping between the software drivers and hardware accessories.

##### Architectural Patterns and Design Principles
- Modular Hardware Integration: Separating functions such as display handling, Bluetooth interfacing, and network configuration in the firmware.
- Separation of Concerns: Distinct directories for firmware code (src), design schematics (schema), and documentation (doc).
- Use of PlatformIO indicates an embedded systems development workflow, which benefits from clear build and configuration management.

##### Final Recommendations
- Be as detailed as possible by now listing each individual component and its direct interactions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Embedded Firmware Layer
    subgraph "Embedded Firmware Layer"
        EFW["ESP32 Firmware (dpf.cpp, dpf.hpp)"]:::firmware
        TFT["TFT Display (ILI9341)"]:::peripheral
        BT["ELM327 Bluetooth"]:::peripheral
        WIFI["WiFi AP Configuration"]:::peripheral
        EFW -->|"controls"| TFT
        EFW -->|"controls"| BT
        EFW -->|"configures"| WIFI
    end

    %% Physical Hardware Layer
    subgraph "Physical Hardware Layer"
        PCB["PCB Design Files"]:::hardware
        BOX["3D Printed Enclosure"]:::hardware
        PCB ---|"integrated with"| BOX
    end

    %% Build & Deployment Environment
    subgraph "Build & Deployment"
        PIO["PlatformIO Build Config"]:::build
        CICD["CI/CD Pipeline"]:::build
        CICD -->|"triggers"| PIO
        PIO -->|"builds"| EFW
    end

    %% Integration of Firmware with Hardware
    EFW -->|"mounted on"| PCB
    EFW -->|"enclosed in"| BOX

    %% Click Events
    click EFW "https://github.com/yangosoft/dpf/blob/master/src/dpf.cpp"
    click TFT "https://github.com/yangosoft/dpf/blob/master/src/dpf.cpp"
    click BT "https://github.com/yangosoft/dpf/blob/master/src/dpf.cpp"
    click WIFI "https://github.com/yangosoft/dpf/blob/master/src/dpf.cpp"
    click PCB "https://github.com/yangosoft/dpf/tree/master/schema/dpf1"
    click BOX "https://github.com/yangosoft/dpf/tree/master/schema/3dmodel"
    click PIO "https://github.com/yangosoft/dpf/blob/master/platformio.ini"
    click CICD "https://github.com/yangosoft/dpf/blob/master/.github/workflows/main.yml"

    %% Styles
    classDef firmware fill:#80deea,stroke:#006064,stroke-width:2px;
    classDef peripheral fill:#c5e1a5,stroke:#558b2f,stroke-width:2px;
    classDef hardware fill:#fff59d,stroke:#f57f17,stroke-width:2px;
    classDef build fill:#f8bbd0,stroke:#ad1457,stroke-width:2px;
```
