imrishabh18/rp2040-motor-controller
The circuit implements a powered USB interface with a W25Q16 flash memory chip, a RP2040 microcontroller, and AO3400A MOSFETs for switch control, enabling USB communication, memory storage, and device power management.
- Version
- 1.0.19
- License
- unset
- Stars
- 0
scripts/expand-feedback-routes.ts
import { AutoroutingPipelineSolver } from '@tscircuit/capacity-autorouter';
import { readFileSync,writeFileSync } from 'node:fs';
const file='dist/feedback/route-plan.json';
const plan=JSON.parse(readFileSync(file,'utf8'));
const input:any=structuredClone(plan.expectedInput);input.traces=structuredClone(plan.traces);
const pipeline=new AutoroutingPipelineSolver(input);
const phase=pipeline.pipelineDef.find(x=>x.solverName==='powerTraceExpansionSolver')!;
const power=process.argv.includes('--power');
const names=input.connections.filter((x:any)=>power ? (x.nominalTraceWidth??0)>=0.5 : (x.nominalTraceWidth??0)>=0.15 && (x.nominalTraceWidth??0)<0.5).map((x:any)=>x.name);
const solver=new (phase.solverClass as any)(input,{onlyConnectionNames:names,powerTraceToPadClearance:0.15});
console.log('Expanding',names.length,power?'power':'signal','connections');
let last=Date.now();
while(!solver.solved&&!solver.failed){solver.step();if(Date.now()-last>15000){last=Date.now();console.log(solver.iterations,JSON.stringify(solver.stats));}}
console.log('DONE',solver.solved,solver.error,JSON.stringify(solver.stats));
if(!solver.solved)process.exit(1);
plan.traces=solver.getOutput();
writeFileSync(file,JSON.stringify(plan,null,2));