Skip to content

fix(pinrow): pitch-aware id/od defaults so 1.27 mm headers don't overlap#625

Open
gsdali wants to merge 1 commit into
tscircuit:mainfrom
gsdali:fix-pinrow-pitch-aware-defaults
Open

fix(pinrow): pitch-aware id/od defaults so 1.27 mm headers don't overlap#625
gsdali wants to merge 1 commit into
tscircuit:mainfrom
gsdali:fix-pinrow-pitch-aware-defaults

Conversation

@gsdali
Copy link
Copy Markdown

@gsdali gsdali commented May 6, 2026

Summary

pinrow's default id="1.0mm" / od="1.5mm" are tuned for the 0.1in (2.54 mm) pitch and produce fab-breaking overlap at smaller pitches. Concretely, at the standard ARM Cortex Debug pitch of 1.27 mm with default od=1.5mm, adjacent plated holes overlap by 0.23 mm.

Fix

Make id and od optional in the schema; compute defaults from pitch in the transform:

// Pitch-aware id/od defaults. Backward-compatible at 2.54 mm pitch.
const od = data.od ?? Math.min(1.5, data.p - 0.27)
const id = data.id ?? Math.min(1.0, od - 0.4)
Pitch New default od New default id Notes
2.54 mm (0.1") 1.5 mm 1.0 mm Unchanged — backward compatible
2.0 mm 1.5 mm 1.0 mm Still fits with 0.5 mm clearance
1.27 mm (0.05", Cortex Debug) 1.0 mm 0.6 mm Matches generic JLCPCB 1.27 mm headers (e.g. ZX_PZ1_27_2_5PZZ)
explicit user values honoured honoured No override of explicit id/od at any pitch

Test plan

  • All 25 existing pinrow tests pass unchanged (default-pitch behaviour preserved)
  • New tests/pinrow_pitch_aware_defaults.test.ts adds:
    • default pitch backward-compat (p=2.54mmid=1.0/od=1.5)
    • small-pitch defaults scale down (p=1.27mmod ≤ p − 0.2, annular ring ≥ 0.3 mm)
    • explicit id/od override defaults at any pitch
  • bun test: 415 pass (one flaky timeout in slop1.test.ts unrelated to this change, passed on rerun)
  • bun run format: clean

Repro

<board width="22mm" height="20mm">
  <pinheader name="J1" pinCount={10} pitch="1.27mm" doubleRow />
</board>

Before this PR, tsci build reports the resulting plated holes as 1.5 mm OD and they overlap. With this PR, defaults become 1.0 mm OD / 0.6 mm drill — same as the typical JLCPCB Cortex Debug header SKU.

🤖 Generated with Claude Code

The previous hardcoded defaults `id="1.0mm"` and `od="1.5mm"` were
tuned for the standard 0.1in (2.54 mm) pitch. They produce
fab-breaking overlap on smaller pitches:

  pitch 1.27 mm + od 1.5 mm = -0.23 mm copper-to-copper clearance

i.e. adjacent plated holes overlap by 0.23 mm. Visible on every
2x5 1.27 mm Cortex Debug header generated with the default
pinheader at the moment.

Make `id` and `od` optional in the schema; compute defaults from
pitch in the transform:

  od_default = min(1.5 mm, p − 0.27 mm)
               # 0.27 mm copper-to-copper minimum (matches generic
               # JLCPCB 1.27 mm headers like ZX_PZ1_27_2_5PZZ)
  id_default = min(1.0 mm, od − 0.4 mm)
               # ≥ 0.5 mm annular ring (≥ IPC class 2 minimum)

At p=2.54 mm: od=1.5 / id=1.0 (unchanged — backward compatible).
At p=1.27 mm: od=1.0 / id=0.6 (matches Cortex Debug header standard).
At p=2.0 mm:  od=1.5 / id=1.0 (still fits with 0.5 mm clearance).

User-supplied `id`/`od` are honoured at any pitch (no override of
explicit values).

Tests:
- All 25 existing pinrow tests pass unchanged (default-pitch
  behaviour preserved).
- Add `tests/pinrow_pitch_aware_defaults.test.ts` with three cases:
  default pitch backward-compat, 1.27 mm pitch defaults scale down,
  explicit values override defaults at any pitch.

Hit while building an InsightSiP ISP3080-UX daughter board where
the only viable Cortex Debug header path was to import a JLCPCB
SKU. Default `<pinheader pitch="1.27mm" doubleRow>` was unusable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant