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.

docs/registry-build.md

# Hosted build configuration — 12 November 2026

Release 1.0.4 completed circuit generation and its preview worker. Its hosted
job later disconnected during CommonJS bundling, reporting
`ReadableStream received over RPC disconnected prematurely`. The service
classified this as `user_code_job_infrastructure_error`; its log does not
establish the underlying infrastructure or memory failure.

The earlier `Could not save autorouting paths` message is a caught CLI warning.
The optional replay exporter cannot express some of the saved board routes as
paths anchored to unique ports. Circuit generation continues. The project's
own reviewed route plan and stale-input guard remain in use.

`tscircuit.config.json` now selects `scripts/build-registry.mjs` through the
supported `buildCommand` option. The script runs PCB/previews/site generation
to completion in one process, then runs ESM, CommonJS and declaration generation
in a separate process. This releases the PCB/render worker before bundling.
Both stages must succeed; neither circuit DRC nor failures are suppressed.

The same command passes locally, including both JS formats and declarations.
The independent native DRC, manufacturing-clearance, connectivity/power-width,
Kelvin, cleanup, courtyard/screw, pad-anchor and USB checks pass. Comparison
against the previous validated circuit finds identical component placement,
electrical nets, copper geometry and CAD records after excluding regenerated
IDs, supplier metadata and derived route annotations. No circuit, placement,
component or route-plan source changed for this workaround.

Local diagnostic and validation evidence is under
`.tscircuit/registry-build-20261112`. Hosted publication/build status is recorded
separately there; local success alone does not establish hosted success.

The first hosted retry (1.0.5) exposed a separate dependency problem:
`DRC could not complete (routing): undefined is not an object (evaluating
'relate(shape1, shape2).covered')`. The hosted runner injects links to globally
installed packages before running the project's install. Bun 1.3.12's ordinary
install retained the global `@tscircuit/circuit-json-util` link while installing
local `@tscircuit/checks` and `@flatten-js/core`. The two geometry-library copies
have distinct Point/Polygon constructors, breaking the checker's `instanceof`
tests even for a point at the center of a simple square.

This was reproduced locally using the runner's published symlink setup, its
current global tscircuit 0.0.3164, our lockfile (tscircuit 0.0.3133), and Bun
1.3.12. Native routing checks on the unchanged validated circuit crashed at
`getViaContactIndex` with the same error. A forced, frozen-lockfile install
replaced the surviving global link with a local package, restored shared
geometry constructors, and allowed routing checks to complete without errors.

The supported `prebuildCommand` now runs
`bun install --force --frozen-lockfile` before starting the separate build
processes. It refreshes dependencies from the committed lockfile; it does not
patch libraries, edit the circuit, or suppress DRC. The exact reproduction and
before/after logs are retained in the diagnostic evidence directory.

Release 1.0.6 confirmed this dependency fix on the hosted service: its PCB
stage reported one circuit passed and generated previews. The later CommonJS
bundle again ended with the infrastructure RPC disconnection. Separating the
stages alone was therefore insufficient to resolve the overall hosted build.

The bundling stage now invokes the same installed CLI using Node.js instead
of Bun. The hosted sandbox image (Cloudflare sandbox 0.12.7) includes Node 24.
Local runs produced byte-identical ESM, CommonJS and declaration files across
the two runtimes. The measured Node run peaked at 3,663 MiB RSS; Bun's normal
and low-memory runs were approximately 5.3 GiB. These are local measurements,
not proof of the remote service's memory limit or the cause of its disconnect.
No routing-data conversion or circuit changes are needed for this runtime
workaround. Hosted success must still be confirmed for the new release.

The 1.0.7 hosted run again passed PCB generation. Node then reported an
explicit `FATAL ERROR: Reached heap limit` at approximately 2,044 MB, revealing
that its hosted default heap was too small. The bundler command now sets
`--max-old-space-size=3072`. This exact command completes locally in 24.54 s,
peaks at 3,174 MiB RSS and preserves byte-identical output. The earlier 2 GiB
limit also failed locally; no checker error is being bypassed. This evidence
establishes the Node heap-limit failure, while the earlier Bun RPC disconnects
remain infrastructure errors without an exposed underlying cause.

## Upload size — 30 November 2026

The registry now rejects this package's single-archive upload with HTTP 413 (seen at 33.2, 23.5, 22.9 and 15.8 MB request size; the 2.0.24 archive of about 23.9 MB was still accepted earlier the same day). The CLI then falls back to file-by-file uploads, which accepted 3.7 MB per request and rejected 5.5 MB. A locally built `dist/index/circuit.json` (10.7 MB, 6.6 MB minified) therefore cannot be published at present, and the package depends on the hosted build for its circuit JSON until archive uploads work again. Releases 2.0.25 to 2.0.28 and 2.0.30 are incomplete uploads from these attempts. Release 2.0.29 uploaded completely; its hosted build failed with `ReadableStream received over RPC disconnected prematurely` (`user_code_job_infrastructure_error`).

Two inputs exceed the per-file limit: `circuit/route-plan.json` and `dist/pcb/circuit.json`. `bun scripts/large-files.mjs pack` writes a `.gz` beside each one and records size and sha256 in `scripts/large-files.json`. The raw paths are in `ignoredFiles`, so only the `.gz` copies are uploaded. Each ignore entry ends in a one-character class such as `.jso[n]`: the CLI treats an entry without glob characters as a directory name, which would not match the file. `scripts/build-registry.mjs` calls `restore()` first, which recreates the raw files byte-for-byte and checks each hash, so the PCB-baseline guard is unaffected. The hosted build sandbox is not given `dist/**`, so a missing `dist/` entry is skipped. After `tsci clone`, run `bun run restore:large` before building.

`assets/connected-system.glb` must not be packed this way. The tscircuit.com 3D viewer downloads it from the package by that exact path, so release 2.0.31, which carried only `assets/connected-system.glb.gz`, built correctly but showed no display, motor, encoder or cables (the download answered 404). The asset is therefore published as a plain file again. To fit the per-file limit it was re-packed on 30 November 2026 from 4,121,292 to 2,502,180 bytes: exactly identical vertices (same position and normal bits) within each primitive are stored once and referenced by index, and the `TEXCOORD_0` arrays are dropped because no material uses a texture. Triangles, normals, node names, transforms, materials and the authored bounds are unchanged; three.js `GLTFLoader` returns the same 180 meshes and 46,140 triangles for both files. `assets/connected-system.provenance.json` records the new hash (`2fa9e903...`; the unpacked export was `9bfecb0c...`). `bun run assembly:build` writes the unpacked form again, so repeat the re-pack before publishing while the limit applies.

The third-party datasheet PDFs under `docs/oled154-reference` are listed in `ignoredFiles` and are no longer published; `docs/oled154-reference/README.md` lists their sources. Locally built outputs that the hosted build regenerates (`dist/index.js`, `dist/index.cjs`, `dist/index.d.ts`, `dist/index.html`, `dist/index/circuit.json`, `dist/index/pcb.svg`, `dist/index/schematic.svg`, `dist/index/3d.png` and `dist/assets/**`) are above the per-file limit or redundant: publish from a tree that does not contain them while archive uploads are rejected.