# builty/tonexonecontroller architecture

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

- Interactive diagram: https://gitdiagram.com/builty/tonexonecontroller
- Repository: https://github.com/builty/tonexonecontroller

## Overview

This is ESP32-S3 firmware for a multi-input controller and display for TONEX and Valeton pedals. The main workflow is that a user selects a preset or changes parameters through a supported control surface; firmware translates the action to pedal control and presents the current state. README documents the input and pedal capabilities, while the sampled main.c shows the firmware’s subsystem references. Most feature-specific implementations were not sampled, so some documented connections are dashed and unverified.

Main entry points: [`source/main/main.c`](https://github.com/builty/tonexonecontroller/blob/main/source/main/main.c) (Application firmware), [`source/main`](https://github.com/builty/tonexonecontroller/tree/main/source/main) (Preset and parameter control), [`minimidi/source/components/blemidi/blemidi.c`](https://github.com/builty/tonexonecontroller/blob/main/minimidi/source/components/blemidi/blemidi.c) (Bluetooth MIDI), [`source/components/usb_host_midi/midi_host.c`](https://github.com/builty/tonexonecontroller/blob/main/source/components/usb_host_midi/midi_host.c) (USB MIDI host)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Firmware and control"]
  node_firmware["Application firmware<br/>[main.c]"]
  node_preset["Preset and parameter control"]
  node_tonexparams["TONEX parameters"]
  node_valetonparams["Valeton parameters"]
end

subgraph group_ui["Display and input"]
  node_display["Touchscreen UI"]
  node_lvgl["LVGL graphics<br/>[lvgl.h]"]
  node_footswitch["Wired footswitches"]
  node_webconfig["WiFi configuration"]
end

subgraph group_midi["MIDI connectivity"]
  node_ble["Bluetooth MIDI<br/>[blemidi.c]"]
  node_midiinput["Serial MIDI"]
  node_usbhost["USB MIDI host<br/>[midi_host.c]"]
  node_usbcdc["USB CDC ACM<br/>[cdc_acm_host.c]"]
end

subgraph group_hardware["Hardware interfaces"]
  node_io["GPIO and I2C hardware<br/>[main.c]"]
end

node_user(("Controller user"))
node_tonexpedal["TONEX pedal"]
node_valetonpedal["Valeton GP5"]
node_externalfootswitch["Footswitch hardware"]
node_bluetoothcontroller(("Bluetooth controller"))
node_midiuser(("MIDI controller or phone"))

node_user -.->|"selects presets"| node_display
node_user -.->|"switches presets"| node_footswitch
node_user -.->|"configures over WiFi"| node_webconfig
node_externalfootswitch -.->|"signals presses"| node_footswitch
node_bluetoothcontroller -.->|"sends MIDI"| node_ble
node_midiuser -.->|"sends programs"| node_midiinput
node_display -.->|"uses graphics"| node_lvgl
node_firmware -.->|"initializes"| node_display
node_firmware -.->|"initializes"| node_footswitch
node_firmware -.->|"initializes"| node_webconfig
node_firmware -.->|"dispatches control"| node_preset
node_firmware -.->|"uses parameters"| node_tonexparams
node_firmware -.->|"uses parameters"| node_valetonparams
node_firmware -.->|"initializes"| node_midiinput
node_firmware -.->|"configures hardware"| node_io
node_preset -.->|"controls presets"| node_tonexpedal
node_preset -.->|"controls presets"| node_valetonpedal
node_tonexparams -.->|"controls parameters"| node_tonexpedal
node_valetonparams -.->|"controls parameters"| node_valetonpedal
node_ble -.->|"switches presets"| node_preset
node_midiinput -.->|"selects programs"| node_preset
node_usbhost -.->|"controls pedal"| node_tonexpedal
node_usbcdc -.->|"provides USB transport"| node_firmware

click node_firmware "https://github.com/builty/tonexonecontroller/blob/main/source/main/main.c"
click node_preset "https://github.com/builty/tonexonecontroller/tree/main/source/main"
click node_tonexparams "https://github.com/builty/tonexonecontroller/tree/main/source/main"
click node_valetonparams "https://github.com/builty/tonexonecontroller/tree/main/source/main"
click node_display "https://github.com/builty/tonexonecontroller/tree/main/source/main"
click node_lvgl "https://github.com/builty/tonexonecontroller/blob/main/source/components/lvgl__lvgl/lvgl.h"
click node_footswitch "https://github.com/builty/tonexonecontroller/tree/main/source/main"
click node_webconfig "https://github.com/builty/tonexonecontroller/tree/main/source/main"
click node_ble "https://github.com/builty/tonexonecontroller/blob/main/minimidi/source/components/blemidi/blemidi.c"
click node_midiinput "https://github.com/builty/tonexonecontroller/tree/main/source/main"
click node_usbhost "https://github.com/builty/tonexonecontroller/blob/main/source/components/usb_host_midi/midi_host.c"
click node_usbcdc "https://github.com/builty/tonexonecontroller/blob/main/source/components/espressif__usb_host_cdc_acm/cdc_acm_host.c"
click node_io "https://github.com/builty/tonexonecontroller/blob/main/source/main/main.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_firmware,node_preset,node_tonexparams,node_valetonparams,node_user toneBlue
class node_display,node_lvgl,node_footswitch,node_webconfig toneAmber
class node_ble,node_midiinput,node_usbhost,node_usbcdc toneMint
class node_io toneRose
class node_tonexpedal,node_valetonpedal,node_externalfootswitch,node_bluetoothcontroller,node_midiuser toneIndigo
```

## Components

### Firmware and control

- [Application firmware](https://github.com/builty/tonexonecontroller/blob/main/source/main/main.c): `source/main/main.c`
- [Preset and parameter control](https://github.com/builty/tonexonecontroller/tree/main/source/main): `source/main`
- [TONEX parameters](https://github.com/builty/tonexonecontroller/tree/main/source/main): `source/main`
- [Valeton parameters](https://github.com/builty/tonexonecontroller/tree/main/source/main): `source/main`

### Display and input

- [Touchscreen UI](https://github.com/builty/tonexonecontroller/tree/main/source/main): `source/main`
- [LVGL graphics](https://github.com/builty/tonexonecontroller/blob/main/source/components/lvgl__lvgl/lvgl.h): `source/components/lvgl__lvgl/lvgl.h`
- [Wired footswitches](https://github.com/builty/tonexonecontroller/tree/main/source/main): `source/main`
- [WiFi configuration](https://github.com/builty/tonexonecontroller/tree/main/source/main): `source/main`

### MIDI connectivity

- [Bluetooth MIDI](https://github.com/builty/tonexonecontroller/blob/main/minimidi/source/components/blemidi/blemidi.c): `minimidi/source/components/blemidi/blemidi.c`
- [Serial MIDI](https://github.com/builty/tonexonecontroller/tree/main/source/main): `source/main`
- [USB MIDI host](https://github.com/builty/tonexonecontroller/blob/main/source/components/usb_host_midi/midi_host.c): `source/components/usb_host_midi/midi_host.c`
- [USB CDC ACM](https://github.com/builty/tonexonecontroller/blob/main/source/components/espressif__usb_host_cdc_acm/cdc_acm_host.c): `source/components/espressif__usb_host_cdc_acm/cdc_acm_host.c`

### Hardware interfaces

- [GPIO and I2C hardware](https://github.com/builty/tonexonecontroller/blob/main/source/main/main.c): `source/main/main.c`

### Other components

- **Controller user**
- **TONEX pedal**
- **Valeton GP5**
- **Footswitch hardware**
- **Bluetooth controller**
- **MIDI controller or phone**

## Connections

- Controller user → Touchscreen UI: selects presets (evidence: `README.md`)
- Controller user → Wired footswitches: switches presets (evidence: `README.md`)
- Controller user → WiFi configuration: configures over WiFi (evidence: `README.md`)
- Footswitch hardware → Wired footswitches: signals presses (evidence: `README.md`)
- Bluetooth controller → Bluetooth MIDI: sends MIDI (evidence: `README.md`)
- MIDI controller or phone → Serial MIDI: sends programs (evidence: `README.md`)
- Touchscreen UI → LVGL graphics: uses graphics (evidence: `source/main/main.c`)
- Application firmware → Touchscreen UI: initializes (evidence: `source/main/main.c`)
- Application firmware → Wired footswitches: initializes (evidence: `source/main/main.c`)
- Application firmware → WiFi configuration: initializes (evidence: `source/main/main.c`)
- Application firmware → Preset and parameter control: dispatches control (evidence: `source/main/main.c`)
- Application firmware → TONEX parameters: uses parameters (evidence: `source/main/main.c`)
- Application firmware → Valeton parameters: uses parameters (evidence: `source/main/main.c`)
- Application firmware → Serial MIDI: initializes (evidence: `source/main/main.c`)
- Application firmware → GPIO and I2C hardware: configures hardware (evidence: `source/main/main.c`)
- Preset and parameter control → TONEX pedal: controls presets (evidence: `README.md`)
- Preset and parameter control → Valeton GP5: controls presets (evidence: `README.md`)
- TONEX parameters → TONEX pedal: controls parameters (evidence: `README.md`)
- Valeton parameters → Valeton GP5: controls parameters (evidence: `README.md`)
- Bluetooth MIDI → Preset and parameter control: switches presets (evidence: `README.md`)
- Serial MIDI → Preset and parameter control: selects programs (evidence: `README.md`)
- USB MIDI host → TONEX pedal: controls pedal (evidence: `README.md`)
- USB CDC ACM → Application firmware: provides USB transport
