diff --git a/src/fn/soic.ts b/src/fn/soic.ts index a324887b..32e985eb 100644 --- a/src/fn/soic.ts +++ b/src/fn/soic.ts @@ -1,4 +1,4 @@ -import type { AnySoupElement, PcbSilkscreenPath } from "circuit-json" +import type { AnyCircuitElement, PcbSilkscreenPath } from "circuit-json" import { z } from "zod" import { length } from "circuit-json" import type { NowDefined } from "../helpers/zod/now-defined" @@ -23,8 +23,8 @@ export const extendSoicDef = (newDefaults: { num_pins: z.number().optional().default(8), w: length.default(length.parse(newDefaults.w ?? "5.3mm")), p: length.default(length.parse(newDefaults.p ?? "1.27mm")), - pw: length.default(length.parse(newDefaults.pw ?? "0.6mm")), - pl: length.default(length.parse(newDefaults.pl ?? "1.0mm")), + pw: length.default(length.parse(newDefaults.pw ?? "0.65mm")), + pl: length.default(length.parse(newDefaults.pl ?? "1.67mm")), legsoutside: z .boolean() .optional() @@ -38,12 +38,12 @@ export const extendSoicDef = (newDefaults: { .transform((v) => { // Default inner diameter and outer diameter if (!v.pw && !v.pl) { - v.pw = length.parse("0.6mm") - v.pl = length.parse("1.0mm") + v.pw = length.parse("0.65mm") + v.pl = length.parse("1.67mm") } else if (!v.pw) { - v.pw = v.pl! * (0.6 / 1.0) + v.pw = v.pl! * (0.65 / 1.67) } else if (!v.pl) { - v.pl = v.pw! * (1.0 / 0.6) + v.pl = v.pw! * (1.67 / 0.65) } return v as NowDefined< @@ -80,7 +80,7 @@ export const getCcwSoicCoords = (parameters: { const h = gs * leftPinGaps - const legoffset = legsoutside ? pl / 2 : -pl / 2 + const legoffset = legsoutside ? pl / 2 + 0.23 : -(pl / 2 + 0.23) if (isLeft) { // The y position starts at h/2, then goes down by gap size @@ -101,16 +101,18 @@ export const soic = (raw_params: { p?: number id?: string | number od?: string | number -}): { circuitJson: AnySoupElement[]; parameters: SoicInput } => { +}): { circuitJson: AnyCircuitElement[]; parameters: SoicInput } => { const parameters = soic_def.parse(raw_params) return { - circuitJson: soicWithoutParsing(parameters) as AnySoupElement[], + circuitJson: soicWithoutParsing(parameters) as AnyCircuitElement[], parameters, } } export const soicWithoutParsing = (parameters: z.infer) => { - const pads: AnySoupElement[] = [] + const pads: AnyCircuitElement[] = [] + const rectPadLength = parameters.pl + const rectPadWidth = parameters.pw for (let i = 0; i < parameters.num_pins; i++) { const { x, y } = getCcwSoicCoords({ num_pins: parameters.num_pins, @@ -121,16 +123,16 @@ export const soicWithoutParsing = (parameters: z.infer) => { legsoutside: parameters.legsoutside, }) if (parameters.pillpads) { - pads.push(pillpad(i + 1, x, y, parameters.pl, parameters.pw)) + pads.push(pillpad(i + 1, x, y, rectPadLength, rectPadWidth)) } else { - pads.push(rectpad(i + 1, x, y, parameters.pl, parameters.pw)) + pads.push(rectpad(i + 1, x, y, rectPadLength, rectPadWidth)) } } /** silkscreen width */ const m = Math.min(1, parameters.p / 2) const sw = - parameters.w - (parameters.legsoutside ? 0 : parameters.pl * 2) - 0.2 + parameters.w - (parameters.legsoutside ? 0 : parameters.pl * 2) - 0.8 const sh = (parameters.num_pins / 2 - 1) * parameters.p + parameters.pw + m const silkscreenRefText: SilkscreenRef = silkscreenRef( 0, @@ -157,5 +159,5 @@ export const soicWithoutParsing = (parameters: z.infer) => { ], } - return [...pads, silkscreenBorder, silkscreenRefText] as AnySoupElement[] + return [...pads, silkscreenBorder, silkscreenRefText] as AnyCircuitElement[] } diff --git a/src/fn/sop8.ts b/src/fn/sop8.ts index 93861fd3..1cc9e9c4 100644 --- a/src/fn/sop8.ts +++ b/src/fn/sop8.ts @@ -4,7 +4,7 @@ import { rectpad } from "src/helpers/rectpad" import { type SilkscreenRef, silkscreenRef } from "src/helpers/silkscreenRef" export const sop8_def = extendSoicDef({ - w: "7.05mm", + w: "7.50mm", p: "1.27mm", pw: "0.65mm", pl: "1.975mm", diff --git a/tests/__snapshots__/dfn8_w5.3mm_p1.27mm.snap.svg b/tests/__snapshots__/dfn8_w5.3mm_p1.27mm.snap.svg index abcc3208..b54a3a77 100644 --- a/tests/__snapshots__/dfn8_w5.3mm_p1.27mm.snap.svg +++ b/tests/__snapshots__/dfn8_w5.3mm_p1.27mm.snap.svg @@ -1 +1 @@ -{REF} \ No newline at end of file +{REF} \ No newline at end of file diff --git a/tests/__snapshots__/ms012.snap.svg b/tests/__snapshots__/ms012.snap.svg index 0b439772..038aba20 100644 --- a/tests/__snapshots__/ms012.snap.svg +++ b/tests/__snapshots__/ms012.snap.svg @@ -1 +1 @@ -{REF} \ No newline at end of file +{REF} \ No newline at end of file diff --git a/tests/__snapshots__/ms013.snap.svg b/tests/__snapshots__/ms013.snap.svg index 65532eb6..6dd981aa 100644 --- a/tests/__snapshots__/ms013.snap.svg +++ b/tests/__snapshots__/ms013.snap.svg @@ -1 +1 @@ -{REF} \ No newline at end of file +{REF} \ No newline at end of file diff --git a/tests/__snapshots__/soic28_pw0762_pl1524.snap.svg b/tests/__snapshots__/soic28_pw0762_pl1524.snap.svg index 785b773a..392f24a7 100644 --- a/tests/__snapshots__/soic28_pw0762_pl1524.snap.svg +++ b/tests/__snapshots__/soic28_pw0762_pl1524.snap.svg @@ -1 +1 @@ -{REF} \ No newline at end of file +{REF} \ No newline at end of file diff --git a/tests/__snapshots__/soic8.snap.svg b/tests/__snapshots__/soic8.snap.svg index 16694027..13af6fdb 100644 --- a/tests/__snapshots__/soic8.snap.svg +++ b/tests/__snapshots__/soic8.snap.svg @@ -1 +1 @@ -{REF} \ No newline at end of file +{REF} \ No newline at end of file diff --git a/tests/__snapshots__/soic8_pw04_pl1_pillpads.snap.svg b/tests/__snapshots__/soic8_pw04_pl1_pillpads.snap.svg index a35fed0d..fa9986b9 100644 --- a/tests/__snapshots__/soic8_pw04_pl1_pillpads.snap.svg +++ b/tests/__snapshots__/soic8_pw04_pl1_pillpads.snap.svg @@ -1 +1 @@ -{REF} \ No newline at end of file +{REF} \ No newline at end of file diff --git a/tests/__snapshots__/soic8_w5.3mm_p1.27mm.snap.svg b/tests/__snapshots__/soic8_w5.3mm_p1.27mm.snap.svg index 16694027..13af6fdb 100644 --- a/tests/__snapshots__/soic8_w5.3mm_p1.27mm.snap.svg +++ b/tests/__snapshots__/soic8_w5.3mm_p1.27mm.snap.svg @@ -1 +1 @@ -{REF} \ No newline at end of file +{REF} \ No newline at end of file diff --git a/tests/__snapshots__/sop8.snap.svg b/tests/__snapshots__/sop8.snap.svg index bad2e9f8..fae97ea7 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/__snapshots__/sot23_6.snap.svg b/tests/__snapshots__/sot23_6.snap.svg index ffe2dea8..010bebba 100644 --- a/tests/__snapshots__/sot23_6.snap.svg +++ b/tests/__snapshots__/sot23_6.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__/soic20.snap.svg b/tests/kicad-parity/__snapshots__/soic20.snap.svg index 87c01834..c7b14263 100644 --- a/tests/kicad-parity/__snapshots__/soic20.snap.svg +++ b/tests/kicad-parity/__snapshots__/soic20.snap.svg @@ -1 +1 @@ -{REF}Diff: 28.80% \ No newline at end of file +{REF}Diff: 0.00% \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/soic20_boolean_difference.snap.svg b/tests/kicad-parity/__snapshots__/soic20_boolean_difference.snap.svg index e2a8ec24..db355df3 100644 --- a/tests/kicad-parity/__snapshots__/soic20_boolean_difference.snap.svg +++ b/tests/kicad-parity/__snapshots__/soic20_boolean_difference.snap.svg @@ -1 +1 @@ -Infineon_SOIC-20W_7.6x12.8mm_P1.27mm - Alignment Analysis (Footprinter vs KiCad)soic20_w7.6mm_p1.27mm_legsoutsideKiCad: Infineon_SOIC-20W_7.6x12.8mm_P1.27mmPerfect alignment = complete overlap \ No newline at end of file +Infineon_SOIC-20W_7.6x12.8mm_P1.27mm - Alignment Analysis (Footprinter vs KiCad)soic20_w7.6mm_p1.27mm_legsoutsideKiCad: Infineon_SOIC-20W_7.6x12.8mm_P1.27mmPerfect alignment = complete overlap \ 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 index 130c3b40..304bdd1c 100644 --- a/tests/kicad-parity/__snapshots__/sop-8.snap.svg +++ b/tests/kicad-parity/__snapshots__/sop-8.snap.svg @@ -1 +1 @@ -{REF}Diff: 0.00% \ No newline at end of file +{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 index eea12f8f..ec0f1c1a 100644 --- a/tests/kicad-parity/__snapshots__/sop-8_boolean_difference.snap.svg +++ b/tests/kicad-parity/__snapshots__/sop-8_boolean_difference.snap.svg @@ -1 +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 +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