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/export-completed-seed.py
"""Seed only emitted port-to-port copper, excluding abandoned router fragments."""
from route_geometry import *
from collections import defaultdict
import os
circuit=load_circuit()
root=connectivity(circuit)
mapping=json.loads(Path("routing/net-map.json").read_text())
sources={e["source_trace_id"]:e for e in circuit if e["type"]=="source_trace"}
traces=([e for e in circuit if e['type']=='pcb_trace' and e.get('source_trace_id') in sources
and not e.get('pcb_component_id')] if os.environ.get('AUDIT_EMITTED_COPPER')
else json.loads(Path("routing/complete-routes.json").read_text()))
nets=defaultdict(list)
seen=set()
for trace in traces:
source=sources[trace["source_trace_id"]]
net=mapping["roots"][root((source.get("connected_source_port_ids",[])+source.get("connected_source_net_ids",[]))[0])]
for p in trace["route"]:
if p["route_type"]!="via":continue
key=(net,round(p["x"],6),round(p["y"],6))
if key in seen:continue
seen.add(key)
nets[net].append(f'(via VIA {p["x"]*10000:.0f} {p["y"]*10000:.0f})')
for a,b in zip(trace["route"],trace["route"][1:]):
if a["route_type"]!=b["route_type"] or a["route_type"]!="wire" or a["layer"]!=b["layer"]:continue
if math.dist((a["x"],a["y"]),(b["x"],b["y"]))<1e-7:continue
width=max(a["width"],b["width"])
nets[net].append(f'(wire (path {a["layer"]} {width*10000:.0f} {a["x"]*10000:.0f} {a["y"]*10000:.0f} {b["x"]*10000:.0f} {b["y"]*10000:.0f}))')
text='(session emitted (routes (resolution um 10) (network_out\n'
text+='\n'.join(f'(net {net}\n'+ '\n'.join(items)+')' for net,items in nets.items())
text+=')))\n'
Path("routing/emitted-seed.ses").write_text(text)
print(f"Exported {len(traces)} completed paths, {len(seen)} unique drills; no abandoned SES fragments")