fix(fpc): default pin count to 12 so a bare fpc renders (#786) - #787
fix(fpc): default pin count to 12 so a bare fpc renders (#786)#787zkasuran wants to merge 2 commits into
Conversation
num_pins had no default, so fp.string("fpc") threw a raw Zod parse
error on NaN. Every other pin-count footprint defaults its count, so
fpc was the only one that failed on a bare name. The fpc defaults are
already tuned to the 12-pin FPC-05F-12PH20 part, so default num_pins
to 12 and add a regression test plus an SVG snapshot.
The bare fpc default (12 contacts at 0.5mm pitch, 0.3mm wide) matches the shared KiCad 0.5mm 12-pin FFC land pattern. Pin it to that pattern using Hirose FH12-12S-0.5SH as the reference, then overlay both for a snapshot. Courtyard parity is not asserted: footprinter models only the pads while a KiCad FFC courtyard encloses the vendor-specific connector housing.
|
Added one, though it needs a caveat because KiCad has no single canonical FPC footprint. Every part in
It deliberately does not assert courtyard parity, unlike the sibling tests. Footprinter draws a pad-bounding-box courtyard (11.38 x 4.95mm); the KiCad courtyard encloses the connector body (12.12 x 7.9mm on the Hirose part). Measured courtyard IoU against the four nearest KiCad 12-pin 0.5mm parts (Hirose FH12-12S-0.5SH, Amphenol F32Q/F32R-1A7x1-11012, TE 1-1734839-2) is 47 to 67% (diff 34 to 53%), all of it the housing, which footprinter does not model and which differs by vendor. The other parity tests assert well under 5%, so a courtyard bound here would either fail or be a made-up number that certifies nothing. Verified locally: If you would rather point it at a different reference part or record the courtyard as a documented non-gating number, happy to adjust. |
Summary
fpc's pin count to 12 so the barefpcname renders instead of throwing a raw Zod parse errorfpcproduces the 12-pin FPC-05F-12PH20 layout, with an SVG snapshotCloses #786
Motivation
fp.string("fpc").circuitJson()threw aZodErroronnum_pinsbecause the schema had no default. Every other pin-count footprint defaults its count (bga 64, quad 64, ssop 8, dip 6, lga 14, son 8, sot223 4, the two-pin parts 2), sofpcwas the only one that failed on a bare name.The
fpcdimensional defaults are already built around a 12-pin part. The existingfpc12test reproduces FPC-05F-12PH20 from the schema defaults alone, so 12 is the count the rest of the schema was tuned for.Implementation
One line in
src/fn/fpc.ts:The default only applies when no count is given, so
fpc12,fpc30_staggeredand every explicit form stay unchanged. Barefpcnow resolves to the same geometry as the explicitfpc12reference.On KiCad parity
The part this footprint models, FPC-05F-12PH20, is not in the KiCad cache. The nearest 12-pin 0.5mm entry there is a different manufacturer part, Hirose FH12-12S-0.5SH, whose mounting pads sit at ±4.65 (ours at ±4.44) with a different body origin. A parity run against it gives a 41% courtyard difference. Matching it would distort the FPC-05F-12PH20 geometry the repo already asserts. So this test follows the existing fpc test style: a hardcoded copper-pattern check against the reference part plus an SVG snapshot, not a kicad-parity test.
Validation
bun test: 522 pass, 0 failbun run build: successbiome format: cleanfpcrenders 14 pads matching the explicitfpc12(FPC-05F-12PH20) reference, plus a new SVG snapshotAI disclosure
AI assistance (Claude, Anthropic) was used in developing this change. The design, review and verification were done by the author. Verified locally before submitting:
bun test(522 pass, 0 fail),bun run buildandbiome format.