MustafaMulla29/wireless-mouse-pcb
A 3D-printed wireless mouse enclosure housing a 44×70 mm PCB with nRF52810 BLE control, optical sensor, USB-C LiPo charging/power circuitry, buttons, scroll encoder/wheel, and battery bay.
- Version
- 1.0.18
- License
- unset
- Stars
- 0
Use with the tscircuit CLI
tsci is the tscircuit CLI. Install it with npm install -g tscircuit.
tsci clone MustafaMulla29/wireless-mouse-pcb # download the package files into ./wireless-mouse-pcb
tsci add MustafaMulla29/wireless-mouse-pcb # add it to your project as @tsci/MustafaMulla29.wireless-mouse-pcbIn 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.
enclosure/labels.tsx
import modeling from "@jscad/modeling"
import { jscad } from "jscad-fiber/headless"
import { dpi, power, roofOuter } from "./dimensions"
export const labelStroke = 0.4
export const labelSpacing = 1.42
export const labelDepth = 0.4
export const lidLabels = [
{ text: "DPI", x: dpi.x - 3.4, y: dpi.y + 4.6, height: 1.5 },
{ text: "PWR", x: power.x - 3.6, y: power.y - power.outerDepth / 2 - 2.8, height: 1.5 },
]
export function labelLines({ text, x, y, height }: { text: string; x: number; y: number; height: number }) {
return modeling.text.vectorText({ input: text, height: height / 1.5, xOffset: x, yOffset: y, letterSpacing: labelSpacing }) as number[][][]
}
// Engraved strokes from JSCAD's vector font (as in the BLDC lid). Each stroke
// follows the sloped roof at its own Y.
export function EngravedText({ text, x, y, height = 2, surface = roofOuter }: { text: string; x: number; y: number; height?: number; surface?: (y: number) => number }) {
const lines = labelLines({ text, x, y, height })
const radius = labelStroke / 2
return (
<>
{lines.flatMap((line, i) =>
line.slice(1).map((p, j) => {
const a = line[j]
const dx = p[0] - a[0]
const dy = p[1] - a[1]
const length = Math.hypot(dx, dy)
if (length < 0.0001) return null
const my = (p[1] + a[1]) / 2
const z = surface(my) - labelDepth
return (
<jscad.translate key={`${i}:${j}`} offset={[(p[0] + a[0]) / 2, my, z + 1]}>
<jscad.rotate angles={[0, 0, Math.atan2(dy, dx)]}>
<jscad.cuboid size={[length + radius, 2 * radius, 2]} />
</jscad.rotate>
</jscad.translate>
)
}),
)}
</>
)
}