shibosoftwaredev/f1c100s-linux-nema17-stepper-controller
A four-layer NEMA 17 motor-controller PCB combining an Allwinner F1C100S Linux computer, USB‑PD/buck power system, W5500 Ethernet, STM32 real-time motion control, DRV8825 stepper driver, protection/temperature/current telemetry, USB interfaces, and local LED/buzzer diagnostics.
- Version
- 0.4.56
- License
- unset
- Stars
- 0
scripts/restore-swap-avcc.py
"""Retain the original AVCC supply by opening its existing via corridor.
Move the adjacent new signal/logic escapes, never narrow the analog rail.
Every restored segment comes from the verified emitted baseline.
"""
from route_geometry import *
import hashlib
source=Path('routing/swap-progress-physical.json')
p=json.loads(source.read_text());before=hashlib.sha256(source.read_bytes()).hexdigest()
def replace_chain(net,layer,width,old,new):
for a,b in zip(old,old[1:]):
matches=[w for w in p['wires'] if w['net']==net and w['layer']==layer and abs(w['width']-width)<1e-8 and len(w['points'])==2 and (w['points']==[a,b] or w['points']==[b,a])]
assert len(matches)==1,(net,a,b,matches)
p['wires'].remove(matches[0])
p['wires'].append(dict(net=net,layer=layer,width=width,points=new))
replace_chain('N166','top',.15,[[20.3,-2.41],[20.3,-3.18],[17.54,-3.18],[17.54,-2.65]],[[20.3,-2.41],[19.9,-2.9],[19.7,-3.18],[17.54,-3.18],[17.54,-2.65]])
replace_chain('N57','bottom',.15,[[20.5,-2.025],[20.65,-3.2],[20.65,-6.8]],[[20.5,-2.025],[20.8,-2.7],[20.8,-6.3],[20.65,-6.8]])
replace_chain('N101','top',.5,[[20.65,.4],[20.1,.4]],[[20.65,.4],[20.05,.4]])
replace_chain('N101','bottom',.5,[[20.1,.4],[18.7,.4]],[[20.05,.4],[18.7,.4]])
v=next(v for v in p['vias'] if v==dict(net='N101',x=20.1,y=.4));p['vias'].remove(v);p['vias'].append(dict(net='N101',x=20.05,y=.4))
prep=json.loads(Path('reports/swap-preparation.json').read_text())
wires=[w for w in prep['removedWires'] if w['net']=='N68'];vias=[v for v in prep['removedVias'] if v['net']=='N68']
assert len(wires)==2 and len(vias)==1
assert not any(v in p['vias'] for v in vias)
p['wires']+=wires;p['vias']+=vias
Path('routing/swap-avcc-preserved.json').write_text(json.dumps(p,indent=2)+'\n')
Path('reports/swap-avcc-preserved.json').write_text(json.dumps(dict(inputSha256=before,notInstalled=True,restoredBaselineWires=wires,restoredBaselineVias=vias),indent=2)+'\n')