mohan-bee/gimbal-one-budget-pcb

A 4-layer STM32-based gimbal controller PCB with an onboard LSM6DS3TR-C IMU, three DRV8313 3-phase motor drivers, protected 3S battery input, 3.3 V buck regulation, and SWD/UART control interfaces.

Version
0.1.0
License
unset
Stars
0

routing/check-routing.test.ts

import assert from "node:assert/strict"
import reference from "./reference-input.json"
import { checkedRouting } from "./checked-routing"
const router = await checkedRouting(structuredClone(reference))
assert.equal(router.solveSync().length,225)
for(const change of [
  (x:typeof reference)=>{x.bounds.maxX+=1},
  (x:typeof reference)=>{x.connections[0].pointsToConnect[0].x+=0.1},
  (x:typeof reference)=>{x.connections[0].name="CHANGED_NET"},
  (x:typeof reference)=>{x.obstacles[0].width+=0.1},
]){
  const changed=structuredClone(reference);change(changed)
  await assert.rejects(()=>checkedRouting(changed),/no longer matches/)
}
let completed=false
router.on("complete",()=>{completed=true});router.start()
await new Promise(resolve=>queueMicrotask(()=>resolve(undefined)))
assert.ok(completed)
console.log("PASS: saved routes load; changed board bounds, endpoints, nets and pad geometry are rejected.")