Skip to content

fix: parse pin count from sh variant in JST footprints#611

Open
64johnlee wants to merge 3 commits into
tscircuit:mainfrom
64johnlee:fix/jst-ph-pin-count
Open

fix: parse pin count from sh variant in JST footprints#611
64johnlee wants to merge 3 commits into
tscircuit:mainfrom
64johnlee:fix/jst-ph-pin-count

Conversation

@64johnlee
Copy link
Copy Markdown

Summary

Fix Issue #495 - jst_ph_4 footprint generates only 2 pads instead of 4

Problem: The JST footprint parser only parsed pin count from the string for ZH variant, not for SH variant. This meant jst_ph_4 would fail to parse the 4 pins.

Solution: Added shMatch regex to parse pin count from SH variant string, e.g., jst_ph_4 extracts 4 pins.

const shMatch = str.match(/(?:^|_)sh(\d+)(?:_|$)/)
if (shMatch && shMatch[1]) {
  numPins = Number.parseInt(shMatch[1], 10)
}

Testing

  • jst_ph_4 now correctly generates 4 pads
  • jst_ph_2 still works correctly (2 pads)

64johnlee added 2 commits April 29, 2026 01:02
Issue tscircuit#562 - String parser fails for led and diode with imperial sizes.

The fix adds 'led' and 'diode' to the list of passive footprints
that use imperial/metric sizing (alongside res and cap).
Issue tscircuit#495 - jst_ph_4 footprint generates only 2 pads instead of 4

Added shMatch to parse pin count from SH variant string, e.g., jst_ph_4 extracts 4 pins.

Previously only ZH variant parsed pin count from string.
Copy link
Copy Markdown
Contributor

@techmannih2 techmannih2 left a comment

Choose a reason for hiding this comment

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

fix format check, rest lgtm

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.

2 participants