mohan-bee/rc-link-breakaway-panel

A four-layer RC link panel combining an STM32/E28 2.4‑GHz transmitter with USB-RP2040 socket and an STM32/E28 receiver providing six buffered PWM servo outputs, regulated 3.3‑V power, headers, controls, and protection/decoupling.

Version
0.1.5
License
unset
Stars
0

tools/render-servo-power.mjs

import { readFileSync, writeFileSync } from "node:fs";
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg";
import { Resvg } from "@resvg/resvg-js";
const circuit = JSON.parse(readFileSync("dist/index/circuit.json", "utf8"));
const audit = JSON.parse(readFileSync("validation/servo-power-audit.json", "utf8"));
const ids = Object.values(audit.routes).flatMap(r => r.trace_ids);
for (const layer of ["top", "bottom"]) {
  const svg = convertCircuitJsonToPcbSvg(circuit.filter(e => e.type !== "pcb_copper_pour"), {
    layer, viewport: {minX: 14, maxX: 59, minY: -30.5, maxY: 24.5},
    width: 1000, height: 1220, includeVersion: false, showFabricationNotes: false,
    shouldDrawRatsNest: false, shouldDrawErrors: true, xRayElementIds: ids, hiddenLayerOpacity: .2,
  });
  writeFileSync(`manufacturing/receiver-power-${layer}.svg`, svg);
  writeFileSync(`manufacturing/receiver-power-${layer}.png`, new Resvg(svg).render().asPng());
}