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/plan-fab-buck-pocket.mjs

import fs from "node:fs"
import { repositionPcbComponentTo, transformPcbElements } from "@tscircuit/circuit-json-util"
import { rotateDEG } from "transformation-matrix"

const circuit = JSON.parse(fs.readFileSync("dist/index/circuit.json", "utf8"))
const plan = process.argv[2] ? JSON.parse(process.argv[2]) : {
  R_BUCK_FF: { x: -11.6, y: 2, rotation: 0, layer: "bottom" },
  C_BUCK_FF: { x: -11.25, y: 0.45, rotation: 90, layer: "bottom" },
}
for (const [name, target] of Object.entries(plan)) {
  const source = circuit.find(e => e.type === "source_component" && e.name === name)
  const pcb = circuit.find(e => e.type === "pcb_component" && e.source_component_id === source.source_component_id)
  transformPcbElements(circuit.filter(e => e === pcb || e.pcb_component_id === pcb.pcb_component_id),
    rotateDEG(target.rotation - pcb.rotation, pcb.center.x, pcb.center.y))
  repositionPcbComponentTo(circuit, pcb.pcb_component_id, target)
}
fs.writeFileSync("routing/fab-buck-pocket.circuit.json", JSON.stringify(circuit, null, 2) + "\n")
fs.writeFileSync("routing/fab-buck-pocket-placement.json", JSON.stringify(plan, null, 2) + "\n")
console.log(JSON.stringify(plan))