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/inspect-drill-site.py
"""Print actual nearby foreign metal for a targeted manual drill repair."""
from route_geometry import *
import sys
c=load_circuit("dist/index/circuit.json");root=connectivity(c)
x,y=map(float,sys.argv[1:3]);center=Point(x,y)
src={e["source_component_id"]:e["name"] for e in c if e["type"]=="source_component"}
names={e["pcb_component_id"]:src[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"}
def net(t):
s=sources[t["source_trace_id"]]
return root((s.get("connected_source_port_ids",[])+s.get("connected_source_net_ids",[]))[0])
traces={e["pcb_trace_id"]:e for e in c if e["type"]=="pcb_trace"}
via=next(e for e in c if e["type"]=="pcb_via" and math.dist((e["x"],e["y"]),(x,y))<1e-6)
own=net({"source_trace_id":via.get("source_trace_id",traces.get(via.get("pcb_trace_id"),{}).get("source_trace_id"))})
seen=set();out=[]
for e in c:
if e["type"]=="pcb_trace" and e.get("source_trace_id"):
n=net(e)
for a,b in zip(e["route"],e["route"][1:]):
if a["route_type"]==b["route_type"]=="wire" and a["layer"]==b["layer"]:
points=((a["x"],a["y"]),(b["x"],b["y"]))
if math.dist(*points)<1e-7:continue
g=LineString(points).buffer(max(a["width"],b["width"])/2)
k=(n,a["layer"],tuple(sorted(points)))
if k in seen or center.distance(g)>.38:continue
seen.add(k);out.append(dict(kind="wire",net=n,own=n==own,layer=a["layer"],points=points,width=a["width"],distance=round(center.distance(g)-.15,6)))
if e["type"]=="pcb_smtpad":
p=ports.get(e.get("pcb_port_id"));n=root(p["source_port_id"]) if p else None
g=geometry(e)
if center.distance(g)>.38:continue
out.append(dict(kind="pad",name=names[e["pcb_component_id"]],net=n,own=n==own,layer=e["layer"],bounds=g.bounds,distance=round(center.distance(g)-.15,6)))
if "--bad-only" in sys.argv:out=[e for e in out if not e["own"] and e["distance"]<.2]
if "--foreign" in sys.argv:out=[e for e in out if not e["own"]]
print(json.dumps(out,indent=None if "--compact" in sys.argv else 2))