seveibar/nema17-stepper-motor-driver-tmc2209-usb-pd
RP2040-based USB-C PD stepper-motor controller with TMC2209 drive, AS5600 position feedback, TMP102 thermal shutdown, current/voltage telemetry, RGB status LED, and protected buzzer alarm circuitry.
- Version
- 0.2.0
- License
- unset
- Stars
- 0
scripts/route.ts
import { AutoroutingPipelineSolver7_MultiGraph } from "@tscircuit/capacity-autorouter";
import { readFileSync, writeFileSync } from "node:fs";
const path = process.argv[2] ?? "routing/input.simple-route.json";
const input = JSON.parse(readFileSync(path, "utf8"));
const solver = new AutoroutingPipelineSolver7_MultiGraph(input, {effort: 2});
// The pinned TraceSimplificationSolver ignores its declared iterations option.
// Use its public loop limit before its first step. This preserves the routed
// geometry; the downstream width and both DRC repair passes remain enabled.
let phase = "";
while (!solver.solved && !solver.failed) {
if (solver.traceSimplificationSolver) {
solver.traceSimplificationSolver.MAX_SIMPLIFICATION_PIPELINE_LOOPS = 0;
if (solver.traceSimplificationSolver.simplificationPipelineLoops !== 0) {
throw new Error("Simplifier ran before bypass was installed");
}
}
solver.step();
const next = solver.getCurrentPhase();
if (next !== phase) { console.log(next); phase = next; }
}
if (solver.failed) throw new Error(solver.error ?? "Routing failed");
writeFileSync("routing/route-plan.json", JSON.stringify({
expectedInput: input,
traces: solver.getOutputSimplifiedPcbTraces(),
}, null, 2));
console.log("Saved candidate routes. Run build and inspect unfiltered DRC.");