imrishabh18/rp2040-motor-controller

An RP2040-based NEMA17 stepper-motor controller with USB-C programming and PD motor-power negotiation, DRV8825 dual H-bridge drive, current/temperature telemetry, protected power filtering, status RGB LED, buzzer alarm, and optional magnetic encoder.

Version
1.0.41
License
unset
Stars
3

scripts/render-pcb.ts

import { readFileSync, writeFileSync } from "node:fs";
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg";
import { Resvg } from "@resvg/resvg-js";
const json = JSON.parse(readFileSync(process.argv[2] ?? "dist/index/circuit.json", "utf8"));
for (const layer of ["top", "inner1", "inner2", "bottom"] as const) {
  const svg = convertCircuitJsonToPcbSvg(json, {
    layer, width: 1400, matchBoardAspectRatio: true,
    shouldDrawErrors: true, showErrorsInTextOverlay: true,
  });
  writeFileSync(`dist/pcb-${layer}.svg`, svg);
  writeFileSync(`dist/pcb-${layer}.png`, new Resvg(svg).render().asPng());
}