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/prepare-round12-analog.py

"""Candidate-only reroute of the long A-amplifier output; all other copper fixed."""
from route_geometry import *
c=load_circuit('dist/index/circuit.json');root=connectivity(c)
source=next(e for e in c if e['type']=='source_trace' and e.get('name')=='CURRENT_A_OUTPUT')
net=root(source['connected_source_port_ids'][0])
sources={e['source_trace_id']:e for e in c if e['type']=='source_trace'}
affected={sid for sid,s in sources.items() if root((s.get('connected_source_port_ids',[])+s.get('connected_source_net_ids',[]))[0])==net}
assert affected=={source['source_trace_id']},'expect only the isolated amplifier-to-filter net'
write=lambda path,value:Path(path).write_text(json.dumps(value,indent=2)+'\n')
replay=json.loads(Path('routing/complete-routes.json').read_text())
write('routing/round12-analog-placement.circuit.json',c)
own=[t for t in replay if t['source_trace_id'] in affected]
assert len(own)==1
route=own[0]['route'];via_indices=[i for i,p in enumerate(route) if p['route_type']=='via']
first,last=via_indices[0],via_indices[-1]
# Preserve the real pad escapes and their existing full-stack barrels. Close
# only between those barrels, rather than searching through fine-pitch pads.
retained=[t for t in replay if t['source_trace_id'] not in affected]
retained.extend([{**own[0],'route':route[:first+1]}, {**own[0],'route':route[last:]}])
write('routing/round12-analog-retained.json',retained)
point=lambda p:dict(x=p['x'],y=p['y'],layers=LAYERS,pcb_port_id='existing_A_output_barrel')
write('routing/round12-analog-plan.json',dict(prefix='round12-analog',candidateOnly=True,
    placement='routing/round12-analog-placement.circuit.json',retained='routing/round12-analog-retained.json',
    extent=[-20.9,-20.9,20.9,20.9],jobs=[dict(source=source['source_trace_id'],constraints=dict(min_trace_thickness=.15),
        start=point(route[first]),target=point(route[last]))]))
print(json.dumps(dict(source=source['source_trace_id'],net=net,otherCopperFixed=True)))