astra/f1c100s
The code defines the physical pin layout, labels, and footprint for the F1C100S system-on-chip (SoC) component used in electronic devices.
- Version
- 0.9.2
- License
- unset
- Stars
- 0
scripts/check-preview-pours.ts
import type { CircuitJson } from "circuit-json";
import { MODULE_SIZE } from "../src/profiles";
/** Verify that the preview emitted grounded, inset copper on every layer. */
export function checkPreviewPours(json: CircuitJson): string[] {
const data = json as any[],
errors: string[] = [];
const pours = data.filter((e) => e.type === "pcb_copper_pour");
const ground = data.find(
(e) => e.type === "source_trace" && e.name === "SOC_GND_external",
);
const netId = ground?.connected_source_net_ids?.[0];
if (!netId) errors.push("Preview ground is not connected to the module");
for (const layer of ["top", "inner1", "inner2", "bottom"])
if (!pours.some((p) => p.layer === layer))
errors.push(`Missing ${layer} ground pour`);
for (const p of pours) {
if (p.source_net_id !== netId)
errors.push("Preview pour uses the wrong ground net");
const vertices = p.brep_shape?.outer_ring?.vertices ?? [];
if (vertices.length < 3) errors.push("Empty preview pour geometry");
if (!p.covered_with_solder_mask)
errors.push("Preview pour must be solder-mask covered");
if (
vertices.some(
(v: any) =>
Math.max(Math.abs(v.x), Math.abs(v.y)) > MODULE_SIZE / 2 - 0.3 + 1e-5,
)
)
errors.push("Preview pour exceeds its board-edge margin");
}
return errors;
}