pixalynx/nrf9151-gps-tracker

A compact 44×32 mm, 4-layer nRF9151 LTE-M/NB-IoT/GNSS tracker PCB with nPM1300 LiPo/USB-C power, nano-SIM/eSIM switching, nRF7002 Wi‑Fi scanning, accelerometer, antennas, buzzer, LEDs, SOS button, and SWD/debug connectors.

Version
0.1.4
License
unset
Stars
0

scripts/render.ts

// Render dist/<entry>/circuit.json to PNGs: pcb-top.png, pcb-bottom.png (courtyards, ratsnest, errors drawn).
// Usage: bun scripts/render.ts [entry=index] [--width 2400]
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
import { Resvg } from "@resvg/resvg-js"
const entry = process.argv[2] && !process.argv[2].startsWith("--") ? process.argv[2] : "index"
const width = process.argv.includes("--width") ? Number(process.argv[process.argv.indexOf("--width") + 1]) : 2400
const dir = `dist/${entry}`
const cj = await Bun.file(`${dir}/circuit.json`).json()
for (const layer of ["top", "bottom"] as const) {
  const svg = convertCircuitJsonToPcbSvg(cj, {
    layer, showCourtyards: true, shouldDrawErrors: true, shouldDrawRatsNest: process.argv.includes("--rats"),
    width, height: Math.round(width * 0.75), matchBoardAspectRatio: true, backgroundColor: "#111111",
  })
  const png = new Resvg(svg, { fitTo: { mode: "width", value: width } }).render().asPng()
  await Bun.write(`${dir}/pcb-${layer}.png`, png)
  console.log(`wrote ${dir}/pcb-${layer}.png`)
}