krishnax12/tensa-zangetsu-keychain-nfc
Summary: Calculates target inductance and estimated resonance for a 14.5 MHz square antenna using chip, interturn, bridge, and connection capacitances.
- Version
- 0.0.13
- License
- unset
- Stars
- 1
patches/@tscircuit%2Fcore@0.0.1971.patch
diff --git a/dist/index.js b/dist/index.js
index a877d0f6c2b62f0d24835198b5f8901afe0e9626..464d04a6a8249a3125b087e571af7fa19880d681 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -3018,10 +3018,27 @@ var getObstaclesFromRoute = (route, source_trace_id, { viaDiameter = 0.5 } = {})
const prev = i - 1 >= 0 ? route[i - 1] : null;
const isHorz = isCloseTo(start.y, end.y);
const isVert = isCloseTo(start.x, end.x);
+ const traceWidth = start.width ?? end.width ?? 0.1;
if (!isHorz && !isVert) {
- throw new Error(
- `getObstaclesFromTrace currently only supports horizontal and vertical traces (not diagonals) Conflicting trace: ${source_trace_id}, start: (${start.x}, ${start.y}), end: (${end.x}, ${end.y})`
- );
+ // Conservatively cover diagonal copper with short axis-aligned rectangles.
+ // The router chooses the route; these rectangles only describe fixed copper.
+ const segmentCount = Math.ceil(Math.hypot(end.x - start.x, end.y - start.y) / 0.25);
+ const stepX = (end.x - start.x) / segmentCount;
+ const stepY = (end.y - start.y) / segmentCount;
+ for (let segmentIndex = 0; segmentIndex < segmentCount; segmentIndex++) {
+ obstacles.push({
+ type: "rect",
+ layers: [start.layer],
+ center: {
+ x: start.x + stepX * (segmentIndex + 0.5),
+ y: start.y + stepY * (segmentIndex + 0.5)
+ },
+ width: Math.abs(stepX) + traceWidth,
+ height: Math.abs(stepY) + traceWidth,
+ connectedTo: [source_trace_id]
+ });
+ }
+ continue;
}
const obstacle = {
type: "rect",
@@ -3030,10 +3047,8 @@ var getObstaclesFromRoute = (route, source_trace_id, { viaDiameter = 0.5 } = {})
x: (start.x + end.x) / 2,
y: (start.y + end.y) / 2
},
- width: isHorz ? Math.abs(start.x - end.x) : 0.1,
- // TODO use route width
- height: isVert ? Math.abs(start.y - end.y) : 0.1,
- // TODO use route width
+ width: Math.abs(start.x - end.x) + traceWidth,
+ height: Math.abs(start.y - end.y) + traceWidth,
connectedTo: [source_trace_id]
};
obstacles.push(obstacle);
@@ -3506,7 +3521,8 @@ var getObstaclesFromCircuitJson = (circuitJson, connMap) => {
{
x: rp.x,
y: rp.y,
- layer: rp.route_type === "wire" ? rp.layer : rp.from_layer
+ layer: rp.route_type === "wire" ? rp.layer : rp.from_layer,
+ width: rp.route_type === "wire" ? rp.width : undefined
}
];
}),
@@ -9811,26 +9827,28 @@ var PlatedHole = class extends PrimitiveComponent2 {
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
});
this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
- db.pcb_solder_paste.insert({
- layer: "top",
- shape: "circle",
- // @ts-ignore: no idea why this is triggering
- radius: props.outerDiameter / 2,
- x: position.x,
- y: position.y,
- subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
- pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
- });
- db.pcb_solder_paste.insert({
- layer: "bottom",
- shape: "circle",
- // @ts-ignore: no idea why this is triggering
- radius: props.outerDiameter / 2,
- x: position.x,
- y: position.y,
- subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
- pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
- });
+ if (!isCoveredWithSolderMask) {
+ db.pcb_solder_paste.insert({
+ layer: "top",
+ shape: "circle",
+ // @ts-ignore: no idea why this is triggering
+ radius: props.outerDiameter / 2,
+ x: position.x,
+ y: position.y,
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
+ });
+ db.pcb_solder_paste.insert({
+ layer: "bottom",
+ shape: "circle",
+ // @ts-ignore: no idea why this is triggering
+ radius: props.outerDiameter / 2,
+ x: position.x,
+ y: position.y,
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
+ });
+ }
} else if (props.shape === "pill" && props.rectPad) {
const pcb_plated_hole = db.pcb_plated_hole.insert({
pcb_component_id,