From fd014eb3ae812e2dda62dcf6a5a66e40ff1b7b90 Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Sun, 27 Sep 2026 11:01:06 -0700 Subject: [PATCH] Port Snips controller hardware design to Stackup Replace the KiCad schematics with a KDL electrical design backed by the pinned Stackup parts library. Keep the routed KiCad PCB and add Stackup identities so the plugin can sync design changes without rerouting. Export purchasing data with stackup bom, including hand-installed parts. Add a Cargo-locked Stackup CLI and GitHub Actions checks for the design, purchasing BOM, and read-only PCB sync. CI also runs the native tests and ESP32-S3 firmware build. --- .github/workflows/ci.yml | 40 +- .gitignore | 7 +- CLAUDE.md | 26 +- PCB/GPIO_table.md | 14 +- PCB/README.md | 15 +- PCB/accelerometer.kicad_sch | 1322 ------ PCB/battery.kicad_sch | 323 -- PCB/buttons_direct.kicad_sch | 1768 ------- PCB/diagrams/README.md | 12 +- PCB/hall_trigger.kicad_sch | 631 --- .../SnipsControllers.pretty/LOGO.kicad_mod | 425 ++ PCB/mcu_core.kicad_sch | 4088 ----------------- PCB/oled.kicad_sch | 954 ---- PCB/power_buck.kicad_sch | 1618 ------- PCB/power_charger.kicad_sch | 2752 ----------- PCB/power_control.kicad_sch | 3906 ---------------- PCB/rgb_led.kicad_sch | 1044 ----- PCB/snips_controller.kicad_pcb | 2896 ++++++++++-- PCB/snips_controller.kicad_sch | 1581 ------- PCB/snips_controller.stackup_sch | 1 + PCB/snips_controller.yaml | 12 +- PCB/stackup/README.md | 14 + PCB/stackup/board.kdl | 187 + PCB/stackup/parts.kdl | 30 + PCB/thumbstick.kicad_sch | 834 ---- PCB/usb_c.kicad_sch | 1904 -------- PCB/xbee.kicad_sch | 2390 ---------- README.md | 4 +- ci/check_pcb_sync.py | 83 + ci/stackup/Cargo.lock | 421 ++ ci/stackup/Cargo.toml | 8 + ci/stackup/src/main.rs | 3 + manifest.kdl | 2 + scripts/apply_lcsc_fields.py | 169 +- scripts/bom_values.py | 201 - scripts/jlc_match.py | 59 +- scripts/spice/README.md | 4 +- scripts/spice/latch_sim.py | 4 +- scripts/stackup_parts.py | 135 + src/SnipsController.ino | 2 +- 40 files changed, 3975 insertions(+), 25914 deletions(-) delete mode 100644 PCB/accelerometer.kicad_sch delete mode 100644 PCB/battery.kicad_sch delete mode 100644 PCB/buttons_direct.kicad_sch delete mode 100644 PCB/hall_trigger.kicad_sch create mode 100644 PCB/libraries/SnipsControllers.pretty/LOGO.kicad_mod delete mode 100644 PCB/mcu_core.kicad_sch delete mode 100644 PCB/oled.kicad_sch delete mode 100644 PCB/power_buck.kicad_sch delete mode 100644 PCB/power_charger.kicad_sch delete mode 100644 PCB/power_control.kicad_sch delete mode 100644 PCB/rgb_led.kicad_sch delete mode 100644 PCB/snips_controller.kicad_sch create mode 100644 PCB/snips_controller.stackup_sch create mode 100644 PCB/stackup/README.md create mode 100644 PCB/stackup/board.kdl create mode 100644 PCB/stackup/parts.kdl delete mode 100644 PCB/thumbstick.kicad_sch delete mode 100644 PCB/usb_c.kicad_sch delete mode 100644 PCB/xbee.kicad_sch create mode 100644 ci/check_pcb_sync.py create mode 100644 ci/stackup/Cargo.lock create mode 100644 ci/stackup/Cargo.toml create mode 100644 ci/stackup/src/main.rs create mode 100644 manifest.kdl delete mode 100644 scripts/bom_values.py create mode 100644 scripts/stackup_parts.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df3b2cb..ce5dff9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,48 @@ name: CI on: + workflow_dispatch: push: - branches: [main] + branches: [main, stackup] pull_request: - branches: [main] + branches: [main, stackup] jobs: + stackup-check: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Checkout Stackup KiCad plugin + uses: actions/checkout@v4 + with: + repository: stackup-eda/stackup + ref: v0.1.3 + path: stackup-tool + + - name: Install Rust 1.96 + run: rustup toolchain install 1.96.0 --profile minimal + + - name: Check Stackup design + run: cargo +1.96.0 run --locked --manifest-path ci/stackup/Cargo.toml -- check PCB/stackup/board.kdl --locked + + - name: Check purchasing BOM + run: cargo +1.96.0 run --locked --manifest-path ci/stackup/Cargo.toml -- bom PCB/stackup/board.kdl --locked -o /tmp/snips-bom.csv + + - name: Install KiCad 10 + run: | + sudo apt-get update + sudo apt-get install -y software-properties-common + sudo add-apt-repository --yes ppa:kicad/kicad-10.0-releases + sudo apt-get update + sudo apt-get install -y --install-recommends kicad + + - name: Check PCB sync + run: | + /usr/bin/python3 ci/check_pcb_sync.py PCB/snips_controller.kicad_pcb \ + --stackup ci/stackup/target/debug/snips-stackup-check \ + --plugin-dir stackup-tool/kicad-plugin + native-tests: runs-on: ubuntu-latest steps: diff --git a/.gitignore b/.gitignore index 04e5d0f..c2ae4cc 100644 --- a/.gitignore +++ b/.gitignore @@ -66,4 +66,9 @@ PCB/production/misc/* # ERC report JSON scratch files (from kicad-cli sch erc) PCB/erc*.json -PCB/full_erc*.json \ No newline at end of file +PCB/full_erc*.json + +# Local Stackup library checkout for development +manifest.local.kdl +.stackup/ +ci/stackup/target/ diff --git a/CLAUDE.md b/CLAUDE.md index d0551e1..99f8cba 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -23,18 +23,18 @@ ``` 3. Once a PR lands, delete the local feature branch. This repo always squash or rebase merges — `main` never gets a merge commit for the PR, so `git branch -d` (and `--merged` checks) won't recognize the branch as merged even though its content has landed. Confirm via `git log --oneline` (look for the PR's commit/title on `main`) or `gh pr view --json state`, then use `git branch -D ` to remove it. -## BOM Value fields - -The fab's BOM shows only Designator, Footprint, Quantity and **Value** (never MF, MPN or LCSC), so every -component's Value is `