shibosoftwaredev/f1c100s-linux-nema17-stepper-controller

A four-layer NEMA 17 motor-controller PCB combining an Allwinner F1C100S Linux computer, USB‑PD/buck power system, W5500 Ethernet, STM32 real-time motion control, DRV8825 stepper driver, protection/temperature/current telemetry, USB interfaces, and local LED/buzzer diagnostics.

Version
0.4.56
License
unset
Stars
0

scripts/measure-pin-number-glyphs.mjs

import fs from "node:fs"
import crypto from "node:crypto"
import assert from "node:assert/strict"
import alphabet from "@tscircuit/alphabet/outline-polygons"

// The conservative em-square is larger than the actual printed numeric glyph.
// Preserve the font and stroke, and measure the packaged ink outlines instead.
const file="dist/index/circuit.json"
const circuit=JSON.parse(fs.readFileSync(file))
const labels=circuit.filter(e=>e.type==="pcb_silkscreen_text"&&/^[1-4]$/.test(e.text))
const result={circuitSha256:crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex"),
  font:"@tscircuit/alphabet/outline-polygons",includesStroke:true,labels:{}}
for(const e of labels){
  assert.equal(e.anchor_alignment,"center");assert.equal(e.ccw_rotation,0)
  assert.equal(e.font,"tscircuit2024");assert.equal(e.font_size,1.7)
  const points=alphabet[e.text].flat()
  const xs=points.map(p=>p.x),ys=points.map(p=>p.y)
  result.labels[e.pcb_silkscreen_text_id]={text:e.text,
    width:(Math.max(...xs)-Math.min(...xs))*e.font_size,
    height:(Math.max(...ys)-Math.min(...ys))*e.font_size}
}
assert.equal(labels.length,4)
fs.writeFileSync("reports/round9-pin-glyph-bounds.json",JSON.stringify(result,null,2)+"\n")
console.log(JSON.stringify(result))