diff --git a/src/fn/lcc.ts b/src/fn/lcc.ts index dbd7447c..6d93cdb6 100644 --- a/src/fn/lcc.ts +++ b/src/fn/lcc.ts @@ -8,6 +8,9 @@ export const lcc = ( parameters: z.input, ): { circuitJson: AnySoupElement[]; parameters: any } => { parameters.legsoutside = false + if (!parameters.p) { + parameters.p = 1.27 + } if (!parameters.pl) { parameters.pl = 1.0 } diff --git a/tests/lcc-pitch.test.ts b/tests/lcc-pitch.test.ts new file mode 100644 index 00000000..b5e3b9a3 --- /dev/null +++ b/tests/lcc-pitch.test.ts @@ -0,0 +1,22 @@ +import { test, expect } from "bun:test" +import { fp } from "../src/index" + +test("lcc defaults to standard 1.27mm pitch without overlapping pads (#794)", () => { + const elements = fp.string("lcc44").circuitJson() + const smtpads = elements.filter( + (e: any) => e.type === "pcb_smtpad", + ) as Array + + expect(smtpads.length).toBe(44) + + // Pin 1 and Pin 2 on the left side + const pin1 = smtpads.find((p) => p.port_hints?.includes("1"))! + const pin2 = smtpads.find((p) => p.port_hints?.includes("2"))! + + expect(pin1).toBeDefined() + expect(pin2).toBeDefined() + + const pitch = Math.abs(pin1.y - pin2.y) + expect(pitch).toBeCloseTo(1.27, 2) + expect(pin1.height).toBeLessThanOrEqual(pitch) +})