MustafaMulla29/rp2040-bldc-motor-controller

Hardware assembly metadata and PCB geometry for a controller board with a snap-off rotary-encoder section, plus four parallel 150 µF/50 V bulk electrolytic capacitors filtering the motor supply.

Version
2.0.40
License
unset
Stars
0

Use with the tscircuit CLI

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

tsci clone MustafaMulla29/rp2040-bldc-motor-controller  # download the package files into ./rp2040-bldc-motor-controller
tsci add MustafaMulla29/rp2040-bldc-motor-controller    # add it to your project as @tsci/MustafaMulla29.rp2040-bldc-motor-controller

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/check-saved-routing.mjs

/** Prevent stale saved copper from being accepted after a source/layout edit. */
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { savedRouting } from '../circuit/saved-routing.ts'
const plan=JSON.parse(readFileSync(new URL('../circuit/route-plan.json',import.meta.url),'utf8'))
assert.equal(new Set(plan.traces.map(t=>t.pcb_trace_id)).size,plan.traces.length,'Authored trace IDs must be unique')
for (const trace of plan.traces) for (const point of trace.route) {
 if (point.route_type !== 'via') continue
 assert.equal(point.via_hole_diameter, 0.3, `Unexpected via hole in ${trace.pcb_trace_id}`)
 assert.equal(point.via_diameter, 0.45, `Unexpected via pad in ${trace.pcb_trace_id}`)
}
const router=await savedRouting(structuredClone(plan.expectedInput))
let output
router.on('complete',event=>{output=event.traces})
router.start()
assert.deepEqual(output,plan.traces)
assert.notEqual(output,plan.traces)
for (const key of ['bounds','obstacles','connections']) {
 const changed=structuredClone(plan.expectedInput)
 if (key==='bounds') changed.bounds.minX-=0.1
 else if(key==='obstacles') changed.obstacles[0].center.x+=0.1
 else changed.connections[0].name+='-changed'
 await assert.rejects(()=>savedRouting(changed),/PCB geometry, connections or routing rules changed/)
}
const changedRules=structuredClone(plan.expectedInput)
changedRules.minTraceWidth+=0.01
await assert.rejects(()=>savedRouting(changedRules),/PCB geometry, connections or routing rules changed/)
console.log('PASS: saved copper matches its input; changed outline, pad, net and routing rule are rejected.')