# joonasheiskanen/elektroniikan_sovellusprojekti_huppi architecture

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

- Interactive diagram: https://gitdiagram.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi
- Repository: https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi

## Overview

This is an Arduino-based energy and indoor-environment display. The principal workflow is the firmware loop: initialize hardware and network/time services, refresh price, weather, and sensor data, then select a screen and update its presentation. Buttons switch display state; the UI composes readings and price summaries into LCD drawing calls. The graph preserves these distinct acquisition, control, and rendering stages. The README gives no capability detail, and several acquisition implementations were not excerpted, so external API and device relationships are not inferred.

Main entry points: [`huppiproject/src/main.cpp`](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/main.cpp) (Main loop), [`huppiproject/src/ui.cpp`](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/ui.cpp) (UI updates), [`huppiproject/src/lcd.cpp`](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/lcd.cpp) (LCD renderer), [`huppiproject/src/buttons.cpp`](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/buttons.cpp) (Button controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Firmware control"]
  node_main["Main loop<br/>[main.cpp]"]
  node_buttons["Button controls<br/>[buttons.cpp]"]
end

subgraph group_acquisition["Data acquisition"]
  node_network["Network status<br/>[network.cpp]"]
  node_time["Time utilities<br/>[timeutils.cpp]"]
  node_prices["Spot prices<br/>[spotprice.cpp]"]
  node_weather["Weather data<br/>[weather.cpp]"]
  node_dht["DHT readings<br/>[dht.cpp]"]
  node_scd["CO₂ readings<br/>[scd.cpp]"]
end

subgraph group_presentation["Screen presentation"]
  node_ui["UI updates<br/>[ui.cpp]"]
  node_lcd["LCD renderer<br/>[lcd.cpp]"]
end

subgraph group_assets["Display assets"]
  node_fontfiles["Font assets"]
end

node_display["TFT display"]

node_main -->|"checks buttons"| node_buttons
node_main -->|"updates network"| node_network
node_main -->|"initializes time"| node_time
node_main -->|"fetches prices"| node_prices
node_main -->|"updates weather"| node_weather
node_main -->|"updates readings"| node_dht
node_main -->|"updates readings"| node_scd
node_main -->|"requests updates"| node_ui
node_main -->|"reads time"| node_time
node_buttons -->|"sets brightness"| node_lcd
node_ui -->|"reads time"| node_time
node_ui -->|"reads prices"| node_prices
node_ui -->|"reads weather"| node_weather
node_ui -->|"checks status"| node_network
node_ui -->|"reads readings"| node_dht
node_ui -->|"reads readings"| node_scd
node_ui -->|"reads screen state"| node_buttons
node_ui -->|"draws screen"| node_lcd
node_lcd -->|"reads weather"| node_weather
node_lcd -->|"reads prices"| node_prices
node_lcd -->|"reads time"| node_time
node_lcd -->|"reads brightness"| node_buttons
node_lcd -->|"loads fonts"| node_fontfiles
node_lcd -->|"draws output"| node_display

click node_main "https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/main.cpp"
click node_buttons "https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/buttons.cpp"
click node_network "https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/network.cpp"
click node_time "https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/timeutils.cpp"
click node_prices "https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/spotprice.cpp"
click node_weather "https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/weather.cpp"
click node_dht "https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/dht.cpp"
click node_scd "https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/scd.cpp"
click node_ui "https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/ui.cpp"
click node_lcd "https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/lcd.cpp"
click node_fontfiles "https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/tree/main/huppiproject/data"

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_buttons toneBlue
class node_network,node_time,node_prices,node_weather,node_dht,node_scd toneAmber
class node_ui,node_lcd toneMint
class node_fontfiles toneRose
class node_display toneIndigo
```

## Components

### Firmware control

- [Main loop](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/main.cpp): `huppiproject/src/main.cpp`
- [Button controls](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/buttons.cpp): `huppiproject/src/buttons.cpp`

### Data acquisition

- [Network status](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/network.cpp): `huppiproject/src/network.cpp`
- [Time utilities](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/timeutils.cpp): `huppiproject/src/timeutils.cpp`
- [Spot prices](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/spotprice.cpp): `huppiproject/src/spotprice.cpp`
- [Weather data](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/weather.cpp): `huppiproject/src/weather.cpp`
- [DHT readings](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/dht.cpp): `huppiproject/src/dht.cpp`
- [CO₂ readings](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/scd.cpp): `huppiproject/src/scd.cpp`

### Screen presentation

- [UI updates](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/ui.cpp): `huppiproject/src/ui.cpp`
- [LCD renderer](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/blob/main/huppiproject/src/lcd.cpp): `huppiproject/src/lcd.cpp`

### Display assets

- [Font assets](https://github.com/joonasheiskanen/elektroniikan_sovellusprojekti_huppi/tree/main/huppiproject/data): `huppiproject/data`

### Other components

- **TFT display**

## Connections

- Main loop → Button controls: checks buttons (evidence: `huppiproject/src/main.cpp`)
- Main loop → Network status: updates network (evidence: `huppiproject/src/main.cpp`)
- Main loop → Time utilities: initializes time (evidence: `huppiproject/src/main.cpp`)
- Main loop → Spot prices: fetches prices (evidence: `huppiproject/src/main.cpp`)
- Main loop → Weather data: updates weather (evidence: `huppiproject/src/main.cpp`)
- Main loop → DHT readings: updates readings (evidence: `huppiproject/src/main.cpp`)
- Main loop → CO₂ readings: updates readings (evidence: `huppiproject/src/main.cpp`)
- Main loop → UI updates: requests updates (evidence: `huppiproject/src/main.cpp`)
- Main loop → Time utilities: reads time (evidence: `huppiproject/src/main.cpp`)
- Button controls → LCD renderer: sets brightness (evidence: `huppiproject/src/buttons.cpp`)
- UI updates → Time utilities: reads time (evidence: `huppiproject/src/ui.cpp`)
- UI updates → Spot prices: reads prices (evidence: `huppiproject/src/ui.cpp`)
- UI updates → Weather data: reads weather (evidence: `huppiproject/src/ui.cpp`)
- UI updates → Network status: checks status (evidence: `huppiproject/src/ui.cpp`)
- UI updates → DHT readings: reads readings (evidence: `huppiproject/src/ui.cpp`)
- UI updates → CO₂ readings: reads readings (evidence: `huppiproject/src/ui.cpp`)
- UI updates → Button controls: reads screen state (evidence: `huppiproject/src/ui.cpp`)
- UI updates → LCD renderer: draws screen (evidence: `huppiproject/src/ui.cpp`)
- LCD renderer → Weather data: reads weather (evidence: `huppiproject/src/lcd.cpp`)
- LCD renderer → Spot prices: reads prices (evidence: `huppiproject/src/lcd.cpp`)
- LCD renderer → Time utilities: reads time (evidence: `huppiproject/src/lcd.cpp`)
- LCD renderer → Button controls: reads brightness (evidence: `huppiproject/src/lcd.cpp`)
- LCD renderer → Font assets: loads fonts (evidence: `huppiproject/src/lcd.cpp`)
- LCD renderer → TFT display: draws output (evidence: `huppiproject/src/lcd.cpp`)
