hrithik18k/punck-tscircuit-recreation
A four-layer Eurorack drum/sampler controller PCB built around an STM32H743, dual QSPI flash, PCM5100 stereo DAC, TL074 analog audio circuitry, input clamps, 12V-to-3.3V power regulation, MIDI/USB/SWD connectors, controls, LEDs, and trigger/audio I/O.
- Version
- 1.0.3
- License
- unset
- Stars
- 0
scripts/refine-schematic.ts
import fs from 'node:fs'
for(const n of ['components','controls']) {
const path=`native/${n}.json`, d=JSON.parse(fs.readFileSync(path,'utf8'))
const log=fs.readFileSync(`evidence/native-sch-placement-${n}-2.log`,'utf8')
for(const m of log.matchAll(/<TwoPinComponentShouldBeVertical componentName="([^"]+)"[^>]*deltaSchRotation="([^"]+)"/g)) {const p=d.parts.find((p:any)=>p.name===m[1]);p.schRotation=(p.schRotation??0)+Number(m[2])}
if(n==='components') {
const arrange=(refs:string[],x:number,y:number,section:string)=>refs.forEach((r,i)=>{const p=d.parts.find((p:any)=>p.name===r);p.schX=x+i*1.3;p.schY=y;p.section=section})
arrange(['C40','C39','C25','C37'],65,-18,'Power')
arrange(['C30','C28','C16','C41','C29','C21','C22','C15'],65,-24,'Power')
arrange(['C23','C26'],128,-266,'Clock')
const y=d.parts.find((p:any)=>p.name==='Y1');y.schX=128.65;y.schY=-263
}
fs.writeFileSync(path,JSON.stringify(d,null,2))
}