# igorpl/eucwatch architecture

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

- Interactive diagram: https://gitdiagram.com/igorpl/eucwatch
- Repository: https://github.com/igorpl/eucwatch

## Overview

eucWatch is smartwatch firmware for monitoring and interacting with electric unicycles (EUCs), alongside web loaders for installing the firmware. The user-facing flow is watch input and runtime navigation to a face, with the main face rendering watch status and notifications; the firmware also includes EUC-specific dashboards and protocol modules. The README documents manual P8 script installation and separate web loaders for P8/P22-family watches, DK08, and DSD6. Several branches are represented by their directory because their implementations were not excerpted.

Main entry points: [`P8`](https://github.com/igorpl/eucwatch/tree/main/P8) (P8 firmware), [`P8/handler/handler.js`](https://github.com/igorpl/eucwatch/blob/main/P8/handler/handler.js) (P8 handler), [`P8/main/main.js`](https://github.com/igorpl/eucwatch/blob/main/P8/main/main.js) (Main face), [`Loader/puck.js`](https://github.com/igorpl/eucwatch/blob/main/Loader/puck.js) (Web loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_installation["Installation"]
  node_web_loader["Web loader<br/>[puck.js]"]
  node_loader_tools["Loader tools"]
end

subgraph group_runtime["Watch runtime"]
  node_p8_firmware["P8 firmware"]
  node_dk08_firmware["DK08 firmware"]
  node_dsd6_firmware["DSD6 firmware"]
  node_v2_firmware["V2 firmware"]
  node_p8_main["Main face<br/>[main.js]"]
  node_storage[("Espruino storage")]
end

subgraph group_euc["EUC features"]
  node_euc_protocols["EUC protocols"]
  node_dashboards["Dashboards"]
  node_scan["Wheel scan<br/>[w_scan.js]"]
end

subgraph group_interaction["Watch interaction"]
  node_p8_handler["P8 handler<br/>[handler.js]"]
  node_p8_settings["Settings<br/>[settings.js]"]
  node_touch_sensors["Touch and sensors"]
end

subgraph group_integrations["Integrations"]
  node_notifications["Notifications<br/>[handler.js]"]
  node_gadgetbridge["GadgetBridge<br/>[m_gb.js]"]
  node_euc_world["EUC emulation<br/>[emuZ.js]"]
end

node_user(("Watch owner"))

node_user -->|"installs firmware"| node_web_loader
node_web_loader -.->|"uses tools"| node_loader_tools
node_user -.->|"uses watch"| node_p8_firmware
node_p8_handler -->|"loads app"| node_storage
node_p8_handler -.->|"reads input"| node_touch_sensors
node_p8_handler -.->|"dispatches face"| node_p8_main
node_p8_main -->|"renders alerts"| node_notifications
node_p8_main -->|"reads wheel state"| node_euc_protocols
node_p8_handler -.->|"uses settings"| node_p8_settings
node_p8_firmware -.->|"supports wheel protocols"| node_euc_protocols
node_p8_firmware -.->|"provides dashboards"| node_dashboards
node_p8_firmware -.->|"provides scanning"| node_scan
node_p8_firmware -.->|"supports notifications"| node_gadgetbridge
node_p8_firmware -.->|"supports emulation"| node_euc_world

click node_web_loader "https://github.com/igorpl/eucwatch/blob/main/Loader/puck.js"
click node_loader_tools "https://github.com/igorpl/eucwatch/tree/main/Loader/core/lib"
click node_p8_firmware "https://github.com/igorpl/eucwatch/tree/main/P8"
click node_dk08_firmware "https://github.com/igorpl/eucwatch/tree/main/DK08"
click node_dsd6_firmware "https://github.com/igorpl/eucwatch/tree/main/DSD6"
click node_v2_firmware "https://github.com/igorpl/eucwatch/tree/main/v2"
click node_p8_handler "https://github.com/igorpl/eucwatch/blob/main/P8/handler/handler.js"
click node_p8_main "https://github.com/igorpl/eucwatch/blob/main/P8/main/main.js"
click node_p8_settings "https://github.com/igorpl/eucwatch/blob/main/P8/settings/settings.js"
click node_euc_protocols "https://github.com/igorpl/eucwatch/tree/main/P8/euc"
click node_dashboards "https://github.com/igorpl/eucwatch/tree/main/P8/dashKingsong"
click node_scan "https://github.com/igorpl/eucwatch/blob/main/P8/w_scan/w_scan.js"
click node_notifications "https://github.com/igorpl/eucwatch/blob/main/P8/handler/handler.js"
click node_gadgetbridge "https://github.com/igorpl/eucwatch/blob/main/P8/m_gb/m_gb.js"
click node_euc_world "https://github.com/igorpl/eucwatch/blob/main/P8/euc/emuZ.js"

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_web_loader,node_loader_tools toneBlue
class node_p8_firmware,node_dk08_firmware,node_dsd6_firmware,node_v2_firmware,node_p8_main,node_storage toneAmber
class node_euc_protocols,node_dashboards,node_scan toneMint
class node_p8_handler,node_p8_settings,node_touch_sensors toneRose
class node_notifications,node_gadgetbridge,node_euc_world,node_user toneIndigo
```

## Components

### Installation

- [Web loader](https://github.com/igorpl/eucwatch/blob/main/Loader/puck.js): `Loader/puck.js`
- [Loader tools](https://github.com/igorpl/eucwatch/tree/main/Loader/core/lib): `Loader/core/lib`

### Watch runtime

- [P8 firmware](https://github.com/igorpl/eucwatch/tree/main/P8): `P8`
- [DK08 firmware](https://github.com/igorpl/eucwatch/tree/main/DK08): `DK08`
- [DSD6 firmware](https://github.com/igorpl/eucwatch/tree/main/DSD6): `DSD6`
- [V2 firmware](https://github.com/igorpl/eucwatch/tree/main/v2): `v2`
- [Main face](https://github.com/igorpl/eucwatch/blob/main/P8/main/main.js): `P8/main/main.js`
- **Espruino storage**

### EUC features

- [EUC protocols](https://github.com/igorpl/eucwatch/tree/main/P8/euc): `P8/euc`
- [Dashboards](https://github.com/igorpl/eucwatch/tree/main/P8/dashKingsong): `P8/dashKingsong`
- [Wheel scan](https://github.com/igorpl/eucwatch/blob/main/P8/w_scan/w_scan.js): `P8/w_scan/w_scan.js`

### Watch interaction

- [P8 handler](https://github.com/igorpl/eucwatch/blob/main/P8/handler/handler.js): `P8/handler/handler.js`
- [Settings](https://github.com/igorpl/eucwatch/blob/main/P8/settings/settings.js): `P8/settings/settings.js`
- **Touch and sensors**

### Integrations

- [Notifications](https://github.com/igorpl/eucwatch/blob/main/P8/handler/handler.js): `P8/handler/handler.js`
- [GadgetBridge](https://github.com/igorpl/eucwatch/blob/main/P8/m_gb/m_gb.js): `P8/m_gb/m_gb.js`
- [EUC emulation](https://github.com/igorpl/eucwatch/blob/main/P8/euc/emuZ.js): `P8/euc/emuZ.js`

### Other components

- **Watch owner**

## Connections

- Watch owner → Web loader: installs firmware (evidence: `README.md`)
- Web loader → Loader tools: uses tools
- Watch owner → P8 firmware: uses watch
- P8 handler → Espruino storage: loads app (evidence: `P8/handler/handler.js`)
- P8 handler → Touch and sensors: reads input
- P8 handler → Main face: dispatches face
- Main face → Notifications: renders alerts (evidence: `P8/main/main.js`)
- Main face → EUC protocols: reads wheel state (evidence: `P8/main/main.js`)
- P8 handler → Settings: uses settings
- P8 firmware → EUC protocols: supports wheel protocols
- P8 firmware → Dashboards: provides dashboards
- P8 firmware → Wheel scan: provides scanning
- P8 firmware → GadgetBridge: supports notifications
- P8 firmware → EUC emulation: supports emulation
