Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/fn/msop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,21 @@ export const msop_def = base_def.extend({
string: z.string().optional(),
})

const getMsopCoords = (pinCount: number, pn: number, w: number, p: number) => {
const getMsopCoords = (
pinCount: number,
pn: number,
w: number,
p: number,
pl: number,
) => {
const half = pinCount / 2
const rowIndex = (pn - 1) % half
const col = pn <= half ? -1 : 1
const row = (half - 1) / 2 - rowIndex
const padBodyOverlap = length.parse("0.2mm")

return {
x: col * length.parse("2mm"),
x: col * (w / 2 + pl / 2 - padBodyOverlap),
y: row * p,
}
}
Expand All @@ -87,7 +94,7 @@ export const msop = (
const pads: AnyCircuitElement[] = []

for (let i = 0; i < parameters.num_pins; i++) {
const { x, y } = getMsopCoords(parameters.num_pins, i + 1, w, p)
const { x, y } = getMsopCoords(parameters.num_pins, i + 1, w, p, pl)
pads.push(rectpad(i + 1, x, y, pl, pw))
}

Expand Down Expand Up @@ -123,6 +130,7 @@ export const msop = (
1,
silkscreenBoxWidth,
p,
pl,
)

const pin1MarkerPosition = {
Expand Down
2 changes: 1 addition & 1 deletion tests/__snapshots__/msop10.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/__snapshots__/msop12.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading