Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/fn/vson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,29 @@ import { dim2d } from "src/helpers/zod/dim-2d"
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.

// Defaults describe the canonical KiCad VSON-8-1EP 3x3mm 0.65mm-pitch part
// (Package_SON VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm) so a bare `vsonN` renders
// instead of throwing a raw parse error; pass explicit dims to override for a
// specific part. The exposed pad is left at 0 so a bare `vson8` stays 8 pads;
// add `ep` for a part that needs the thermal pad.
export const vson_def = base_def.extend({
fn: z.string(),
num_pins: z.number().optional().default(8),
p: distance.describe("pitch (distance between center of each pin)"),
w: length.describe("width between vertical rows of pins"),
grid: dim2d.describe("width and height of the border of the footprint"),
p: distance
.default("0.65mm")
.describe("pitch (distance between center of each pin)"),
w: length.default("2.9mm").describe("width between vertical rows of pins"),
grid: dim2d
.default("3x3mm")
.describe("width and height of the border of the footprint"),
ep: dim2d
.default("0x0mm")
.describe("width and height of the central exposed thermal pad"),
epx: length
.default("0mm")
.describe("x offset of the center of the central exposed thermal pad"),
pinw: length.describe("width of the pin pads"),
pinh: length.describe("height of the pin pads"),
pinw: length.default("0.85mm").describe("width of the pin pads"),
pinh: length.default("0.35mm").describe("height of the pin pads"),
})

export type VsonDefInput = z.input<typeof vson_def>
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/vson8.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/kicad-parity/__snapshots__/vson8_default.snap.svg

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.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading