MustafaMulla29/rp2040-bldc-motor-controller

Hardware assembly metadata and PCB geometry for a controller board with a snap-off rotary-encoder section, plus four parallel 150 µF/50 V bulk electrolytic capacitors filtering the motor supply.

Version
2.0.40
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone MustafaMulla29/rp2040-bldc-motor-controller  # download the package files into ./rp2040-bldc-motor-controller
tsci add MustafaMulla29/rp2040-bldc-motor-controller    # add it to your project as @tsci/MustafaMulla29.rp2040-bldc-motor-controller

In 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.

scripts/build-registry.mjs

/** Keep the PCB/render worker out of memory while Rollup builds JS bundles. */
import { spawnSync } from "node:child_process"
import { cpSync } from "node:fs"
import { createRequire } from "node:module"
import { resolve } from "node:path"
import { restore } from "./large-files.mjs"

const project = resolve(import.meta.dirname, "..")
const require = createRequire(import.meta.url)
const cli = require.resolve("@tscircuit/cli")
// Published packages carry the largest inputs as .gz (registry upload limit).
// Recreate them, sha256-checked, before anything imports them.
restore()

const stages = [
  // Match build:pcb: use the authored imports and supplier assignments rather
  // than fetching fresh parts-engine models during a release build.
  ["PCB, previews and site", "bunx", ["tsci", "build", "index.tsx", "--disable-parts-engine", "--site", "--use-cdn-javascript", "--preview-images"]],
  // The cloud's 2 GiB default heap is too small for this Rollup/TypeScript
  // build. A bounded 3 GiB heap completes locally with identical output.
  ["JavaScript bundles and declarations (Node.js, 3 GiB heap)", "node", ["--max-old-space-size=3072", cli, "transpile", "index.tsx"]],
]

for (const [name, command, args] of stages) {
  console.log(`Registry build: ${name}`)
  const result = spawnSync(command, args, {
    cwd: project,
    stdio: "inherit",
    env: process.env,
  })
  if (result.error) throw result.error
  if (result.status !== 0) {
    console.error(`Registry build stopped during ${name}${result.signal ? ` (${result.signal})` : ""}`)
    process.exit(result.status ?? 1)
  }
}

// The site builder can leave an older dist/assets copy in place. Always ship
// the same mechanical assets that were validated against the current PCB.
cpSync(resolve(project, "assets"), resolve(project, "dist/assets"), { recursive: true })