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/finalize-usb-top.mjs

import fs from "node:fs"
import assert from "node:assert/strict"
import crypto from "node:crypto"
const read=p=>JSON.parse(fs.readFileSync(p,"utf8"))
const sha=p=>crypto.createHash("sha256").update(fs.readFileSync(p)).digest("hex")
const circuitSha256=sha("dist/index/circuit.json"),record=read("reports/usb-top-record-regression.json"),protectedCopper=read("reports/usb-top-protected-copper.json")
for(const f of ["usb-top-record-regression.json","usb-top-protected-copper.json","connectivity-audit.json","coil-all-copper-preflight-meta.json","drill-clearance-regression.json","additional-dfm-review.json","solder-process-audit.json","stencil-artwork-audit.json","jlcpcb-stock-audit.json","bom-validation.json","assembly-motor-reference.json"])
  assert.equal(read("reports/"+f).circuitSha256,circuitSha256,"fresh report "+f)
assert.equal(record.noNewOrWorsenedWarnings,true)
assert.deepEqual(protectedCopper.unintendedChanges,[])
const verification=read("verification.json")
assert.equal(verification.circuitSha256,circuitSha256)
assert.equal(verification.fabricationReady,false)
assert.equal(verification.drcErrors,0)
assert.equal(verification.nativeWarnings,151)
assert.match(fs.readFileSync("reports/usb-top-tests.log","utf8"),/47 pass[\s\S]*0 fail/)
assert.match(fs.readFileSync("reports/usb-top-shorts.log","utf8"),/No shorts detected/)
const logs=Object.fromEntries(["build","tests","typecheck","shorts","style","continuity","copper","drill","dfm","solder","kelvin","motor","gerbers","artwork","stock","bom","verify"].map(n=>[n,sha("reports/usb-top-"+n+".log")]))
const report={checkedAt:new Date().toISOString(),circuitSha256,baselineCircuitSha256:record.baselineCircuitSha256,
  published:false,noRegressionsInCheckedScope:true,nativeErrors:0,nativeWarnings:151,baselineWarnings:151,
  testsPassed:47,testsFailed:0,sourceConnectionsAndSchematicUnchanged:true,
  protectedCopperNetsUnchanged:protectedCopper.protectedNetCount,unchangedFirmwareAndModuleFiles:record.unchangedFirmwareAndModuleFiles,
  boardMm:[42.3,42.3],layers:4,mountingHolesUnchanged:4,usbFace:"top",usbEdge:"north",usbCenterSpacingMm:14,
  connectorMpn:"TYPE-C-31-M-12",connectorJlcpcb:"C165948",powerCopper:"0.35 mm contact escapes, 0.80 mm top trunks; no inner-layer power-trunk replacement",
  viaCount:verification.pcbVias,viaHoleMm:.3,viaPadMm:.45,allViasFullStack:true,
  populatedParts:verification.populatedComponents,jlcpcbCodes:verification.jlcpcbUniqueParts,
  artworkApertures:read("reports/stencil-artwork-audit.json").populatedExposedSmtLands,
  preview:"dist/index/3d.png",previewGerbers:"reports/usb-top-preview.zip",logSha256:logs,
  fabricationReady:false,physicalDualPlugFitVerified:false,
  remainingQualification:"Inherited buck/high-speed layout and stackup review, assembly-process acceptance, actual motor/harness/cable fit and first-article tests are not signed off by these generated-output checks."}
fs.writeFileSync("reports/usb-top-validation.json",JSON.stringify(report,null,2)+"\n")
fs.writeFileSync("reports/module-test-regression.json",JSON.stringify({checkedAt:report.checkedAt,baselinePassed:32,baselineFailed:0,currentPassed:32,currentFailed:0,
  addedFailures:0,unchangedModuleAndFirmwareSources:record.unchangedFirmwareAndModuleFiles,circuitSha256,currentLogSha256:logs.tests},null,2)+"\n")
console.log(JSON.stringify(report))