techmannih/museview
A 50×35 mm USB‑C 5 V camera board combining an ESP32‑S3 module, M0031 parallel camera connector, buck/LDO power rails, USB/ESD protection, controls, status LED, and passives.
- Version
- 0.1.18
- License
- unset
- Stars
- 1
scripts/board-router.ts
import saved from "../pcb-routes.json"
import {routeFingerprint} from "./route-fingerprint"
// @tscircuit/core 0.0.2079 represents circular keepouts by their bounding
// rectangles; 0.0.2021 used "oval". The complete captured inputs differ ONLY
// in the type of the four 4.6 mm mounting-hole obstacles (257..260).
// route-grid.py already treated these as rectangles. Accept the reviewed
// complete input, bound to its original routing revision, without ignoring
// obstacle shapes or weakening the fingerprint for any other input.
// Re-capture and review compatibility if either runtime or routing changes.
const reviewedRendererInput = {
referenceFingerprint: "c6bc715a-6984f1ee-1060756",
boundingRectangleFingerprint: "904ff28e-139073e2-1060756",
}
/** Replay this board's independently generated, locally corrected routing.
* Native connectivity/placement/short checks still execute on every build.
* Editing the circuit requires fresh routing, never silent stale-cache reuse.
*/
export async function boardRouter(input:any) {
const actual=routeFingerprint(input)
const reviewedEquivalent = saved.fingerprint===reviewedRendererInput.referenceFingerprint &&
actual===reviewedRendererInput.boundingRectangleFingerprint
if(actual!==saved.fingerprint && !reviewedEquivalent) throw new Error(`PCB routing is stale (${actual}, expected ${saved.fingerprint}). Regenerate and verify pcb-routes.json.`)
const listeners:Record<string,((event:any)=>void)[]>={}
return {
on(event:string,callback:(event:any)=>void) { (listeners[event]??=[]).push(callback) },
start() { for(const callback of listeners.complete??[]) callback({traces:structuredClone(saved.traces)}) },
stop() {},
}
}