rushabhcodes/desk-fidget-counter

A PLA desk fidget counter assembly houses an F1 PCB, 1.28-inch LCD with harness, rotary knob/bearing mechanism, button cap, and screw-secured base/display mount.

Version
6.0.16
License
MIT
Stars
0

Use with the tscircuit CLI

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

tsci clone rushabhcodes/desk-fidget-counter  # download the package files into ./desk-fidget-counter
tsci add rushabhcodes/desk-fidget-counter    # add it to your project as @tsci/rushabhcodes.desk-fidget-counter

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.

routing/replay.ts

import stored from "./verified.json"
import { routingSignature } from "./signature"
export { routingSignature } from "./signature"

// A conservative guard: any routing input change requires regenerating and
// independently checking the stored copper. This also runs in the web viewer.
export async function verifiedRouting(input: any) {
  const signature = routingSignature(input)
  if (signature !== stored.input_signature) throw new Error(
    `Stored PCB routing is stale: expected ${stored.input_signature}, received ${signature}. Regenerate routing and repeat copper checks.`)
  const handlers: Record<string, (event: any) => void> = {}
  const traces = stored.traces
  return {
    on(event: string, handler: (event: any) => void) { handlers[event] = handler; return this },
    start() { handlers.complete?.({ traces }) },
    stop() {},
    getOutputSimpleRouteJson() { return { ...input, traces } },
  }
}