AnasSarkiz/magnetic-shutter-remote-r8

A USB‑C rechargeable battery-powered ESP32‑C3 wireless controller with Li‑ion charging, protected 3.3‑V buck‑boost regulation, thermal/safety monitoring, status LEDs, buttons, programming UART, crystal clock, and 2.4‑GHz antenna matching network.

Version
0.4.0-prototype
License
unset
Stars
0

scripts/render-r9-sheets.ts

import { convertCircuitJsonToSchematicSvg } from "circuit-to-svg";
import { any_circuit_element } from "circuit-json";
import { Resvg } from "@resvg/resvg-js";
import { z } from "zod";
const output = z.string().min(1).parse(Bun.argv[2]);
const circuit = any_circuit_element
	.array()
	.parse(await Bun.file("dist/index/circuit.json").json());
for (const sheet of circuit.filter((e) => e.type === "schematic_sheet")) {
	const svg = convertCircuitJsonToSchematicSvg(circuit, {
		schematicSheetId: sheet.schematic_sheet_id,
	});
	await Bun.write(`${output}/${sheet.name}.svg`, svg);
	await Bun.write(
		`${output}/${sheet.name}.png`,
		new Resvg(svg, { fitTo: { mode: "width", value: 2200 } }).render().asPng(),
	);
}