# zxawry/esp_price_ticker architecture

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

- Interactive diagram: https://gitdiagram.com/zxawry/esp_price_ticker
- Repository: https://github.com/zxawry/esp_price_ticker

## Overview

esp_price_ticker is ESP32 firmware that periodically fetches currency-market prices and presents them on an SSD1306 display. On startup, the application initializes Wi-Fi, the display, and a circular market list; its HTTP task updates enabled markets while the display tasks show market status or a paginated settings menu. Buttons switch modes, navigate markets, toggle tracking, and pause rotation. The graph reflects the shown calls and README-documented fetch workflow; some task and HTTP wiring is omitted from the excerpts, so those links rely on the README.

Main entry points: [`main/app_main.c`](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_main.c) (App tasks), [`main/app_http.c`](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_http.c) (Trade fetcher), [`main/app_ctrl.c`](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_ctrl.c) (Market and menu views), [`main/app_disp.c`](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_disp.c) (SSD1306 driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Device runtime"]
  node_app["App tasks<br/>[app_main.c]"]
  node_buttons["Button events<br/>[app_main.c]"]
  node_contracts["Shared settings<br/>[app_comm.h]"]
end

subgraph group_markets["Market data"]
  node_market["Market list<br/>[app_ctrl.c]"]
  node_fetch["Trade fetcher<br/>[app_http.c]"]
end

subgraph group_display["Display interface"]
  node_views["Market and menu views<br/>[app_ctrl.c]"]
  node_driver["SSD1306 driver<br/>[app_disp.c]"]
  node_font["ASCII glyphs<br/>[app_font.c]"]
end

subgraph group_connectivity["Connectivity"]
  node_wifi["Wi-Fi station<br/>[app_wifi.c]"]
end

node_user(("Device user"))
node_api{{"Price API"}}
node_oled["SSD1306 display"]

node_user -->|"presses"| node_buttons
node_buttons -->|"queues events"| node_app
node_app -->|"initializes list"| node_market
node_app -->|"runs fetch task"| node_fetch
node_fetch -->|"requests trades"| node_api
node_fetch -->|"updates prices"| node_market
node_app -->|"initializes station"| node_wifi
node_app -->|"renders modes"| node_views
node_views -->|"reads market state"| node_market
node_views -->|"writes display"| node_driver
node_driver -->|"uses glyphs"| node_font
node_driver -->|"transmits over I2C"| node_oled
node_app -->|"uses configuration"| node_contracts
node_fetch -->|"uses market fields"| node_contracts

click node_app "https://github.com/zxawry/esp_price_ticker/blob/main/main/app_main.c"
click node_buttons "https://github.com/zxawry/esp_price_ticker/blob/main/main/app_main.c"
click node_contracts "https://github.com/zxawry/esp_price_ticker/blob/main/main/app_comm.h"
click node_market "https://github.com/zxawry/esp_price_ticker/blob/main/main/app_ctrl.c"
click node_fetch "https://github.com/zxawry/esp_price_ticker/blob/main/main/app_http.c"
click node_wifi "https://github.com/zxawry/esp_price_ticker/blob/main/main/app_wifi.c"
click node_views "https://github.com/zxawry/esp_price_ticker/blob/main/main/app_ctrl.c"
click node_driver "https://github.com/zxawry/esp_price_ticker/blob/main/main/app_disp.c"
click node_font "https://github.com/zxawry/esp_price_ticker/blob/main/main/app_font.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_app,node_buttons,node_contracts,node_user toneBlue
class node_market,node_fetch toneAmber
class node_views,node_driver,node_font,node_api toneMint
class node_wifi toneRose
class node_oled toneIndigo
```

## Components

### Device runtime

- [App tasks](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_main.c): `main/app_main.c`
- [Button events](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_main.c): `main/app_main.c`
- [Shared settings](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_comm.h): `main/app_comm.h`

### Market data

- [Market list](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_ctrl.c): `main/app_ctrl.c`
- [Trade fetcher](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_http.c): `main/app_http.c`

### Display interface

- [Market and menu views](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_ctrl.c): `main/app_ctrl.c`
- [SSD1306 driver](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_disp.c): `main/app_disp.c`
- [ASCII glyphs](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_font.c): `main/app_font.c`

### Connectivity

- [Wi-Fi station](https://github.com/zxawry/esp_price_ticker/blob/main/main/app_wifi.c): `main/app_wifi.c`

### Other components

- **Device user**
- **Price API**
- **SSD1306 display**

## Connections

- Device user → Button events: presses (evidence: `main/app_main.c`)
- Button events → App tasks: queues events (evidence: `main/app_main.c`)
- App tasks → Market list: initializes list (evidence: `main/app_main.c`)
- App tasks → Trade fetcher: runs fetch task (evidence: `README`)
- Trade fetcher → Price API: requests trades (evidence: `README`)
- Trade fetcher → Market list: updates prices (evidence: `main/app_http.c`)
- App tasks → Wi-Fi station: initializes station (evidence: `main/app_main.c`)
- App tasks → Market and menu views: renders modes (evidence: `main/app_main.c`)
- Market and menu views → Market list: reads market state (evidence: `main/app_ctrl.c`)
- Market and menu views → SSD1306 driver: writes display (evidence: `main/app_ctrl.c`)
- SSD1306 driver → ASCII glyphs: uses glyphs (evidence: `main/app_disp.c`)
- SSD1306 driver → SSD1306 display: transmits over I2C (evidence: `main/app_disp.c`)
- App tasks → Shared settings: uses configuration (evidence: `main/app_main.c`)
- Trade fetcher → Shared settings: uses market fields (evidence: `main/app_http.c`)
