# dandwhelan/esp32-spectra-e6-13inch architecture

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

- Interactive diagram: https://gitdiagram.com/dandwhelan/esp32-spectra-e6-13inch
- Repository: https://github.com/dandwhelan/esp32-spectra-e6-13inch

## Overview

This ESP32-S3 firmware turns uploaded or remotely sourced images into six-colour e-ink output, then manages configuration, cycling, quiet hours, and deep sleep. The main workflow is boot/config restore, optional Wi-Fi and time checks, image selection and processing, display refresh, portal servicing, and sleep. README-described decoding, dithering, scaling, and .spectra6 support are represented within the image renderer. Edges rely on the sampled main excerpt, source-index references, or README; unsampled implementation details are left unconnected where evidence is insufficient.

Main entry points: [`src/main.cpp`](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/main.cpp) (Boot Orchestrator), [`src/ConfigurationServer.cpp`](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ConfigurationServer.cpp) (Configuration Server), [`src/ImageScreen.cpp`](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ImageScreen.cpp) (Image Renderer), [`src/HttpDownloader.cpp`](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/HttpDownloader.cpp) (HTTP Downloader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Boot and Power"]
  node_main["Boot Orchestrator<br/>[main.cpp]"]
  node_wifi["Wi-Fi Connection<br/>[WiFiConnection.cpp]"]
  node_battery["Battery Status<br/>[battery.cpp]"]
end

subgraph group_portal["Configuration Portal"]
  node_portal_screen["Portal Screen"]
  node_web_server["Configuration Server"]
  node_portal_ui["Portal Web UI<br/>[config.html]"]
end

subgraph group_images["Image Sources and Processing"]
  node_image_screen["Image Renderer<br/>[ImageScreen.cpp]"]
  node_folder_source["Folder Image Source"]
  node_downloader["HTTP Downloader<br/>[HttpDownloader.cpp]"]
end

subgraph group_display["Display Hardware"]
  node_display_adapter["Display Adapter<br/>[DisplayAdapter.cpp]"]
  node_epd_driver["GDEP133C02 Driver<br/>[GDEP133C02.c]"]
  node_spi_gpio["SPI and GPIO<br/>[comm.c]"]
end

subgraph group_storage["Persistent State"]
  node_config["Application Settings"]
  node_config_storage[("NVS Settings")]
  node_sd["SD Image Import<br/>[SDCardManager.cpp]"]
  node_local_images[("LittleFS Images<br/>[ImageScreen.cpp]")]
end

node_user(("Device User"))
node_remote_images(("HTTP Image Host"))
node_panel{{"Spectra 6 Panel"}}

node_user -.->|"configures device"| node_web_server
node_main -->|"loads and saves"| node_config_storage
node_main -->|"connects"| node_wifi
node_main -->|"imports image"| node_sd
node_main -->|"renders screen"| node_image_screen
node_main -->|"runs portal"| node_web_server
node_main -->|"checks status"| node_battery
node_main -->|"uses settings"| node_config
node_main -.->|"initializes display"| node_display_adapter
node_main -->|"sleeps and wakes"| node_main
node_web_server -->|"persists settings"| node_config_storage
node_web_server -.->|"serves interface"| node_portal_ui
node_web_server -.->|"accepts uploads"| node_user
node_web_server -->|"requests refresh"| node_image_screen
node_portal_screen -->|"uses server"| node_web_server
node_image_screen -->|"fetches folder images"| node_folder_source
node_image_screen -->|"downloads image"| node_downloader
node_folder_source -->|"downloads listing and image"| node_downloader
node_downloader -.->|"requests content"| node_remote_images
node_image_screen -.->|"reads and stores"| node_local_images
node_image_screen -->|"draws framebuffer"| node_display_adapter
node_display_adapter -->|"sends frame"| node_epd_driver
node_epd_driver -->|"uses bus controls"| node_spi_gpio
node_spi_gpio -->|"drives QSPI"| node_panel

click node_main "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/main.cpp"
click node_wifi "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/WiFiConnection.cpp"
click node_battery "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/battery.cpp"
click node_config "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ApplicationConfig.h"
click node_config_storage "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ApplicationConfigStorage.cpp"
click node_sd "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/SDCardManager.cpp"
click node_portal_screen "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ConfigurationScreen.cpp"
click node_web_server "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ConfigurationServer.cpp"
click node_portal_ui "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/data/config.html"
click node_image_screen "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ImageScreen.cpp"
click node_folder_source "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/FolderImageSource.cpp"
click node_downloader "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/HttpDownloader.cpp"
click node_local_images "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ImageScreen.cpp"
click node_display_adapter "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/DisplayAdapter.cpp"
click node_epd_driver "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/GDEP133C02.c"
click node_spi_gpio "https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/comm.c"

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_wifi,node_battery,node_user toneBlue
class node_portal_screen,node_web_server,node_portal_ui toneAmber
class node_image_screen,node_folder_source,node_downloader toneMint
class node_display_adapter,node_epd_driver,node_spi_gpio toneRose
class node_config,node_config_storage,node_sd,node_local_images,node_remote_images,node_panel toneIndigo
```

## Components

### Boot and Power

- [Boot Orchestrator](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/main.cpp): `src/main.cpp`
- [Wi-Fi Connection](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/WiFiConnection.cpp): `src/WiFiConnection.cpp`
- [Battery Status](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/battery.cpp): `src/battery.cpp`

### Configuration Portal

- [Portal Screen](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ConfigurationScreen.cpp): `src/ConfigurationScreen.cpp`
- [Configuration Server](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ConfigurationServer.cpp): `src/ConfigurationServer.cpp`
- [Portal Web UI](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/data/config.html): `data/config.html`

### Image Sources and Processing

- [Image Renderer](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ImageScreen.cpp): `src/ImageScreen.cpp`
- [Folder Image Source](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/FolderImageSource.cpp): `src/FolderImageSource.cpp`
- [HTTP Downloader](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/HttpDownloader.cpp): `src/HttpDownloader.cpp`

### Display Hardware

- [Display Adapter](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/DisplayAdapter.cpp): `src/DisplayAdapter.cpp`
- [GDEP133C02 Driver](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/GDEP133C02.c): `src/GDEP133C02.c`
- [SPI and GPIO](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/comm.c): `src/comm.c`

### Persistent State

- [Application Settings](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ApplicationConfig.h): `src/ApplicationConfig.h`
- [NVS Settings](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ApplicationConfigStorage.cpp): `src/ApplicationConfigStorage.cpp`
- [SD Image Import](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/SDCardManager.cpp): `src/SDCardManager.cpp`
- [LittleFS Images](https://github.com/dandwhelan/esp32-spectra-e6-13inch/blob/main/src/ImageScreen.cpp): `src/ImageScreen.cpp`

### Other components

- **Device User**
- **HTTP Image Host**
- **Spectra 6 Panel**

## Connections

- Device User → Configuration Server: configures device (evidence: `README.md`)
- Boot Orchestrator → NVS Settings: loads and saves (evidence: `src/main.cpp`)
- Boot Orchestrator → Wi-Fi Connection: connects (evidence: `src/main.cpp`)
- Boot Orchestrator → SD Image Import: imports image (evidence: `README.md`)
- Boot Orchestrator → Image Renderer: renders screen (evidence: `src/main.cpp`)
- Boot Orchestrator → Configuration Server: runs portal (evidence: `src/main.cpp`)
- Boot Orchestrator → Battery Status: checks status (evidence: `src/main.cpp`)
- Boot Orchestrator → Application Settings: uses settings (evidence: `src/main.cpp`)
- Boot Orchestrator → Display Adapter: initializes display
- Boot Orchestrator → Boot Orchestrator: sleeps and wakes (evidence: `README.md`)
- Configuration Server → NVS Settings: persists settings
- Configuration Server → Portal Web UI: serves interface (evidence: `README.md`)
- Configuration Server → Device User: accepts uploads (evidence: `README.md`)
- Configuration Server → Image Renderer: requests refresh
- Portal Screen → Configuration Server: uses server (evidence: `src/ConfigurationScreen.cpp`)
- Image Renderer → Folder Image Source: fetches folder images (evidence: `src/ImageScreen.cpp`)
- Image Renderer → HTTP Downloader: downloads image
- Folder Image Source → HTTP Downloader: downloads listing and image
- HTTP Downloader → HTTP Image Host: requests content (evidence: `README.md`)
- Image Renderer → LittleFS Images: reads and stores (evidence: `README.md`)
- Image Renderer → Display Adapter: draws framebuffer
- Display Adapter → GDEP133C02 Driver: sends frame
- GDEP133C02 Driver → SPI and GPIO: uses bus controls (evidence: `src/GDEP133C02.c`)
- SPI and GPIO → Spectra 6 Panel: drives QSPI (evidence: `README.md`)
