AnasSarkiz/muse-voice-remote
Muse Voice Remote — bare ESP32-S3R8, 155 TOP JLCPCB parts with real supplier CAD, native 3D assembly and GLB exports. Revised 17 mm case allocation; 0.30 mm via drill /0.45 mm pad. Checked prototype PCB; mechanical, RF and MUSE qualification pending.
- Version
- 1.3.2
- License
- unset
- Stars
- 0
scripts/widen-supply-bridges.py
#!/usr/bin/env python3
"""Widen added supply bridges where actual native clearance permits."""
import pathlib,json,os
h=pathlib.Path(__file__).with_name('finish-unrouted.py');api={'__file__':str(h)};exec(h.read_text().split('\n# A FreeRouting pattern')[0],api);pc=api['pcbnew'];path=api['path'];before=path.read_bytes();old=api['check']()
if old['violations'] or old['unconnected_items']:raise RuntimeError('Require clean fully connected baseline')
b=pc.LoadBoard(str(path));ts=list(b.GetTracks());baseline=set(json.load(open('/workspace/.cache/muse-fabrication/baseline-track-ids.json')));changed={t.m_Uuid.AsString():t for t in ts if not isinstance(t,pc.PCB_VIA) and t.GetNetname()=='V3_3' and t.m_Uuid.AsString() not in baseline};widths={k:t.GetWidth() for k,t in changed.items()}
for t in changed.values():t.SetWidth(pc.FromMM(.3))
for iteration in range(10):
pc.SaveBoard(str(path),b);r=api['check']()
if not r['violations'] and not r['unconnected_items']:break
affected={i['uuid'] for v in r['violations'] for i in v['items']} & set(changed)
if not affected or r['unconnected_items']:path.write_bytes(before);raise RuntimeError('Widening altered unrelated geometry/connectivity; restored')
count=0
for k in affected:
t=changed[k]
if t.GetWidth()>widths[k]:t.SetWidth(widths[k]);count+=1
if not count:path.write_bytes(before);raise RuntimeError('Clearance did not converge; restored')
else:path.write_bytes(before);raise RuntimeError('Width convergence budget exhausted')
records=[dict(uuid=k,start=api['xy'](t.GetStart()),end=api['xy'](t.GetEnd()),layer=t.GetLayerName(),width_mm=pc.ToMM(t.GetWidth())) for k,t in changed.items()];(api['root']/'docs/supply-plane-bridges.json').write_text(json.dumps(dict(net='V3_3',reason='Restore power-plane continuity after two signal paths on In2.Cu',tracks=records,native_drc_violations=0,unconnected=0),indent=2)+'\n');print('Checked widened bridges:',len(records),'segments;',sum(t['width_mm']==.3 for t in records),'at 0.3 mm',flush=True);os._exit(0)