pixalynx/pixal-gps

These files define two separate printed circuit boards: a small, two-layer battery cartridge with protection circuitry and contact pads for a pouch cell, and a larger, two-layer wireless charging dock featuring USB-C input, a resonant coil, and wireless power transmission components.

Version
0.1.2
License
unset
Stars
0

lib/gnd-mesh.tsx

import { Fragment } from "react"

export type GndMesh = {
  stubs: { port: string; layer: string; pad: number[]; via: number[]; local: number[] }[]
  links: { from: string; to: string; layer: string; a: number[]; b: number[] }[]
  unresolved: string[]
}

/** Renders the generated ground mesh: one short stub + plane via per ground land, straight
 * same-layer links for lands that had no free via spot, and a plain net connection for the
 * rest (routed by the autorouter). Generated by scripts/gen-gnd-mesh.py from the placement
 * build; regenerate after any placement change. */
export function GndMeshTraces({ mesh, net = "GND", plane = "inner1" as const, width = 0.25 }: { mesh: GndMesh; net?: string; plane?: "inner1" | "inner2"; width?: number }) {
  return (
    <>
      {mesh.stubs.map((s) => (
        <Fragment key={`stub-${s.port}`}>
          <trace from={s.port} to={`net.${net}`} thickness={width} pcbPath={[{ x: s.local[0], y: s.local[1] }, { x: s.local[0], y: s.local[1], via: true, toLayer: plane }]} />
        </Fragment>
      ))}
      {mesh.links.map((l) => (
        <Fragment key={`link-${l.from}`}>
          <trace from={l.from} to={l.to} thickness={width} pcbPath={[]} />
        </Fragment>
      ))}
      {mesh.unresolved.map((p) => (
        <Fragment key={`auto-${p}`}>
          <trace from={p} to={`net.${net}`} />
        </Fragment>
      ))}
    </>
  )
}