# nickshl/smartpendant architecture

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

- Interactive diagram: https://gitdiagram.com/nickshl/smartpendant
- Repository: https://github.com/nickshl/smartpendant

## Overview

SmartPendant is STM32F411 firmware that gives a machine operator a touchscreen/handwheel interface to a grblHAL controller. The user selects a control or setup screen, operates the machine or runs a probing/program workflow, and receives controller status through the pendant UI. The README documents probing (including tool offsets), G-code generation, program sending, settings, and multiple controller transports. The sampled application code establishes screen setup and navigation; most feature implementations and transport wiring were not sampled, so uncertain runtime links are omitted or dashed.

Main entry points: [`Application/Application.cpp`](https://github.com/nickshl/smartpendant/blob/main/Application/Application.cpp) (Application), [`Application/GrblComm.cpp`](https://github.com/nickshl/smartpendant/blob/main/Application/GrblComm.cpp) (GrblHAL Communication), [`Application/SettingsScr.cpp`](https://github.com/nickshl/smartpendant/blob/main/Application/SettingsScr.cpp) (Settings), [`Application/ProbeScr.cpp`](https://github.com/nickshl/smartpendant/blob/main/Application/ProbeScr.cpp) (Probing and Tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Pendant UI"]
  node_application["Application<br/>[Application.cpp]"]
  node_screens["Screen Framework<br/>[IScreen.h]"]
  node_display["Data Windows<br/>[DataWindow.h]"]
  node_input["Handwheel Input<br/>[InputDrv.h]"]
  node_header["Page Header<br/>[Header.cpp]"]
end

subgraph group_machine["Machine Control"]
  node_direct["Direct Control"]
  node_overrides["Overrides"]
  node_delay["Delay Control"]
  node_rotary["Rotary Table<br/>[RotaryTableScr.cpp]"]
  node_grbl["GrblHAL Communication<br/>[GrblComm.cpp]"]
  node_uart["UART Transport<br/>[FramedUart.cpp]"]
  node_usb["USB CDC Transport<br/>[UsbCdcUart.cpp]"]
end

subgraph group_workflows["Operator Workflows"]
  node_probing["Probing and Tools<br/>[ProbeScr.cpp]"]
  node_sender["Program Sender<br/>[ProgramSender.cpp]"]
  node_generator["G-code Generator"]
  node_settings["Settings<br/>[SettingsScr.cpp]"]
end

subgraph group_platform["Firmware Platform"]
  node_startup["MCU Startup<br/>[main.c]"]
  node_storage[("Persistent Settings<br/>[NVM.cpp]")]
end

node_operator(("Operator"))
node_controller["grblHAL Controller"]
node_machine_operator["CNC Machine"]

node_operator -->|"operates"| node_application
node_startup -->|"starts"| node_application
node_application -->|"sets up"| node_screens
node_application -->|"selects page"| node_header
node_application -->|"hosts screen"| node_direct
node_application -->|"hosts screen"| node_overrides
node_application -->|"hosts screen"| node_delay
node_application -->|"hosts screen"| node_rotary
node_application -->|"hosts screen"| node_probing
node_application -->|"hosts screen"| node_sender
node_application -->|"hosts screen"| node_generator
node_application -->|"hosts screen"| node_settings
node_application -->|"uses windows"| node_display
node_application -->|"uses input"| node_input
node_application -->|"uses communication"| node_grbl
node_settings -.->|"configures"| node_storage
node_grbl -.->|"uses transport"| node_uart
node_grbl -.->|"uses transport"| node_usb
node_grbl -.->|"exchanges commands"| node_controller
node_controller -.->|"controls"| node_machine_operator
node_operator -->|"runs measurements"| node_probing
node_operator -->|"runs programs"| node_sender

click node_startup "https://github.com/nickshl/smartpendant/blob/main/Src/main.c"
click node_application "https://github.com/nickshl/smartpendant/blob/main/Application/Application.cpp"
click node_screens "https://github.com/nickshl/smartpendant/blob/main/Application/IScreen.h"
click node_display "https://github.com/nickshl/smartpendant/blob/main/Application/DataWindow.h"
click node_input "https://github.com/nickshl/smartpendant/blob/main/Application/InputDrv.h"
click node_header "https://github.com/nickshl/smartpendant/blob/main/Application/Header.cpp"
click node_direct "https://github.com/nickshl/smartpendant/blob/main/Application/DirectControlScr.cpp"
click node_overrides "https://github.com/nickshl/smartpendant/blob/main/Application/OverrideCtrlScr.cpp"
click node_delay "https://github.com/nickshl/smartpendant/blob/main/Application/DelayControlScr.cpp"
click node_rotary "https://github.com/nickshl/smartpendant/blob/main/Application/RotaryTableScr.cpp"
click node_grbl "https://github.com/nickshl/smartpendant/blob/main/Application/GrblComm.cpp"
click node_uart "https://github.com/nickshl/smartpendant/blob/main/Application/FramedUart.cpp"
click node_usb "https://github.com/nickshl/smartpendant/blob/main/Application/UsbCdcUart.cpp"
click node_probing "https://github.com/nickshl/smartpendant/blob/main/Application/ProbeScr.cpp"
click node_sender "https://github.com/nickshl/smartpendant/blob/main/Application/ProgramSender.cpp"
click node_generator "https://github.com/nickshl/smartpendant/blob/main/Application/GCodeGeneratorScr.cpp"
click node_settings "https://github.com/nickshl/smartpendant/blob/main/Application/SettingsScr.cpp"
click node_storage "https://github.com/nickshl/smartpendant/blob/main/Application/NVM.cpp"

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_application,node_screens,node_display,node_input,node_header toneBlue
class node_direct,node_overrides,node_delay,node_rotary,node_grbl,node_uart,node_usb toneAmber
class node_probing,node_sender,node_generator,node_settings toneMint
class node_startup,node_storage toneRose
class node_operator,node_controller,node_machine_operator toneIndigo
```

## Components

### Pendant UI

- [Application](https://github.com/nickshl/smartpendant/blob/main/Application/Application.cpp): `Application/Application.cpp`
- [Screen Framework](https://github.com/nickshl/smartpendant/blob/main/Application/IScreen.h): `Application/IScreen.h`
- [Data Windows](https://github.com/nickshl/smartpendant/blob/main/Application/DataWindow.h): `Application/DataWindow.h`
- [Handwheel Input](https://github.com/nickshl/smartpendant/blob/main/Application/InputDrv.h): `Application/InputDrv.h`
- [Page Header](https://github.com/nickshl/smartpendant/blob/main/Application/Header.cpp): `Application/Header.cpp`

### Machine Control

- [Direct Control](https://github.com/nickshl/smartpendant/blob/main/Application/DirectControlScr.cpp): `Application/DirectControlScr.cpp`
- [Overrides](https://github.com/nickshl/smartpendant/blob/main/Application/OverrideCtrlScr.cpp): `Application/OverrideCtrlScr.cpp`
- [Delay Control](https://github.com/nickshl/smartpendant/blob/main/Application/DelayControlScr.cpp): `Application/DelayControlScr.cpp`
- [Rotary Table](https://github.com/nickshl/smartpendant/blob/main/Application/RotaryTableScr.cpp): `Application/RotaryTableScr.cpp`
- [GrblHAL Communication](https://github.com/nickshl/smartpendant/blob/main/Application/GrblComm.cpp): `Application/GrblComm.cpp`
- [UART Transport](https://github.com/nickshl/smartpendant/blob/main/Application/FramedUart.cpp): `Application/FramedUart.cpp`
- [USB CDC Transport](https://github.com/nickshl/smartpendant/blob/main/Application/UsbCdcUart.cpp): `Application/UsbCdcUart.cpp`

### Operator Workflows

- [Probing and Tools](https://github.com/nickshl/smartpendant/blob/main/Application/ProbeScr.cpp): `Application/ProbeScr.cpp`
- [Program Sender](https://github.com/nickshl/smartpendant/blob/main/Application/ProgramSender.cpp): `Application/ProgramSender.cpp`
- [G-code Generator](https://github.com/nickshl/smartpendant/blob/main/Application/GCodeGeneratorScr.cpp): `Application/GCodeGeneratorScr.cpp`
- [Settings](https://github.com/nickshl/smartpendant/blob/main/Application/SettingsScr.cpp): `Application/SettingsScr.cpp`

### Firmware Platform

- [MCU Startup](https://github.com/nickshl/smartpendant/blob/main/Src/main.c): `Src/main.c`
- [Persistent Settings](https://github.com/nickshl/smartpendant/blob/main/Application/NVM.cpp): `Application/NVM.cpp`

### Other components

- **Operator**
- **grblHAL Controller**
- **CNC Machine**

## Connections

- Operator → Application: operates (evidence: `README.md`)
- MCU Startup → Application: starts (evidence: `Src/main.c`)
- Application → Screen Framework: sets up (evidence: `Application/Application.cpp`)
- Application → Page Header: selects page (evidence: `Application/Application.cpp`)
- Application → Direct Control: hosts screen
- Application → Overrides: hosts screen
- Application → Delay Control: hosts screen
- Application → Rotary Table: hosts screen
- Application → Probing and Tools: hosts screen
- Application → Program Sender: hosts screen
- Application → G-code Generator: hosts screen
- Application → Settings: hosts screen
- Application → Data Windows: uses windows
- Application → Handwheel Input: uses input
- Application → GrblHAL Communication: uses communication
- Settings → Persistent Settings: configures
- GrblHAL Communication → UART Transport: uses transport
- GrblHAL Communication → USB CDC Transport: uses transport
- GrblHAL Communication → grblHAL Controller: exchanges commands
- grblHAL Controller → CNC Machine: controls
- Operator → Probing and Tools: runs measurements (evidence: `README.md`)
- Operator → Program Sender: runs programs (evidence: `README.md`)
