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-clean-schematic.mjs

import fs from "node:fs"
import crypto from "node:crypto"
import assert from "node:assert/strict"
const read=p=>JSON.parse(fs.readFileSync(p,"utf8"))
const sha=p=>crypto.createHash("sha256").update(fs.readFileSync(p)).digest("hex")
const steps=fs.readFileSync("reports/clean-validation.log","utf8").split("\n").flatMap(line=>{try{const x=JSON.parse(line);return x.step?[x]:[]}catch{return []}})
const required=["style-current","physical-regression","protected-copper","tests","stock","bom","typecheck","shorts","check-all","style-cli","warnings","continuity","copper","drill","dfm","solder","kelvin","motor","gerbers","artwork","verify"]
assert.equal(steps.length,required.length)
for(const step of required)assert.equal(steps.find(s=>s.step===step)?.exit,0,step)
const circuitSha256=sha("dist/index/circuit.json"),before=read("baseline/circuit.json"),after=read("dist/index/circuit.json")
assert.equal(sha("baseline/circuit.json"),"b4fc916c202df8fde05e1d3db5182f9ced38ce7d5f31febf4a3f30f12e669cd2")
const hardware=c=>c.filter(e=>!e.type.startsWith("schematic_")&&!e.type.endsWith("_warning")&&e.type!=="source_project_metadata")
assert.deepEqual(hardware(after),hardware(before),"EVERY electrical/hardware record must remain unchanged")
for(const type of ["schematic_component","schematic_port"]){
  const key=type==="schematic_component"?"source_component_id":"source_port_id"
  assert.deepEqual(after.filter(e=>e.type===type).map(e=>e[key]).sort(),before.filter(e=>e.type===type).map(e=>e[key]).sort())
}
const verification=read("verification.json"),style=read("reports/review-style/analysis.json"),warnings=read("reports/review-warning-regression.json")
for(const report of [verification,style,warnings])assert.equal(report.circuitSha256,circuitSha256)
assert.equal(style.issueCount,0);assert.equal(verification.fabricationReady,false)
assert.deepEqual(warnings.errors,[]);assert.deepEqual(warnings.regressions,[]);assert.equal(warnings.currentWarnings,151)
assert.match(fs.readFileSync("reports/review-tests.log","utf8"),/57 pass\s+0 fail/)
const files=["reports/clean-validation.log","reports/clean-full-build.log","reports/review-tests.log","reports/review-style/analysis.json","reports/review-warning-regression.json","reports/bulk-top-regression.json","reports/review-protected-copper.json","reports/connectivity-audit.json","reports/coil-all-copper-preflight-meta.json","reports/jlcpcb-stock-audit.json","reports/bom-validation.json","reports/solder-process-audit.json","reports/drill-clearance-regression.json","verification.json","routing/complete-routes.json","routing/expected-input.json","routing/physical-copper.json","baseline/circuit.json"]
const report={checkedAt:new Date().toISOString(),status:"schematic_only_regression_gates_passed",baselineVersion:"0.4.54",circuitSha256,hardwareRecordsUnchanged:hardware(after).length,schematicSymbolAndTerminalCoverageUnchanged:true,testsPassed:57,testsFailed:0,schematicStyleIssues:0,nativeErrors:0,inheritedNativeWarnings:151,addedWarnings:0,gerberShorts:0,allSheetsVisuallyReviewed:true,fabricationReady:false,published:false,qualificationGaps:verification.fabricationBlockers,reports:Object.fromEntries(files.map(p=>[p,sha(p)]))}
fs.writeFileSync("reports/clean-schematic-acceptance.json",JSON.stringify(report,null,2)+"\n")
console.log(JSON.stringify(report))