seveibar/pd-dual-stepper-controller

Bottom-side PCB silkscreen artwork consisting of embedded mirrored TS Circuit SVG logos, with via-clearance-aware lower-board placement.

Version
0.1.0
License
unset
Stars
0

routing/dual-saved-routing.ts

import plan from "./dual-route-plan.json";
import {canonicalRoutingInput} from "./saved-routing";

/** Rebuild verified copper through core, including vias, pours and normal DRC. */
export const dualSavedRouting = async (input: unknown) => {
  if (canonicalRoutingInput(input) !== canonicalRoutingInput(plan.expectedInput)) {
    throw new Error("The PCB placement or connectivity changed. Regenerate and validate routing/dual-route-plan.json before using the saved copper.");
  }
  const listeners = new Map<string, Array<(event: any) => void>>();
  return {
    on(name: string, callback: (event: any) => void) {
      listeners.set(name, [...listeners.get(name) ?? [], callback]);
    },
    start() {
      for (const callback of listeners.get("complete") ?? []) callback({traces:structuredClone(plan.traces)});
    },
    stop() {},
  };
};