From cc861cfaeb341511ff1bb365f49d7779e3de6ee7 Mon Sep 17 00:00:00 2001 From: Padmanabha Das <82430454+chayan-1906@users.noreply.github.com> Date: Fri, 3 Jul 2026 11:48:17 +0530 Subject: [PATCH 1/4] fix: number msop right-column pins counterclockwise Co-Authored-By: Claude Fable 5 --- src/fn/msop.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fn/msop.ts b/src/fn/msop.ts index e0d899c4..91d4e8d8 100644 --- a/src/fn/msop.ts +++ b/src/fn/msop.ts @@ -64,7 +64,9 @@ const getMsopCoords = (pinCount: number, pn: number, w: number, p: number) => { const half = pinCount / 2 const rowIndex = (pn - 1) % half const col = pn <= half ? -1 : 1 - const row = (half - 1) / 2 - rowIndex + // Pins are numbered counterclockwise: the left column runs top to bottom, + // the right column runs bottom to top + const row = col === -1 ? (half - 1) / 2 - rowIndex : rowIndex - (half - 1) / 2 return { x: col * length.parse("2mm"), From 3f8ca04fb92e27fd14fe9d1a0288eee98814a3e2 Mon Sep 17 00:00:00 2001 From: Padmanabha Das <82430454+chayan-1906@users.noreply.github.com> Date: Fri, 3 Jul 2026 11:49:33 +0530 Subject: [PATCH 2/4] fix: number son right-column pins counterclockwise Co-Authored-By: Claude Fable 5 --- src/fn/son.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fn/son.ts b/src/fn/son.ts index d27441ad..4f143eef 100644 --- a/src/fn/son.ts +++ b/src/fn/son.ts @@ -170,7 +170,9 @@ export const getSonPadCoord = ( const half = num_pins / 2 const rowIndex = (pn - 1) % half const col = pn <= half ? -1 : 1 - const row = (half - 1) / 2 - rowIndex + // Pins are numbered counterclockwise: the left column runs top to bottom, + // the right column runs bottom to top + const row = col === -1 ? (half - 1) / 2 - rowIndex : rowIndex - (half - 1) / 2 return { x: col * length.parse("1.4mm"), From 630a859fc35fa16ed219fc76b919db019734b54f Mon Sep 17 00:00:00 2001 From: Padmanabha Das <82430454+chayan-1906@users.noreply.github.com> Date: Fri, 3 Jul 2026 11:50:09 +0530 Subject: [PATCH 3/4] test: assert counterclockwise pin numbering for msop8 Co-Authored-By: Claude Fable 5 --- tests/msop.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/msop.test.ts b/tests/msop.test.ts index 5d595b19..92618a20 100644 --- a/tests/msop.test.ts +++ b/tests/msop.test.ts @@ -52,3 +52,16 @@ test("msop16", () => { const svgContent = convertCircuitJsonToPcbSvg(circuitJson) expect(svgContent).toMatchSvgSnapshot(import.meta.path, "msop16") }) + +test("msop8 pins are numbered counterclockwise", () => { + const circuitJson = fp.string("msop8").circuitJson() as any[] + const pad = (pin: string) => + circuitJson.find( + (el) => el.type === "pcb_smtpad" && el.port_hints?.[0] === pin, + ) + // Pins 1-4 run down the left side, pins 5-8 run up the right side, + // so pin 5 sits across from pin 4 and pin 8 across from pin 1 + expect(pad("5").y).toBeCloseTo(pad("4").y) + expect(pad("8").y).toBeCloseTo(pad("1").y) + expect(pad("5").y).toBeLessThan(pad("8").y) +}) From bfe83a0f09e4d4358bac7089d46e4b87ab3c9e3e Mon Sep 17 00:00:00 2001 From: Padmanabha Das <82430454+chayan-1906@users.noreply.github.com> Date: Fri, 3 Jul 2026 11:51:16 +0530 Subject: [PATCH 4/4] test: assert counterclockwise pin numbering for son8 and son6 Co-Authored-By: Claude Fable 5 --- tests/son.test.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/son.test.ts b/tests/son.test.ts index aa11a5ad..a1e50ad7 100644 --- a/tests/son.test.ts +++ b/tests/son.test.ts @@ -68,3 +68,29 @@ test("son6", () => { const svgContent = convertCircuitJsonToPcbSvg(circuitJson) expect(svgContent).toMatchSvgSnapshot(import.meta.path, "son6") }) + +test("son8 pins are numbered counterclockwise", () => { + const circuitJson = fp.string("son8").circuitJson() as any[] + const pad = (pin: string) => + circuitJson.find( + (el) => el.type === "pcb_smtpad" && el.port_hints?.[0] === pin, + ) + // Pins 1-4 run down the left side, pins 5-8 run up the right side, + // so pin 5 sits across from pin 4 and pin 8 across from pin 1 + expect(pad("5").y).toBeCloseTo(pad("4").y) + expect(pad("8").y).toBeCloseTo(pad("1").y) + expect(pad("5").y).toBeLessThan(pad("8").y) +}) + +test("son6 pins are numbered counterclockwise", () => { + const circuitJson = fp.string("son6").circuitJson() as any[] + const pad = (pin: string) => + circuitJson.find( + (el) => el.type === "pcb_smtpad" && el.port_hints?.[0] === pin, + ) + // Pins 1-3 run down the left side, pins 4-6 run up the right side, + // so pin 4 sits across from pin 3 and pin 6 across from pin 1 + expect(pad("4").y).toBeCloseTo(pad("3").y) + expect(pad("6").y).toBeCloseTo(pad("1").y) + expect(pad("4").y).toBeLessThan(pad("6").y) +})