imrishabh18/rp2040-motor-controller

An RP2040-based NEMA17 stepper-motor controller with USB-C programming and PD motor-power negotiation, DRV8825 dual H-bridge drive, current/temperature telemetry, protected power filtering, status RGB LED, buzzer alarm, and optional magnetic encoder.

Version
1.0.41
License
unset
Stars
3

patches/@tscircuit%2Fchecks@0.0.232.patch

diff --git a/dist/index.js b/dist/index.js
index 696af64ba42aada02de8c9b27b0da204f692cf4f..0194f8cca5857833ec5ac4392ce02d2448b849f9 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -336,18 +336,23 @@ import { getPourPolygon, getViaPolygon } from "@tscircuit/circuit-json-util";
 
 // lib/copper-pour-connectivity/create-copper-polygon-contact-tester.ts
 import {
-  Box
+  Box,
+  Polygon as ContactPolygon
 } from "@flatten-js/core";
 function createCopperPolygonContactTester(tolerance) {
   const cache = /* @__PURE__ */ new WeakMap();
   const getGeometry = (polygon) => {
     let geometry = cache.get(polygon);
     if (!geometry) {
+      // Flatten uses instanceof for geometry dispatch. Rehydrate shapes from
+      // another module instance once, preserving arcs, holes, and faces.
+      const localPolygon = polygon.constructor === ContactPolygon ? polygon : new ContactPolygon(polygon.toJSON());
       geometry = {
-        box: polygon.box,
-        facePoints: [...polygon.faces].map((face) => face.first.start),
-        edges: [...polygon.edges].map((edge) => edge.shape),
-        edgeIndex: polygon.edges
+        polygon: localPolygon,
+        box: localPolygon.box,
+        facePoints: [...localPolygon.faces].map((face) => face.first.start),
+        edges: [...localPolygon.edges].map((edge) => edge.shape),
+        edgeIndex: localPolygon.edges
       };
       cache.set(polygon, geometry);
     }
@@ -360,8 +365,8 @@ function createCopperPolygonContactTester(tolerance) {
     if (ga.box.xmin > gb.box.xmax + tolerance || ga.box.xmax < gb.box.xmin - tolerance || ga.box.ymin > gb.box.ymax + tolerance || ga.box.ymax < gb.box.ymin - tolerance)
       return false;
     if (ga.facePoints.some(
-      (point2) => gb.box.contains(point2) && b.contains(point2)
-    ) || gb.facePoints.some((point2) => ga.box.contains(point2) && a.contains(point2)))
+      (point2) => gb.box.contains(point2) && gb.polygon.contains(point2)
+    ) || gb.facePoints.some((point2) => ga.box.contains(point2) && ga.polygon.contains(point2)))
       return true;
     const [small, large] = ga.edges.length <= gb.edges.length ? [ga, gb] : [gb, ga];
     for (const edge of small.edges) {