MustafaMulla29/usb-pd-motherboard
4-layer USB-C PD hub motherboard with 20 V USB-C input, Linux T113-S3 computer, CH338F USB hub, four individually controlled 5–20 V PD outputs, USB data/camera ports, regulated rails, and hardware watchdog/E-stop safety interlock.
- Version
- 1.0.24
- License
- unset
- Stars
- 0
Use with the tscircuit CLI
tsci is the tscircuit CLI. Install it with npm install -g tscircuit.
tsci clone MustafaMulla29/usb-pd-motherboard # download the package files into ./usb-pd-motherboard
tsci add MustafaMulla29/usb-pd-motherboard # add it to your project as @tsci/MustafaMulla29.usb-pd-motherboardIn a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.
tools/sch-chip-sizes.py
#!/usr/bin/env python3
"""Apply tscircuit's own box-size advice for chip symbols.
After a schematic build, tscircuit says when a chip's box is larger than its pins need ("Reduce schWidth to ...",
"Set schWidth=..., schHeight=..."). This writes those sizes into data/schematic-placements.json (per part name).
Run it after a build, rebuild, and repeat until it reports 0 changes.
usage: python3 -I tools/sch-chip-sizes.py [dist/codex-schematic.circuit.json]
"""
import json, re, sys
cj = json.load(open(sys.argv[1] if len(sys.argv) > 1 else "dist/codex-schematic.circuit.json"))
pl = json.load(open("data/schematic-placements.json"))
changed = 0
msgs = [str(e.get("message")) for e in cj if e["type"] == "schematic_component_styling_warning"]
# the "pin banks" advice gives both sizes and wins; the "horizontal space" advice is used when it is the only one
for pat in (r"^(\S+) has excessive horizontal space.*Reduce schWidth to ([\d.]+)", r"^(\S+) has excessive space between its pin banks"):
for m in msgs:
g = re.match(pat, m)
if not g:
continue
ent = pl.setdefault(g.group(1), {})
vals = {"schWidth": float(g.group(2))} if g.lastindex == 2 else \
{k: float(v) for k, v in re.findall(r"(schWidth|schHeight)=([\d.]+)", m)}
for k, v in vals.items():
v = round(v + 1e-9, 3)
if ent.get(k) != v:
ent[k] = v; changed += 1
json.dump(pl, open("data/schematic-placements.json", "w"), indent=2)
print(changed, "box sizes changed;", len(msgs), "styling notes in this build")