hrithik18k/open-ring-flex

A flexible wearable PCB integrating inductive battery charging, BLE control with SPI flash and 32 MHz crystal, SAM L10 capacitive touch/wear sensing, haptic MOSFET drive with a large capacitor bank, RF antenna matching, and SWD programming/test connectors.

Version
1.0.4
License
CC-BY-NC-SA-4.0
Stars
0

scripts/check-inductor-metadata.tsx

import assert from "node:assert/strict"
import { Circuit } from "@tscircuit/core"
import { MLZ1608N2R2LT000 } from "../imports/MLZ1608N2R2LT000"
import { LQP03TN3N3B02D } from "../imports/LQP03TN3N3B02D"

// Keep the parts engine enabled, as it is in the hosted editor. Passive
// inductors with explicit JLC footprints must not request IC pin metadata.
let datasheetRequests = 0
const circuit = new Circuit({
  platform: {
    partsEngine: {
      findPart: () => ({}),
      fetchPartCircuitJson: async (request) => {
        if ("includeDatasheetInformation" in request && request.includeDatasheetInformation === true) {
          datasheetRequests++
        }
        throw new Error("Datasheet API did not respond within 5 seconds")
      },
    },
  },
})
circuit.add(
  <board width={30} height={15} routingDisabled>
    <MLZ1608N2R2LT000 name="L1" pcbX={-9} schX={-9} />
    <MLZ1608N2R2LT000 name="L4" pcbX={-3} schX={-3} />
    <LQP03TN3N3B02D name="L2" pcbX={3} schX={3} />
    <LQP03TN3N3B02D name="L3" pcbX={9} schX={9} />
  </board>,
)
await circuit.renderUntilSettled()
assert.equal(datasheetRequests, 0, "Inductors requested external datasheet metadata")
const json = circuit.getCircuitJson()
const parts = json.filter((el) => el.type === "source_component")
assert.equal(parts.length, 4)
for (const part of parts) {
  assert.equal(part.ftype, "simple_inductor")
  assert.ok(part.supplier_part_numbers?.jlcpcb?.length)
}
assert.ok(!json.some((el) => el.type === "source_property_ignored_warning"))
console.log("PASS: four JLC inductors render with parts engine enabled; zero datasheet requests.")