muse/book-reading-clip-lamp

A Wi‑Fi/USB‑C ESP32‑S3 reading lamp with OV5640 camera, microphone, speaker amplifier, rechargeable Li‑Po power management, six-LED boost light, USB protection/charging detection, and a clip/gooseneck enclosure with external FlexPIFA antenna.

Version
0.4.3
License
unset
Stars
0

export-board-preview.mjs

import { readFileSync, writeFileSync } from "node:fs"
import { convertCircuitJsonToGltf } from "circuit-json-to-gltf"
import { splitPcbPreview } from "./split-pcb-preview.mjs"

// The native tscircuit view contains the complete assembly. This second export
// splits the PCB from the enclosure so the review page can animate an explosion.
const circuit = JSON.parse(readFileSync("dist/index/circuit.json", "utf8"))
const pcbCad = circuit.filter(e => e.type !== "cad_component" || e.pcb_component_id)
const result = await convertCircuitJsonToGltf(pcbCad, {
  format: "glb", includeModels: true, boardTextureResolution: 1600,
  showBoundingBoxes: true,
})
writeFileSync("mechanical/pcb.glb", Buffer.from(result))
splitPcbPreview("mechanical/pcb.glb")
console.log("Exported routed PCB, exact supplier models and switch references to mechanical/pcb.glb")