Skip to content

fix: default vson dimensions so vson8 renders from a bare name - #783

Open
zkasuran wants to merge 2 commits into
tscircuit:mainfrom
zkasuran:fix/vson-default-dimensions
Open

fix: default vson dimensions so vson8 renders from a bare name#783
zkasuran wants to merge 2 commits into
tscircuit:mainfrom
zkasuran:fix/vson-default-dimensions

Conversation

@zkasuran

@zkasuran zkasuran commented Aug 8, 2026

Copy link
Copy Markdown

Closes #782

vson is advertised by getFootprintNames(), but fp.string("vson8").circuitJson() throws a raw ZodError because vson_def declares p, w, grid, pinw and pinh with no defaults. The sibling SON-family defs (son_def, wson_def) default every dimension and render from a bare name, so son8 and wson8 work while vson8 crashes.

Repro

fp.string("vson8").circuitJson() // throws on main
fp.string("son8").circuitJson()  // 8 pads

The change

Give vson_def defaults that describe the canonical KiCad VSON-8-1EP 3x3mm 0.65mm-pitch part (Package_SON.pretty/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm): pitch 0.65mm, row spacing 2.9mm, 3x3mm body, 0.85mm by 0.35mm pads. A bare vson8 now renders 8 pads like son8 and wson8. Its courtyard also lines up with that real KiCad footprint. Explicit dimensions still override for a specific part. The exposed pad default stays 0 so a bare vson8 keeps 8 pads; pass ep for a part that needs the thermal pad. The old "can't use defaults" comment is dropped, since son and wson show the SON family does have workable defaults.

Verification

  • tests/vson8.test.ts renders vson8 to a PCB SVG snapshot and asserts 8 pads.
  • tests/kicad-parity/vson8_kicad_parity.test.ts adds a parity case for the bare vson8 against the KiCad VSON-8-1EP reference. Courtyard diff is 0.19%, under the 0.5 threshold the other SON parity tests use.
  • Full suite green (523 pass), bun run build clean, biome format clean.

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: the full bun test suite (523 pass), bun run build and biome format.

@techmannih techmannih left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add kicad parity test

Adds a parity case for the bare `vson8` name against the canonical KiCad
VSON-8-1EP 3x3mm 0.65mm-pitch reference (Package_SON
VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm). Tunes the vson defaults to that
part (p 0.65mm, w 2.9mm, grid 3x3mm, pinw 0.85mm, pinh 0.35mm) so the
default courtyard lines up with KiCad at 0.19% diff, the same metric the
other parity tests assert. The exposed pad stays 0 so a bare `vson8`
keeps 8 pads and tests/vson8.test.ts stays valid.
@zkasuran

zkasuran commented Aug 8, 2026

Copy link
Copy Markdown
Author

Added the kicad parity test. It compares the bare vson8 (the new defaults) against the canonical KiCad VSON-8-1EP 3x3mm 0.65mm-pitch part, Package_SON.pretty/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm. It lives in tests/kicad-parity/vson8_kicad_parity.test.ts next to the existing explicit-dims case.

To make the defaults match a real part I retuned them to that VSON-8: pitch 0.65mm, row spacing 2.9mm, 3x3mm body, 0.85mm by 0.35mm pads. Courtyard diff comes out at 0.19%, under the 0.5 threshold the other SON parity tests assert. The 8 pins are dimensionally identical to KiCad's.

I kept the exposed pad at 0 so a bare vson8 stays 8 pads and tests/vson8.test.ts remains valid. That is the one thing that differs from the KiCad part, which carries a 1.65x2.4mm thermal pad, so the pad-area label in the overlay reads high while the pins and courtyard match. Happy to fold the EP into the default if you would rather the bare name include the thermal pad.

Full suite is green (523 pass), bun run build and biome format clean.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we missing thermal pad, is it default?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thermal pad is deliberately opt-in via ep, not part of the bare default. Its size is part-specific, so a fixed default overflows smaller VSON bodies. Concretely, defaulting ep to the 3x3mm part's 1.65x2.4mm makes the existing VSON8_grid1.5x2mm test render a pad bigger than its own 1.5x2mm body.

So a bare vson8 renders the 8 signal pins plus the matching courtyard; the parity sits at 0.19% because the EP falls inside the courtyard. Pass ep=1.65x2.4mm to add the thermal pad for the full 1EP part. This matches the sibling son8, which also defaults its EP off.

If you would prefer the bare vson8 to be the full VSON-8-1EP, I can default the EP on and scale it to the body so smaller parts do not overflow. Your call.

Comment thread src/fn/vson.ts
import { type SilkscreenRef, silkscreenRef } from "src/helpers/silkscreenRef"
import { createRectUnionOutline } from "src/helpers/rect-union-outline"

// can't use defaults because there is not a lot of common dimensions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?????

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These defaults are one specific real part, the canonical KiCad VSON-8-1EP 3x3mm 0.65mm-pitch (Package_SON/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm), not a claim that every VSON shares those dims. The old comment was right that VSON dims vary, so instead of inventing an average I anchored the bare-name default to that one canonical part and pinned it with a KiCad parity test (courtyard 0.19%).

A bare vson8 now renders that real part instead of throwing; any other VSON is still just a matter of passing explicit dims. Same pattern the other defaulted footprint fns use.

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.

vson8 throws a raw parse error while son8/wson8 render from a bare name

3 participants