Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 12 additions & 6 deletions src/fn/vson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,27 @@ 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 mirror the sibling son/wson SON-family footprints so a bare `vsonN`
// renders instead of throwing a raw parse error; pass explicit dims to override
// for a specific part.
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.5mm")
.describe("pitch (distance between center of each pin)"),
w: length.default("3mm").describe("width between vertical rows of pins"),
grid: dim2d
.default("2x3mm")
.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.6mm").describe("width of the pin pads"),
pinh: length.default("0.28mm").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.
13 changes: 13 additions & 0 deletions tests/vson8.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { test, expect } from "bun:test"
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
import { fp } from "../src/footprinter"

test("vson8 renders from a bare name", () => {
// vson is advertised by getFootprintNames() and its siblings son8/wson8 render
// from a bare name; vson8 used to throw a raw parse error for missing dims.
const soup = fp.string("vson8").circuitJson()
const pads = soup.filter((e) => e.type === "pcb_smtpad")
expect(pads.length).toBe(8)
const svgContent = convertCircuitJsonToPcbSvg(soup)
expect(svgContent).toMatchSvgSnapshot(import.meta.path, "vson8")
})
Loading