tscircuit / tscircuit/footprinter

solderjumper without a pin count emits NaN geometry

Open Beginner friendly
#784 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
29
Forks
128
Avg merge
16h 30m
Merged PRs (30d)
6

Description

Summary

fp.string("solderjumper") with no pin count silently emits invalid geometry instead of a real footprint. solderjumper2 and solderjumper3 are fine.

Reproduction
import { fp } from "@tscircuit/footprinter"

const circuitJson = fp.string("solderjumper").circuitJson()
console.log(circuitJson.find((e) => e.type === "pcb_courtyard_rect"))
console.log(circuitJson.find((e) => e.type === "pcb_silkscreen_text"))

Output at v0.0.417:

  • 0 pads
  • pcb_courtyard_rect with width: NaN and center.x: NaN
  • pcb_silkscreen_text with anchor_position.x: NaN

fp.string("solderjumper2") and fp.string("solderjumper3") return 2 and 3 pads with finite geometry.

Cause

In src/fn/solderjumper.ts, num_pins is read from params with no default. A bare solderjumper string parses to num_pins: undefined, so (num_pins - 1) * padSpacing and every value derived from it (outline, courtyard, silkscreen anchor) become NaN.

Expected

A bare solderjumper should render a real footprint. Most footprints that take a pin count default a sensible one when it is omitted (dip, ssop, pinrow and many others). A couple throw a clear error instead (jst). Either is fine. Emitting NaN is not.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/fn/solderjumper.ts and trace how the missing pin count reaches pad spacing, outline, courtyard, and silkscreen geometry. Compare the behavior with solderjumper2 and solderjumper3, then verify that a bare solderjumper produces a valid footprint with finite geometry and a nonzero pad count, or reports a clear error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.