# gxyloj/jbd_bms_esp32_dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/gxyloj/jbd_bms_esp32_dashboard
- Repository: https://github.com/gxyloj/jbd_bms_esp32_dashboard

## Overview

This is an ESP32 JBD BMS vehicle dashboard. Its main workflow reads battery telemetry over BLE and speed/course from a GNSS module, then updates a TFT dashboard; an optional WiFi access point serves a browser dashboard and logs. The README documents satellite-signal details, cell voltages and a desktop UI simulator. Source excerpts are partial, so the graph shows documented capabilities but omits uncertain internal wiring beyond the visible main-loop and web-server behavior.

Main entry points: [`src/main.cpp`](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/main.cpp) (Firmware loop), [`src/web_server.cpp`](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/web_server.cpp) (AP HTTP service), [`src/gps_driver.cpp`](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/gps_driver.cpp) (GNSS driver), [`src/bms_ble.cpp`](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/bms_ble.cpp) (JBD BLE driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Runtime orchestration"]
  node_main["Firmware loop<br/>[main.cpp]"]
end

subgraph group_sensing["Telemetry acquisition"]
  node_bms["JBD BLE driver<br/>[bms_ble.cpp]"]
  node_bmsstate[("BMS snapshot<br/>[bms_ble.cpp]")]
  node_gps["GNSS driver<br/>[gps_driver.cpp]"]
  node_logs[("Ring log buffer<br/>[log_buffer.cpp]")]
end

subgraph group_presentation["Dashboard presentation"]
  node_ui["LVGL dashboard<br/>[ui.cpp]"]
  node_speedart["Speed images<br/>[speed_10.c]"]
  node_icons["Dashboard icons<br/>[bms_icons_20.c]"]
end

subgraph group_remote["Remote monitoring"]
  node_web["AP HTTP service<br/>[web_server.cpp]"]
end

node_rider(("Rider"))
node_jbd(("JBD BMS"))
node_gnss(("GNSS module"))
node_tft["TFT display"]
node_browser(("Browser dashboard"))

node_main -->|"initializes"| node_gps
node_main -->|"checks watchdog"| node_gps
node_main -->|"starts BLE"| node_bms
node_main -->|"builds dashboard"| node_ui
node_main -->|"updates speed/course"| node_ui
node_bms -->|"queries over BLE"| node_jbd
node_jbd -->|"notifies frames"| node_bms
node_bms -->|"updates snapshot"| node_bmsstate
node_bms -->|"writes events"| node_logs
node_gnss -->|"sends NMEA"| node_gps
node_gps -->|"records GPS data"| node_logs
node_gps -->|"provides speed/course"| node_main
node_ui -->|"selects speed image"| node_speedart
node_ui -->|"uses icons"| node_icons
node_ui -->|"renders dashboard"| node_tft
node_main -->|"starts AP service"| node_web
node_web -->|"reads telemetry"| node_bmsstate
node_web -->|"reads GPS data"| node_gps
node_web -->|"reads log snapshots"| node_logs
node_browser -->|"requests dashboard/API"| node_web
node_web -->|"serves HTML and JSON"| node_browser
node_rider -->|"views dashboard"| node_tft

click node_main "https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/main.cpp"
click node_bms "https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/bms_ble.cpp"
click node_bmsstate "https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/bms_ble.cpp"
click node_gps "https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/gps_driver.cpp"
click node_logs "https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/log_buffer.cpp"
click node_ui "https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/ui.cpp"
click node_speedart "https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/img/speed_10.c"
click node_icons "https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/icon/c/bms_icons_20.c"
click node_web "https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/web_server.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_browser toneBlue
class node_bms,node_bmsstate,node_gps,node_logs toneAmber
class node_ui,node_speedart,node_icons toneMint
class node_web toneRose
class node_rider,node_jbd,node_gnss,node_tft toneIndigo
```

## Components

### Runtime orchestration

- [Firmware loop](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/main.cpp): `src/main.cpp`

### Telemetry acquisition

- [JBD BLE driver](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/bms_ble.cpp): `src/bms_ble.cpp`
- [BMS snapshot](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/bms_ble.cpp): `src/bms_ble.cpp`
- [GNSS driver](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/gps_driver.cpp): `src/gps_driver.cpp`
- [Ring log buffer](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/log_buffer.cpp): `src/log_buffer.cpp`

### Dashboard presentation

- [LVGL dashboard](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/ui.cpp): `src/ui.cpp`
- [Speed images](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/img/speed_10.c): `src/img/speed_10.c`
- [Dashboard icons](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/icon/c/bms_icons_20.c): `src/icon/c/bms_icons_20.c`

### Remote monitoring

- [AP HTTP service](https://github.com/gxyloj/jbd_bms_esp32_dashboard/blob/main/src/web_server.cpp): `src/web_server.cpp`

### Other components

- **Rider**
- **JBD BMS**
- **GNSS module**
- **TFT display**
- **Browser dashboard**

## Connections

- Firmware loop → GNSS driver: initializes
- Firmware loop → GNSS driver: checks watchdog
- Firmware loop → JBD BLE driver: starts BLE
- Firmware loop → LVGL dashboard: builds dashboard
- Firmware loop → LVGL dashboard: updates speed/course
- JBD BLE driver → JBD BMS: queries over BLE
- JBD BMS → JBD BLE driver: notifies frames
- JBD BLE driver → BMS snapshot: updates snapshot
- JBD BLE driver → Ring log buffer: writes events
- GNSS module → GNSS driver: sends NMEA
- GNSS driver → Ring log buffer: records GPS data
- GNSS driver → Firmware loop: provides speed/course
- LVGL dashboard → Speed images: selects speed image
- LVGL dashboard → Dashboard icons: uses icons
- LVGL dashboard → TFT display: renders dashboard
- Firmware loop → AP HTTP service: starts AP service
- AP HTTP service → BMS snapshot: reads telemetry
- AP HTTP service → GNSS driver: reads GPS data
- AP HTTP service → Ring log buffer: reads log snapshots
- Browser dashboard → AP HTTP service: requests dashboard/API
- AP HTTP service → Browser dashboard: serves HTML and JSON
- Rider → TFT display: views dashboard
