# gtrlvr/af-434 architecture

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

- Interactive diagram: https://gitdiagram.com/gtrlvr/af-434
- Repository: https://github.com/gtrlvr/af-434

## Overview

AF-434 is a keyboard-controlled, three-axis gantry system. The main workflow is keyboard input captured by the Python controller, sent as commands over USB serial, and executed by Mega firmware as coordinated motor motion; firmware replies provide status to the host. The README also documents absolute moves, position counters, driver enable/free controls, alarm handling, and a heartbeat timeout. Firmware internals were not sampled, so its distinct capabilities are represented at the documented subsystem level rather than as inferred call chains.

Main entry points: [`gantry_control/gantry_control.ino`](https://github.com/gtrlvr/af-434/blob/main/gantry_control/gantry_control.ino) (Command protocol), [`gantry_keyboard.py`](https://github.com/gtrlvr/af-434/blob/main/gantry_keyboard.py) (Serial controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Host controller"]
  node_keyboard["Keyboard input<br/>[gantry_keyboard.py]"]
  node_host_serial["Serial controller<br/>[gantry_keyboard.py]"]
end

subgraph group_firmware["Mega firmware"]
  node_command_protocol["Command protocol<br/>[gantry_control.ino]"]
  node_motion["Axis motion<br/>[gantry_control.ino]"]
  node_position_goto["Position and goto<br/>[gantry_control.ino]"]
  node_driver_safety["Driver safety<br/>[gantry_control.ino]"]
  node_serial_status["Serial status<br/>[gantry_control.ino]"]
end

subgraph group_hardware["Gantry hardware"]
  node_motors["Four iCL42 motors"]
end

node_operator(("Operator"))

node_operator -->|"presses keys"| node_keyboard
node_keyboard -->|"sends commands"| node_host_serial
node_host_serial -->|"USB serial"| node_command_protocol
node_command_protocol -->|"dispatches motion"| node_motion
node_command_protocol -->|"dispatches queries"| node_position_goto
node_command_protocol -->|"dispatches controls"| node_driver_safety
node_motion -->|"drives motors"| node_motors
node_position_goto -->|"reports results"| node_serial_status
node_driver_safety -->|"reports alarms"| node_serial_status
node_serial_status -->|"returns status"| node_host_serial

click node_keyboard "https://github.com/gtrlvr/af-434/blob/main/gantry_keyboard.py"
click node_host_serial "https://github.com/gtrlvr/af-434/blob/main/gantry_keyboard.py"
click node_command_protocol "https://github.com/gtrlvr/af-434/blob/main/gantry_control/gantry_control.ino"
click node_motion "https://github.com/gtrlvr/af-434/blob/main/gantry_control/gantry_control.ino"
click node_position_goto "https://github.com/gtrlvr/af-434/blob/main/gantry_control/gantry_control.ino"
click node_driver_safety "https://github.com/gtrlvr/af-434/blob/main/gantry_control/gantry_control.ino"
click node_serial_status "https://github.com/gtrlvr/af-434/blob/main/gantry_control/gantry_control.ino"

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_keyboard,node_host_serial toneBlue
class node_command_protocol,node_motion,node_position_goto,node_driver_safety,node_serial_status toneAmber
class node_motors toneMint
class node_operator toneIndigo
```

## Components

### Host controller

- [Keyboard input](https://github.com/gtrlvr/af-434/blob/main/gantry_keyboard.py): `gantry_keyboard.py`
- [Serial controller](https://github.com/gtrlvr/af-434/blob/main/gantry_keyboard.py): `gantry_keyboard.py`

### Mega firmware

- [Command protocol](https://github.com/gtrlvr/af-434/blob/main/gantry_control/gantry_control.ino): `gantry_control/gantry_control.ino`
- [Axis motion](https://github.com/gtrlvr/af-434/blob/main/gantry_control/gantry_control.ino): `gantry_control/gantry_control.ino`
- [Position and goto](https://github.com/gtrlvr/af-434/blob/main/gantry_control/gantry_control.ino): `gantry_control/gantry_control.ino`
- [Driver safety](https://github.com/gtrlvr/af-434/blob/main/gantry_control/gantry_control.ino): `gantry_control/gantry_control.ino`
- [Serial status](https://github.com/gtrlvr/af-434/blob/main/gantry_control/gantry_control.ino): `gantry_control/gantry_control.ino`

### Gantry hardware

- **Four iCL42 motors**

### Other components

- **Operator**

## Connections

- Operator → Keyboard input: presses keys (evidence: `README.md`)
- Keyboard input → Serial controller: sends commands (evidence: `gantry_keyboard.py`)
- Serial controller → Command protocol: USB serial (evidence: `README.md`)
- Command protocol → Axis motion: dispatches motion (evidence: `README.md`)
- Command protocol → Position and goto: dispatches queries (evidence: `README.md`)
- Command protocol → Driver safety: dispatches controls (evidence: `README.md`)
- Axis motion → Four iCL42 motors: drives motors (evidence: `README.md`)
- Position and goto → Serial status: reports results (evidence: `README.md`)
- Driver safety → Serial status: reports alarms (evidence: `README.md`)
- Serial status → Serial controller: returns status (evidence: `README.md`)
