biscuitboard 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -78,14 +78,39 @@ bun run snapshot:clad-40x40
78
78
  bun test tests/clad-40x40.test.tsx
79
79
  ```
80
80
 
81
+ ## 32 mm square corner-via clad
82
+
83
+ [`Clad32x32`](./lib/Clad32x32.tsx) is a two-layer 32 mm x 32 mm clad with four
84
+ 2 mm mounting holes, each inset 3 mm from its corner, and no center mounting
85
+ hole. Four two-via-wide L-shaped fields provide 64 assignable prefabricated
86
+ vias. The fields sit close to the mounting holes, with 1.3 mm of copper
87
+ clearance, and leave 18.2 mm openings at the middle of every side for edge
88
+ connectors. The vias use 0.3 mm drills, 0.6 mm pads, and a 1.3 mm pitch.
89
+
90
+ ```tsx
91
+ import { Clad32x32 } from "@tsci/tscircuit.biscuit-boards";
92
+
93
+ export default () => <Clad32x32 />;
94
+ ```
95
+
96
+ The preview and checked-in PCB snapshot are in
97
+ [`examples/clad-32x32.tsx`](./examples/clad-32x32.tsx).
98
+
99
+ ```sh
100
+ bun run build:clad-32x32
101
+ bun run snapshot:clad-32x32
102
+ bun test tests/clad-32x32.test.tsx
103
+ ```
104
+
81
105
  ## Combined clad panel
82
106
 
83
107
  [`CladPanel`](./lib/CladPanel.tsx) places the breadboard clad at the upper-left
84
- and the Arduino UNO R3 shield at the upper-right. Two standard XIAO clads and
85
- two perforated XIAO clads sit below the breadboard. A Feather clad occupies the
86
- remaining lower-left space, replacing four XIAOs; the TI BoosterPack remains at
87
- the lower-right. The resulting 158 mm x 118 mm fabrication panel has 2 mm
88
- tab-routing gaps, 3 mm edge rails, and mouse bites enabled by default.
108
+ and the Arduino UNO R3 shield at the upper-right. The 32 mm square clad replaces
109
+ one standard and one perforated XIAO below the breadboard; the remaining
110
+ standard and perforated XIAOs sit above it, with the Feather alongside. The TI
111
+ BoosterPack remains at the lower-right. The resulting fabrication panel remains
112
+ 158 mm x 118 mm, with 2 mm tab-routing gaps, 3 mm edge rails, and mouse bites
113
+ disabled by default.
89
114
 
90
115
  ```sh
91
116
  bun run build:clad-panel
package/dist/npm.cjs CHANGED
@@ -14258,6 +14258,31 @@ var createBiscuitBoardAutorouter = (options = {}) => ({
14258
14258
  var createBiscuitBoardAutorouter2 = (options = {}) => createBiscuitBoardAutorouter(options);
14259
14259
 
14260
14260
  // lib/create-prefabricated-via-autorouter.ts
14261
+ var ROUTER_COORDINATE_SCALE = 1e6;
14262
+ var ROUTER_COORDINATE_EPSILON = 1e-7;
14263
+ var normalizeCoordinate = (value) => Math.round(value * ROUTER_COORDINATE_SCALE) / ROUTER_COORDINATE_SCALE;
14264
+ var normalizePoint = (point) => {
14265
+ const x = normalizeCoordinate(point.x);
14266
+ const y = normalizeCoordinate(point.y);
14267
+ if (Math.abs(x - point.x) <= ROUTER_COORDINATE_EPSILON && Math.abs(y - point.y) <= ROUTER_COORDINATE_EPSILON) {
14268
+ return point;
14269
+ }
14270
+ return { ...point, x, y };
14271
+ };
14272
+ var normalizeRouterTerminalCoordinates = (input) => {
14273
+ let inputChanged = false;
14274
+ const connections = input.connections.map((connection) => {
14275
+ const pointsToConnect = connection.pointsToConnect.map(normalizePoint);
14276
+ if (pointsToConnect.every(
14277
+ (point, pointIndex) => point === connection.pointsToConnect[pointIndex]
14278
+ )) {
14279
+ return connection;
14280
+ }
14281
+ inputChanged = true;
14282
+ return { ...connection, pointsToConnect };
14283
+ });
14284
+ return inputChanged ? { ...input, connections } : input;
14285
+ };
14261
14286
  var createPrefabricatedViaAutorouter = ({
14262
14287
  width,
14263
14288
  height,
@@ -14269,27 +14294,31 @@ var createPrefabricatedViaAutorouter = ({
14269
14294
  }) => ({
14270
14295
  ...createBiscuitBoardAutorouter2(options),
14271
14296
  algorithmFn: async (input) => {
14297
+ const normalizedInput = normalizeRouterTerminalCoordinates(input);
14272
14298
  const maximumTraceWidth = Math.max(
14273
- input.minTraceWidth,
14274
- input.nominalTraceWidth ?? 0,
14299
+ normalizedInput.minTraceWidth,
14300
+ normalizedInput.nominalTraceWidth ?? 0,
14275
14301
  minimumTraceWidth ?? 0,
14276
14302
  nominalTraceWidth,
14277
- ...input.connections.map(
14278
- (connection) => connection.width ?? input.minTraceWidth
14303
+ ...normalizedInput.connections.map(
14304
+ (connection) => connection.width ?? normalizedInput.minTraceWidth
14279
14305
  )
14280
14306
  );
14281
14307
  return new BiscuitBoardAutorouter(
14282
14308
  {
14283
- ...input,
14284
- minTraceWidth: Math.max(input.minTraceWidth, minimumTraceWidth ?? 0),
14309
+ ...normalizedInput,
14310
+ minTraceWidth: Math.max(
14311
+ normalizedInput.minTraceWidth,
14312
+ minimumTraceWidth ?? 0
14313
+ ),
14285
14314
  nominalTraceWidth: Math.max(
14286
- input.nominalTraceWidth ?? 0,
14315
+ normalizedInput.nominalTraceWidth ?? 0,
14287
14316
  nominalTraceWidth,
14288
14317
  minimumTraceWidth ?? 0
14289
14318
  ),
14290
- connections: input.connections.map((connection) => {
14319
+ connections: normalizedInput.connections.map((connection) => {
14291
14320
  const width2 = Math.max(
14292
- connection.width ?? input.minTraceWidth,
14321
+ connection.width ?? normalizedInput.minTraceWidth,
14293
14322
  minimumTraceWidth ?? 0
14294
14323
  );
14295
14324
  return {
@@ -14302,7 +14331,7 @@ var createPrefabricatedViaAutorouter = ({
14302
14331
  )
14303
14332
  };
14304
14333
  }),
14305
- obstacles: [...input.obstacles, ...reservedObstacles],
14334
+ obstacles: [...normalizedInput.obstacles, ...reservedObstacles],
14306
14335
  // The clad DRC measures clearance from the copper edge, while this
14307
14336
  // router bound constrains trace centerlines.
14308
14337
  minBoardEdgeClearance: edgeClearance + maximumTraceWidth / 2,