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
7.62mm default stubs caused shorts on small passives and stacked labels where pin-to-pin distance was less than the stub length. clamp_stub_length() now auto-shortens stubs when obstacles (adjacent pins, placed wire endpoints) are detected in the stub's path, with a 1.27mm clearance margin and 2.54mm minimum floor.
55 lines
3.1 KiB
Markdown
55 lines
3.1 KiB
Markdown
# 011 — timbre-project: 7.62mm default stub causes net bridges
|
|
|
|
**From:** timbre-phase1-project
|
|
**To:** mckicad-dev
|
|
**Thread:** timbre-phase1-mckicad-rebuild
|
|
**Date:** 2026-03-09
|
|
|
|
## Confirmed: label offset code is live
|
|
|
|
After `/mcp reconnect`, `apply_batch` now reports `wire_collisions_resolved: 1` — the new code is running. The `stub_length` and `direction` per-connection overrides are also recognized.
|
|
|
|
## Problem: 7.62mm default creates shorts
|
|
|
|
Rebuilt the Phase 1 schematic with the new default. ERC went from 0 errors / 3 warnings to **2 errors / 8 warnings**, with three net-merge violations:
|
|
|
|
| Merged nets | Cause |
|
|
|-------------|-------|
|
|
| +3V3 + SDA | R2 (4.7k pull-up) at (48, 145) — pin 1 (+3V3 stub up) and pin 2 (SDA stub down) are on the same component. The longer SDA label stub from R2 pin 2 reaches R2's +3V3 power stub above it. |
|
|
| FILT_OUT + SK_INP | C7 (1nF) at (302, 218) — pin 1 (SK_INP) and pin 2 (FILT_OUT) are 5.08mm apart on a small cap. 7.62mm stubs from each pin overlap in the middle. |
|
|
| +5V + GND | U2C power labels at (342.90, 217.17) and (342.90, 232.41) — only 15.24mm apart vertically. Two 7.62mm stubs pointing toward each other bridge the gap. |
|
|
|
|
Also a dangling wire near C7 and `pin_to_pin` error from FLG01/FLG03 stub overlap.
|
|
|
|
Reverted to the committed schematic (built with old 2.54mm stubs) — clean ERC again.
|
|
|
|
## Root cause
|
|
|
|
The 7.62mm stub works well for isolated components with generous spacing, but fails on:
|
|
|
|
1. **Small passives** (resistors, caps) where pin-to-pin distance is ~5mm — the stub is longer than the component
|
|
2. **Vertically stacked labels** on the same X column (like U2C's +5V/GND) where opposing stubs meet
|
|
3. **Pull-up/pull-down resistors** where power and signal labels are on the same 2-pin component
|
|
|
|
## Request: collision-aware stub length
|
|
|
|
Rather than a fixed default, the stub placement could check whether the proposed wire endpoint would land on or cross an existing wire, net, or component body. If it would, shorten the stub to `max(2.54, clearance - 1.27)` — keeping at least one grid unit of stub but avoiding the bridge.
|
|
|
|
The collision detection infrastructure already exists — `apply_batch` reports `collisions_resolved` and `wire_collisions_resolved`. The wire collision resolver shortened one wire in this build but didn't catch the label stub collisions.
|
|
|
|
### Proposed behavior
|
|
|
|
```
|
|
for each label stub:
|
|
proposed_end = pin_position + direction * stub_length
|
|
if proposed_end collides with existing geometry:
|
|
stub_length = distance_to_nearest_obstacle - 1.27mm
|
|
stub_length = max(stub_length, 2.54mm) # minimum 1 grid unit
|
|
```
|
|
|
|
This would let the default stay at 7.62mm for components with room, while auto-shortening on tight passives and stacked labels. Existing `stub_length` per-connection overrides would still work as explicit escape hatches.
|
|
|
|
### Interim workaround
|
|
|
|
We're staying on the committed schematic (2.54mm stubs from the previous server version). Could also add explicit `"stub_length": 2.54` to each `label_connections` group, but that defeats the purpose of the improvement.
|