feat: implement chipled footprint with polarity indicator for chip LED packages#549
feat: implement chipled footprint with polarity indicator for chip LED packages#549victorjzq wants to merge 3 commits intotscircuit:mainfrom
Conversation
…D packages Adds chipled0603, chipled0402, chipled0805, chipled1206 footprints. Each has 2 pads (pin 1=K cathode, pin 2=A anode) and a polarity bar on the cathode side of the silkscreen outline. Closes tscircuit#2 (chipled0603 checklist item)
| test("chipled0603", () => { | ||
| const circuitJson = fp.string("chipled0603").circuitJson() | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "chipled0603") | ||
| }) | ||
|
|
||
| test("chipled0402", () => { | ||
| const circuitJson = fp.string("chipled0402").circuitJson() | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "chipled0402") | ||
| }) | ||
|
|
||
| test("chipled0805", () => { | ||
| const circuitJson = fp.string("chipled0805").circuitJson() | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "chipled0805") | ||
| }) | ||
|
|
||
| test("chipled1206", () => { | ||
| const circuitJson = fp.string("chipled1206").circuitJson() | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "chipled1206") | ||
| }) |
There was a problem hiding this comment.
This test file contains 4 test() calls (lines 5, 11, 17, and 23), but the rule states that a *.test.ts file may have AT MOST one test(...), after that the user should split into multiple, numbered files. This file should be split into multiple files like chipled1.test.ts, chipled2.test.ts, chipled3.test.ts, and chipled4.test.ts, with each file containing only one test() call.
Spotted by Graphite (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
| // Silkscreen outline dimensions | ||
| const silkW = Math.max(bodyW, p - pw) * 0.5 | ||
| const silkH = Math.max(bodyH, ph) * 0.5 + 0.1 |
There was a problem hiding this comment.
The silkscreen width calculation causes overlap with the pads. The silkscreen extends to ±silkW but pads start at ±(p/2 - pw/2). For 0603: silkW=0.8mm but pad inner edge is at 0.4mm, causing overlap.
Fix by constraining silkW to not exceed the pad inner edge:
const maxSilkW = (p - pw) / 2 - 0.1 // gap between pads minus clearance
const silkW = Math.min(bodyW / 2, maxSilkW)
const silkH = Math.max(bodyH, ph) / 2 + 0.1The gapHalf variable on line 134 appears to be calculated but never used for this purpose.
| // Silkscreen outline dimensions | |
| const silkW = Math.max(bodyW, p - pw) * 0.5 | |
| const silkH = Math.max(bodyH, ph) * 0.5 + 0.1 | |
| // Silkscreen outline dimensions | |
| const maxSilkW = (p - pw) / 2 - 0.1 | |
| const silkW = Math.min(bodyW / 2, maxSilkW) | |
| const silkH = Math.max(bodyH, ph) / 2 + 0.1 | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
The standard SOIC-8 (3.9x4.9mm, P1.27mm) requires w=6.9mm, pl=1.95mm, pw=0.6mm to match KiCad IPC-7351B pad sizing. Fixes tscircuit#274.
Summary
Implements the
chipledfootprint requested in #2, providing chip LED footprints with a cathode polarity bar on the silkscreen.chipledfunction insrc/fn/chipled.ts0201,0402,0603,0805,1206Usage
Test plan
bun test tests/chipled.test.ts— all 4 size variants passbun test— full suite passes (383 tests, 0 fail)Closes #2 (chipled0603 checklist item)