Skip to content

jst_ph_4 footprint generates only 2 pads instead of 4 #495

@dwiel

Description

@dwiel

Summary

The jst_ph_4 footprint (JST PH connector with 4 pins) only generates 2 pads instead of 4.

Root Cause

In src/fn/jst.ts:

  1. Line 169 hardcodes numPins = 2 for the PH variant:

    let numPins = variant === "sh" ? 4 : 2
  2. The SH variant parses pin count from the string (e.g., jst_sh6 → 6 pins), but PH does not.

  3. The generatePads() function for PH (lines 84-105) only creates 2 pads at fixed positions, ignoring the numPins parameter entirely.

Reproduction

<chip name="J1" footprint="jst_ph_4" />

Export to KiCad PCB - only 2 pads are generated.

Expected

4 through-hole pads for jst_ph_4, similar to how jst_sh6 generates 6 pads.

Suggested Fix

  1. Parse pin count from the footprint string for PH variant (e.g., jst_ph_4 → 4 pins)
  2. Update generatePads() to dynamically create numPins pads for the PH variant

Impact

JST PH connectors with more than 2 pins cannot be used via the built-in footprint string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions