Skip to content

fix: default num_pins to 2 for bare solderjumper - #874

Open
Yingtm wants to merge 1 commit into
tscircuit:mainfrom
Yingtm:fix/solderjumper-default-pins
Open

Yingtm wants to merge 1 commit into
tscircuit:mainfrom
Yingtm:fix/solderjumper-default-pins

Conversation

@Yingtm

@Yingtm Yingtm commented Sep 8, 2026

Copy link
Copy Markdown

Summary

Fixes #784

Calling fp.string("solderjumper") without a pin count left num_pins as undefined, causing every value derived from (num_pins - 1) * padSpacing to be NaN. The courtyard rect and silkscreen text silently contained NaN/null coordinates.

Fix

Made num_pins optional in the function signature and default it to 2 via destructuring, matching the behavior of solderjumper2 and most other footprints that accept a pin count.

// Before:
const { num_pins, bridged, ... } = params  // num_pins = undefined → NaN

// After:
const { num_pins = 2, bridged, ... } = params  // num_pins = 2 → valid geometry

Testing

  • Added test: bare solderjumper defaults to 2 pins
  • All 6 solderjumper tests pass (0 failures)
  • All 568 existing tests still pass
bun test tests/solderjumper.test.ts
# 6 pass, 0 fail

Previously, calling fp.string('solderjumper') without a pin count
left num_pins as undefined, causing all geometry derived from
(num_pins - 1) * padSpacing to be NaN. The courtyard and silkscreen
text silently contained NaN coordinates.

Now num_pins defaults to 2 when not provided, matching the behavior
of solderjumper2 and most other footprints that accept a pin count.

Fixes tscircuit#784
@Yingtm
Yingtm force-pushed the fix/solderjumper-default-pins branch from dc79785 to 10877c3 Compare September 8, 2026 15:19

This branch has not been deployed

No deployments
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.

solderjumper without a pin count emits NaN geometry

1 participant