diff --git a/src/fn/sop8.ts b/src/fn/sop8.ts index 8e855491..93861fd3 100644 --- a/src/fn/sop8.ts +++ b/src/fn/sop8.ts @@ -1,15 +1,20 @@ -import type { AnySoupElement, PcbSilkscreenPath } from "circuit-json" +import type { AnyCircuitElement, PcbSilkscreenPath } from "circuit-json" import { extendSoicDef, type SoicInput, getCcwSoicCoords } from "./soic" import { rectpad } from "src/helpers/rectpad" import { type SilkscreenRef, silkscreenRef } from "src/helpers/silkscreenRef" -export const sop8_def = extendSoicDef({}) +export const sop8_def = extendSoicDef({ + w: "7.05mm", + p: "1.27mm", + pw: "0.65mm", + pl: "1.975mm", +}) export const sop8 = ( raw_params: SoicInput, -): { circuitJson: AnySoupElement[]; parameters: any } => { +): { circuitJson: AnyCircuitElement[]; parameters: any } => { const parameters = sop8_def.parse(raw_params) - const pads: AnySoupElement[] = [] + const pads: AnyCircuitElement[] = [] for (let i = 0; i < parameters.num_pins; i++) { const { x, y } = getCcwSoicCoords({ @@ -26,11 +31,7 @@ export const sop8 = ( } const sh = (parameters.num_pins / 2 - 1) * parameters.p + parameters.pw - const silkscreenRefText: SilkscreenRef = silkscreenRef( - 0, - sh / 2 - 0.5, - sh / 12, - ) + const silkscreenRefText: SilkscreenRef = silkscreenRef(0, sh / 2 + 1, sh / 12) const silkscreenLine: PcbSilkscreenPath = { layer: "top", @@ -38,8 +39,8 @@ export const sop8 = ( pcb_silkscreen_path_id: "", type: "pcb_silkscreen_path", route: [ - { x: -parameters.w / 3, y: sh / 2 + 0.2 }, - { x: parameters.w / 3, y: sh / 2 + 0.2 }, + { x: -parameters.w / 3, y: sh / 2 + 0.4 }, + { x: parameters.w / 3, y: sh / 2 + 0.4 }, ], stroke_width: 0.1, } @@ -49,7 +50,7 @@ export const sop8 = ( ...pads, silkscreenRefText, silkscreenLine, - ] as AnySoupElement[], + ] as AnyCircuitElement[], parameters, } } diff --git a/tests/__snapshots__/sop8.snap.svg b/tests/__snapshots__/sop8.snap.svg index 97cfee4a..bad2e9f8 100644 --- a/tests/__snapshots__/sop8.snap.svg +++ b/tests/__snapshots__/sop8.snap.svg @@ -1 +1 @@ -{REF} \ No newline at end of file +{REF} \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/sop-8.snap.svg b/tests/kicad-parity/__snapshots__/sop-8.snap.svg new file mode 100644 index 00000000..130c3b40 --- /dev/null +++ b/tests/kicad-parity/__snapshots__/sop-8.snap.svg @@ -0,0 +1 @@ +{REF}Diff: 0.00% \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/sop-8_boolean_difference.snap.svg b/tests/kicad-parity/__snapshots__/sop-8_boolean_difference.snap.svg new file mode 100644 index 00000000..eea12f8f --- /dev/null +++ b/tests/kicad-parity/__snapshots__/sop-8_boolean_difference.snap.svg @@ -0,0 +1 @@ +SOP-8_3.76x4.96mm_P1.27mm - Alignment Analysis (Footprinter vs KiCad)sop8KiCad: SOP-8_3.76x4.96mm_P1.27mmPerfect alignment = complete overlap \ No newline at end of file diff --git a/tests/kicad-parity/sop8_kicad_parity.test.ts b/tests/kicad-parity/sop8_kicad_parity.test.ts new file mode 100644 index 00000000..5845d99d --- /dev/null +++ b/tests/kicad-parity/sop8_kicad_parity.test.ts @@ -0,0 +1,18 @@ +import { expect, test } from "bun:test" +import { compareFootprinterVsKicad } from "../fixtures/compareFootprinterVsKicad" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" + +test("parity/sop-8", async () => { + const { avgRelDiff, combinedFootprintElements, booleanDifferenceSvg } = + await compareFootprinterVsKicad( + "sop8", + "Package_SO.pretty/SOP-8_3.76x4.96mm_P1.27mm.circuit.json", + ) + + const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements) + expect(svgContent).toMatchSvgSnapshot(import.meta.path, "sop-8") + expect(booleanDifferenceSvg).toMatchSvgSnapshot( + import.meta.path, + "sop-8_boolean_difference", + ) +})