Skip to content

feat: implement chipled footprint with polarity indicator for chip LED packages#549

Open
victorjzq wants to merge 3 commits intotscircuit:mainfrom
victorjzq:feat/chipled-footprint
Open

feat: implement chipled footprint with polarity indicator for chip LED packages#549
victorjzq wants to merge 3 commits intotscircuit:mainfrom
victorjzq:feat/chipled-footprint

Conversation

@victorjzq
Copy link
Contributor

Summary

Implements the chipled footprint requested in #2, providing chip LED footprints with a cathode polarity bar on the silkscreen.

  • Adds chipled function in src/fn/chipled.ts
  • Supports standard imperial sizes: 0201, 0402, 0603, 0805, 1206
  • Pin 1 = K (Cathode), Pin 2 = A (Anode)
  • Draws a vertical polarity bar on the cathode side of the silkscreen outline
  • Includes courtyard following IPC-7351B padding convention (0.25mm)

Usage

chipled0603    → 0603 chip LED with polarity bar
chipled0402    → 0402 chip LED with polarity bar
chipled0805    → 0805 chip LED with polarity bar
chipled1206    → 1206 chip LED with polarity bar

Test plan

  • bun test tests/chipled.test.ts — all 4 size variants pass
  • bun test — full suite passes (383 tests, 0 fail)
  • SVG snapshots generated for 0402, 0603, 0805, 1206 variants
  • Footprint completeness test passes (new file properly exported from index)

Closes #2 (chipled0603 checklist item)

…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)
Comment on lines +5 to +27
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")
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Fix in Graphite


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

Comment on lines +129 to +131
// Silkscreen outline dimensions
const silkW = Math.max(bodyW, p - pw) * 0.5
const silkH = Math.max(bodyH, ph) * 0.5 + 0.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.1

The gapHalf variable on line 134 appears to be calculated but never used for this purpose.

Suggested change
// 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

Fix in 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Breadth of Footprints Supported

2 participants