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-controllerIn 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/check-drawings.mjs
/**
* Validate the native enclosure drawings.
* - BLDC-ENC-01 (3 sheets) lives in the product model: checked in dist/index/circuit.json
* (run build:package first). tscircuit.com renders it on the package's Drawing tab.
* - BLDC-ENC-02 (exploded view) is built from enclosure/drawings.circuit.tsx and copied to
* docs/drawings/enclosure_exploded_view.svg.
* Pass --rendered to also check SVGs from `tsci build index.tsx --drawings` (1:1 labels).
*/
import { copyFileSync, existsSync, mkdirSync, readFileSync } from "node:fs"
import assert from "node:assert/strict"
function checkDrawing(file, expected) {
const circuit = JSON.parse(readFileSync(file, "utf8"))
const errors = circuit.filter(r => r.type.endsWith("_error"))
assert.equal(errors.length, 0, `${file} has errors: ${errors.map(e => e.message).join("; ")}`)
const pages = circuit.filter(r => r.type === "drawing_page")
const views = circuit.filter(r => r.type === "drawing_part_view")
const blocks = circuit.filter(r => r.type === "drawing_page_title_block")
assert.deepEqual(pages.map(p => p.name).sort(), Object.keys(expected).sort(), `${file}: drawing pages`)
for (const page of pages) {
const names = views.filter(v => v.drawing_page_id === page.drawing_page_id).map(v => v.name)
assert.deepEqual(names.sort(), [...expected[page.name]].sort(), `${page.name} views`)
assert.equal(blocks.filter(b => b.drawing_page_id === page.drawing_page_id).length, 1, `${page.name} title block`)
}
return { pages: pages.length, views: views.length, sections: views.filter(v => v.section).length }
}
const main = checkDrawing("dist/index/circuit.json", {
enclosure_general_arrangement: ["REAR_VIEW", "PLAN_VIEW", "LEFT_VIEW", "ISOMETRIC"],
enclosure_sections: ["SECTION_A_A", "SECTION_B_B", "SECTION_C_C", "SECTION_A_A_ISOMETRIC"],
enclosure_printed_parts: ["PART_1", "PART_2", "PART_3", "PART_4", "PART_5", "PART_6"],
})
assert.equal(main.sections, 4, "Four section views expected")
const exploded = checkDrawing("enclosure/dist/drawings/circuit.json", {
enclosure_exploded_view: ["EXPLODED_ISOMETRIC", "EXPLODED_FRONT"],
})
const svg = "enclosure/dist/drawings/drawings/enclosure_exploded_view.svg"
assert.ok(existsSync(svg), `Missing ${svg}`)
mkdirSync("docs/drawings", { recursive: true })
copyFileSync(svg, "docs/drawings/enclosure_exploded_view.svg")
if (process.argv.includes("--rendered")) {
// Orthographic views on the general arrangement must share one 1:1 scale.
const ga = readFileSync("dist/index/drawings/enclosure_general_arrangement.svg", "utf8")
for (const label of ["Rear view (motor connectors) · 1:1", "Plan (rear edge down) · 1:1", "Left view (USB / POWER) · 1:1"])
assert.ok(ga.includes(label), `General arrangement must show "${label}"`)
}
console.log(`PASS: BLDC-ENC-01 ${main.pages} sheets / ${main.views} views (${main.sections} sections) in the product model; BLDC-ENC-02 exploded view copied to docs/drawings`)