seveibar/am3352-dev-board

A 324-ball TI AM3352 ARM processor with DDR3, LCD, USB, Ethernet, storage, serial, analog, clock, reset, power, and JTAG interfaces, paired with configurable JST-GH board connectors and constrained PCB routing.

Version
1.0.2
License
unset
Stars
0

scripts/check-pad-escape-cleanup.py

"""Verify the cleanup survived the native rebuild, including real 45-degree escapes."""
import json,math
from pathlib import Path
c=json.loads(Path('dist/index/circuit.json').read_text())
r=json.loads(Path('design/pad-escape-cleanup.json').read_text())
vias=[e for e in c if e['type']=='pcb_via'];traces=[e for e in c if e['type']=='pcb_trace']
def near(a,b):return math.dist(a,b)<.000002
for removed in r['removedVias']:
 assert not any(near((v['x'],v['y']),removed['position']) for v in vias),removed
for moved in r['movedDogbones']:
 pad=moved['pad'];via=moved['after']
 assert any(near((v['x'],v['y']),via) for v in vias),moved
 assert abs(abs(pad[0]-via[0])-abs(pad[1]-via[1]))<.000002,moved
 assert any(a['route_type']==b['route_type']=='wire' and a['layer']==b['layer']=='top' and ((near((a['x'],a['y']),pad) and near((b['x'],b['y']),via)) or (near((b['x'],b['y']),pad) and near((a['x'],a['y']),via))) for t in traces for a,b in zip(t['route'],t['route'][1:])),moved
print(f"Verified {len(r['removedVias'])} removed vias and {len(r['movedDogbones'])} direct 45-degree dogbones in rebuilt copper")