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/capture-routing.tsx
import { Circuit } from "tscircuit";
import { writeFileSync, mkdirSync } from "node:fs";
import Board from "../index.circuit";
const element = Board({useSavedRouting:false});
let captured = false;
element.props.autorouter.algorithmFn = async (input: unknown) => {
writeFileSync("routing/input.simple-route.json", JSON.stringify(input,null,2));
captured = true;
const listeners = new Map<string, (event:any)=>void>();
return {on(name:string,callback:(event:any)=>void){listeners.set(name,callback)},
start(){listeners.get("complete")?.({traces:[]})},stop(){}};
};
const circuit = new Circuit(); circuit.add(element); await circuit.renderUntilSettled();
mkdirSync("dist/placement",{recursive:true});
writeFileSync("dist/placement/circuit.json",JSON.stringify(circuit.getCircuitJson(),null,2));
console.log("Captured new routing input; this intermediate placement intentionally has no routed traces.");
if (!captured) throw new Error("Routing input was not captured");