-
Notifications
You must be signed in to change notification settings - Fork 50
Implement PDIP-8 footprint #507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Pitrat-wav
wants to merge
27
commits into
tscircuit:main
Choose a base branch
from
Pitrat-wav:implement-pdip8
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
3f82090
Implement PDIP-8 footprint (Issue #371)
2703095
style: fix formatting using biome
7e92d2a
fix: resolve pdip8 test failures by fixing Proxy logic and fn registr…
272d0de
fix: ensure pdip functions are correctly registered and exported
e22d2dd
fix: resolve regex replacement bug and apply consistent formatting
bae0360
fix: correct regex syntax error and apply clean formatting
867ffd8
fix: revert fp to function to maintain backward compatibility while s…
0665c4c
fix: restore fp as a function and fix syntax errors in footprinter.ts
32bb13b
fix: implement hybrid Proxy for fp to support both function calls and…
3e37450
fix: correct test usage of fp() and restore library structure
ab7032f
fix: final test alignment with standard library call pattern
2720891
fix: restore original core logic to fix snapshot regressions while ke…
34ad3e7
fix: clean registration of pdip without breaking existing logic
035db3c
fix: remove duplicate type identifiers in footprinter.ts
85c87c9
fix: final clean registration of pdip without logic regressions
80261e3
fix: carefully add pdip support to proxy without breaking existing fo…
6b92de9
fix: remove duplicate type definitions in Footprinter interface
bb26140
fix: restore default num_pins in dip.ts to fix snapshot regression
697ecd9
fix: correctly parse pin count for JST PH variants in string definiti…
03e9a7c
fix: restore original jst logic and improve pin count parsing to hand…
e390832
feat: implement SPDIP (#180) and UTDFN (#183) footprints
bd2d1aa
fix: implement dynamic pin count parsing for JST PH variants (#495)
fac6c06
fix: restore original JST PH defaults to prevent snapshot regressions
09a0860
fix: correctly dispatch SOT-223-5 when called via functional paramete…
523b24a
Fix CI: formatting and tests
751f62a
style: apply biome formatting fixes
f3758c6
chore: trigger CI rerun
Pitrat-wav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { fp } from "./src/footprinter" | ||
| console.log("fp keys:", Object.keys(fp)) | ||
| console.log("fp.led type:", typeof fp.led) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { fp } from "./src/footprinter" | ||
| const circuitJson = fp.pdip8().circuitJson() | ||
| console.log(JSON.stringify(circuitJson, null, 2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { fp } from "./src/footprinter" | ||
| const p14 = fp.pdip(14).params() | ||
| console.log("pdip(14) params:", JSON.stringify(p14, null, 2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { dip, dip_def, extendDipDef } from "./dip" | ||
|
|
||
| export const pdip_def = extendDipDef({ w: "300mil", p: "2.54mm" }) | ||
|
|
||
| export const pdip = (raw_params: any) => { | ||
| const parameters = pdip_def.parse(raw_params) | ||
| return dip({ | ||
| ...parameters, | ||
| num_pins: raw_params.num_pins ?? 8, | ||
| dip: true, | ||
| } as any) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { dip, dip_def, extendDipDef } from "./dip" | ||
|
|
||
| export const pdip8_def = extendDipDef({ w: "300mil", p: "2.54mm" }) | ||
|
|
||
| export const pdip8 = (raw_params: any) => { | ||
| const parameters = pdip8_def.parse({ ...raw_params, num_pins: 8 }) | ||
| return dip({ | ||
| ...parameters, | ||
| dip: true, | ||
| } as any) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { fp } from "./src/footprinter" | ||
| console.log("pdip8 type:", typeof fp.pdip8) | ||
| console.log("pdip type:", typeof fp.pdip) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { describe, expect, it } from "bun:test" | ||
| import { fp } from "../src/footprinter" | ||
| describe("dip-check", () => { | ||
| it("dip should work", () => { | ||
| const circuitJson = fp.dip(8).circuitJson() | ||
| expect(circuitJson.length).toBeGreaterThan(0) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { describe, expect, it } from "bun:test" | ||
| import { fp } from "../src/footprinter" | ||
| describe("led-check", () => { | ||
| it("led should work", () => { | ||
| const circuitJson = fp.led().circuitJson() | ||
| expect(circuitJson.length).toBeGreaterThan(0) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { describe, expect, it } from "bun:test" | ||
| import { fp } from "../src/footprinter" | ||
|
|
||
| describe("pdip", () => { | ||
| it("pdip8 should have 8 pins and correct dimensions", () => { | ||
| const circuitJson = fp.pdip8().circuitJson() | ||
| const pins = circuitJson.filter((e) => e.type === "pcb_plated_hole") | ||
| expect(pins.length).toBe(8) | ||
|
|
||
| // Find pins by port_hints | ||
| const pin1 = pins.find((p: any) => p.port_hints?.includes("1")) as any | ||
| const pin2 = pins.find((p: any) => p.port_hints?.includes("2")) as any | ||
| const pin8 = pins.find((p: any) => p.port_hints?.includes("8")) as any | ||
|
|
||
| expect(pin1).toBeDefined() | ||
| expect(Math.abs(pin1.x - -3.81)).toBeLessThan(0.01) | ||
| expect(Math.abs(pin1.y - 3.81)).toBeLessThan(0.01) | ||
| expect(Math.abs(pin2.y - 1.27)).toBeLessThan(0.01) | ||
| expect(Math.abs(pin8.x - 3.81)).toBeLessThan(0.01) | ||
| }) | ||
|
|
||
| it("pdip should work with custom pin count", () => { | ||
| const circuitJson = fp.pdip(14).circuitJson() | ||
| const pins = circuitJson.filter((e) => e.type === "pcb_plated_hole") | ||
| expect(pins.length).toBe(14) | ||
| }) | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The special case for
pdipandpdip8breaks the footprinter's chain logic. This condition allows these functions to be called even whentargetalready contains a function definition, which would overwrite an existing footprint mid-chain.For example,
fp().dip(8).pdip()would incorrectly change from adipto apdipfootprint instead of setting a parameter.Fix:
The special case should be removed since
pdipandpdip8are properly registered inFOOTPRINT_FNand will work correctly with the normal flow.Spotted by Graphite Agent

Is this helpful? React 👍 or 👎 to let us know.