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/plan-swap-shortlinks.py

"""Bounded shortest-copper search for the few displaced supply/status links.

Only writes an isolated candidate plan; import and full-board audits are still
required. The existing board's copper and source graph remain fixed obstacles.
"""
from route_geometry import *
c=load_circuit('routing/review-placement.circuit.json');root=connectivity(c)
m=json.loads(Path('routing/net-map.json').read_text())['roots']
sources={e['source_trace_id']:e for e in c if e['type']=='source_trace'}
def net(job):
    s=sources[job['source']]
    return m[root((s.get('connected_source_port_ids',[])+s.get('connected_source_net_ids',[]))[0])]
plan=json.loads(Path('routing/bulk-top-closure-plan.json').read_text())
selected=os.environ.get('SWAP_NETS','N57,N159').split(',')
prefix=os.environ.get('SWAP_PREFIX','swap-shortlinks')
plan.update(prefix=prefix,jobs=[j for j in plan['jobs'] if net(j) in selected],extent=[-20.9,-20.9,20.9,20.9])
if os.environ.get('SWAP_LAYERS'):
    for job in plan['jobs']:job['constraints']['allowed_layers']=os.environ['SWAP_LAYERS'].split(',')
Path('routing/'+prefix+'-plan.json').write_text(json.dumps(plan,indent=2)+'\n')
print([(net(j),j['start']) for j in plan['jobs']])