diff --git a/src/fn/lcc.ts b/src/fn/lcc.ts index dbd7447c..3f5b778d 100644 --- a/src/fn/lcc.ts +++ b/src/fn/lcc.ts @@ -8,6 +8,11 @@ export const lcc = ( parameters: z.input, ): { circuitJson: AnySoupElement[]; parameters: any } => { parameters.legsoutside = false + // Standard LCC/PLCC lead pitch is 1.27mm; quad's 0.5mm default leaves + // 0.6mm-wide pads overlapping by 0.1mm along the column. + if (!parameters.p) { + parameters.p = 1.27 + } if (!parameters.pl) { parameters.pl = 1.0 } diff --git a/tests/lcc.test.ts b/tests/lcc.test.ts index 942d2dca..40843c5f 100644 --- a/tests/lcc.test.ts +++ b/tests/lcc.test.ts @@ -11,3 +11,37 @@ test("lcc68", () => { expect(svgContent).toMatchSvgSnapshot(import.meta.path, "lcc68") }) + +test("lcc pads do not overlap along the pitch axis", () => { + for (const name of ["lcc20", "lcc44"]) { + const pads = fp + .string(name) + .circuitJson() + .filter((el: any) => el.type === "pcb_smtpad") as any[] + + const maxX = Math.max(...pads.map((p) => p.x)) + const colPads = pads.filter((p) => Math.abs(p.x - maxX) < 0.01) + const col = colPads.map((p) => p.y).sort((a: number, b: number) => b - a) + const maxExtent = Math.max(...colPads.map((p) => p.height)) + + for (let i = 1; i < col.length; i++) { + expect( + col[i - 1] - col[i], + `${name}: adjacent pads overlap`, + ).toBeGreaterThanOrEqual(maxExtent) + } + } +}) + +test("lcc default pitch is 1.27mm", () => { + const pads = fp + .string("lcc44") + .circuitJson() + .filter((el: any) => el.type === "pcb_smtpad") as any[] + const maxX = Math.max(...pads.map((p) => p.x)) + const col = pads + .filter((p) => Math.abs(p.x - maxX) < 0.01) + .map((p) => p.y) + .sort((a: number, b: number) => b - a) + expect(Math.round((col[0] - col[1]) * 1000) / 1000).toBe(1.27) +})