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/check-probe-plan.py
"""Evaluate a proposed debug-pad separation against actual emitted copper."""
from route_geometry import *
from collections import defaultdict
from shapely.ops import unary_union
c=load_circuit("dist/index/circuit.json");root=connectivity(c)
parts={e["source_component_id"]:e["name"] for e in c if e["type"]=="source_component"}
pcb={e["pcb_component_id"]:parts[e["source_component_id"]] for e in c if e["type"]=="pcb_component"}
ports={e["pcb_port_id"]:e for e in c if e["type"]=="pcb_port"}
sources={e["source_trace_id"]:e for e in c if e["type"]=="source_trace"}
plan={"PE6":(5.800094,-.59999),"PE7":(5.4,-.14),"PE5":(6.2,-.14)}
delta={}
for e in c:
if e["type"]=="pcb_component" and pcb[e["pcb_component_id"]] in plan:
name=pcb[e["pcb_component_id"]];old=(e["center"]["x"],e["center"]["y"])
delta[name]=(old,plan[name])
for e in c:
if e["type"]=="pcb_smtpad" and pcb[e["pcb_component_id"]] in plan:
e["x"],e["y"]=plan[pcb[e["pcb_component_id"]]]
if e["type"]=="pcb_trace":
for p in e["route"]:
for old,new in delta.values():
if math.dist((p["x"],p["y"]),old)<1e-7:p["x"],p["y"]=new
metal=[]
for e in c:
if e["type"]=="pcb_smtpad":
p=ports.get(e.get("pcb_port_id"));n=root(p["source_port_id"]) if p else None
metal.append((n,e["layer"],geometry(e),pcb[e["pcb_component_id"]],True))
if e["type"]=="pcb_trace" and e.get("source_trace_id"):
s=sources[e["source_trace_id"]];n=root((s.get("connected_source_port_ids",[])+s.get("connected_source_net_ids",[]))[0])
for a,b in zip(e["route"],e["route"][1:]):
if a["route_type"]==b["route_type"]=="wire" and a["layer"]==b["layer"] and math.dist((a["x"],a["y"]),(b["x"],b["y"]))>1e-7:
metal.append((n,a["layer"],LineString([(a["x"],a["y"]),(b["x"],b["y"])]).buffer(max(a["width"],b["width"])/2),e["pcb_trace_id"],False))
findings=[]
for n,l,g,name,pad in metal:
if not pad or name not in plan:continue
for nn,ll,h,other,otherpad in metal:
if n==nn or l!=ll:continue
required=.15 if otherpad else .1
d=g.distance(h)
if d<required-.0002:findings.append(dict(pad=name,other=other,gap=round(d,6),required=required))
print(json.dumps(dict(plan=plan,findings=findings)))
if findings:raise SystemExit(1)