Devesh36/bench-eight

Eight-channel 0–10 V measurement and control console: dual ADS1115 ADCs, buffered inputs, Pico controller, microSD, RTC, RS-485, four protected low-voltage outputs and a separate OLED/encoder panel in a tscircuit assembly.

Version
0.1.3
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone Devesh36/bench-eight  # download the package files into ./bench-eight
tsci add Devesh36/bench-eight    # add it to your project as @tsci/Devesh36.bench-eight

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

scripts/build.ts

// Generate the actual panel model before compiling its assembly reference.
import { mkdir, copyFile } from "node:fs/promises";
const systemBuild = Bun.spawn(["bun", "scripts/build-system.ts"], {
	stdout: "inherit",
	stderr: "inherit",
});
if ((await systemBuild.exited) !== 0) process.exit(1);
const options = [
	"--ignore-config",
	"--disable-parts-engine",
	"--svgs",
	"--pcb-png",
	"--glbs",
	"--3d-png",
];
for (const entry of ["ui", "index", "assembly", "exploded"]) {
	const proc = Bun.spawn(
		[
			"bun",
			"node_modules/.bin/tsci",
			"build",
			`${entry}.circuit.tsx`,
			...options,
		],
		{ stdout: "inherit", stderr: "inherit" },
	);
	const code = await proc.exited;
	if (code !== 0) process.exit(code);
	if (entry === "ui") {
		await mkdir("assets", { recursive: true });
		await copyFile("dist/ui/3d.glb", "assets/control-panel.glb");
	}
}