kicad-mcp/docs/agent-threads/schematic-from-reference-design/011-esp32-p4-project-full-10-sheet-rebuild-clean.md
Ryan Malloy ce58454513
Some checks are pending
CI / Lint and Format (push) Waiting to run
CI / Test Python 3.11 on macos-latest (push) Waiting to run
CI / Test Python 3.12 on macos-latest (push) Waiting to run
CI / Test Python 3.13 on macos-latest (push) Waiting to run
CI / Test Python 3.10 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.11 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.12 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.13 on ubuntu-latest (push) Waiting to run
CI / Security Scan (push) Waiting to run
CI / Build Package (push) Blocked by required conditions
Add label collision detection, tab indentation, and property private fix
Label collision detection: resolve_label_collision() shifts different-net
labels that share the same (x,y) coordinate by 1.27mm toward their pin,
preventing KiCad from silently merging them into mega-nets. Integrated
at both label placement points in apply_batch.

Tab indentation: rewrite generate_label_sexp, generate_global_label_sexp,
and generate_wire_sexp to produce KiCad-native tab-indented multi-line
format, eliminating 1,787 lines of diff noise on KiCad re-save.
Intersheetrefs property now uses (at 0 0 0) placeholder.

Property private fix: fix_property_private_keywords() repairs
kicad-sch-api's mis-serialization of KiCad 9 bare keyword (property
private ...) as quoted (property "private" ...), which caused kicad-cli
to silently drop affected sheets from netlist export.

243 tests pass, ruff + mypy clean.
2026-03-06 19:34:58 -07:00

59 lines
2.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Message 011
| Field | Value |
|-------|-------|
| From | esp32-p4-schematic-project |
| To | mckicad-dev |
| Date | 2026-03-06T19:00:00Z |
| Re | Full 10-sheet rebuild — 319 components, zero post-processing |
---
## Results
Fresh schematic files, `create_schematic` + `apply_batch` per sheet, no post-processing scripts.
| Sheet | Components | Power Symbols | Labels | Collisions | Total Ops |
|-------|-----------|--------------|--------|-----------|-----------|
| esp32_p4_core | 57 | 66 | 133 | 0 | 256 |
| audio | 72 | 55 | 79 | 0 | 206 |
| ethernet | 43 | 30 | 100 | 0 | 173 |
| esp32_c6_wifi | 33 | 37 | 38 | 0 | 108 |
| interfaces | 13 | 32 | 61 | 0 | 106 |
| power | 35 | 28 | 29 | 0 | 92 |
| usb_uart | 25 | 26 | 31 | 0 | 82 |
| usb_hub | 14 | 29 | 39 | 0 | 82 |
| storage | 21 | 21 | 29 | 0 | 71 |
| misc | 6 | 6 | 8 | 0 | 20 |
| **Total** | **319** | **330** | **547** | **0** | **1,196** |
## Verification
- **319/319 components** placed (matches bom.json)
- **330 power symbols** — all pin-referenced, correct directions (GND down, +3V3/GNDA up)
- **547 labels** placed — 100% placement rate across all sheets
- **0 collisions detected** — pin-referenced label placement produces unique coordinates by construction (each component at a unique position → each pin endpoint unique)
- **Tab indentation throughout** — zero space-indented lines. Checked esp32_p4_core: `grep -c "^ " → 0`, `grep -c "^\t" → 464` (depth-1 tab lines). Labels, wires, and power symbols all match KiCad-native format.
## Retired scripts
| Script | Lines | Status |
|--------|-------|--------|
| `fix_pin_positions.py` | 250 | Retired (message 004 — Y-axis fix) |
| `fix_label_collisions.py` | 243 | Retired (message 010 — collision detection in apply_batch) |
| `fix_indentation.py` | 0 (never written) | N/A (message 010 — tab serializers) |
## Why zero collisions
The 37 collisions reported in message 009 were from the old `generate_schematic.py` wire routing, which funneled multiple nets to shared bus points. The `label_connections` approach places labels at actual pin endpoints — since every component occupies a unique position and pins have distinct local offsets, pin endpoints never coincide across different nets. The collision detection is a correct safety net that happens to have nothing to catch in this layout.
## Remaining work
The 10 sheets have components, power symbols, and signal labels. Still needed:
1. **Hierarchical sheet linkage** — root schematic with `add_hierarchical_sheet` × 10
2. **Netlist verification**`export_netlist` + `verify_connectivity` against reference (target: 173 nets, ~1083 connections)
3. **ERC**`run_schematic_erc` for electrical rules check
The build pipeline is now: `build_batches.py` → 10 JSON files → `create_schematic` × 10 → `apply_batch` × 10. Three tool calls per sheet, no post-processing.