imrishabh18/nema-23-stepper-controller

A four-layer NEMA23 stepper motor controller PCB featuring an RP2040 MCU, DRV8452 dual-phase driver, USB‑C PD power input/protection, current and temperature sensing, status LED/buzzer, and optional magnetic encoder.

Version
1.3.2
License
unset
Stars
1

scripts/reimport-flash-pin-labels.mjs

import { readFileSync, writeFileSync, mkdirSync } from 'node:fs'
import { createHash } from 'node:crypto'
import { convertRawEasyEdaToTs } from 'easyeda'

// Import electrical labels only. Keep the board's existing physical footprint
// and native yellow chip symbol, as requested.
const rawPath = 'engineering/easyeda/C2843335.raweasy.json'
const raw = readFileSync(rawPath, 'utf8')
const converted = await convertRawEasyEdaToTs({ rawEasy: JSON.parse(raw) })
const block = converted.match(/const pinLabels = (\{[\s\S]*?\}) as const/)
if (!block) throw Error('Converter pin-label output changed')
const labels = JSON.parse(block[1].replace(/\b(pin\d+):/g, '"$1":'))
const expected = ['N_CS', 'DO_IO1', 'WP__IO2', 'GND', 'DI_IO0', 'CLK', 'HOLD_orRESET__IO3', 'VCC', 'EP']
for (const [index, label] of expected.entries()) {
  if (!labels[`pin${index + 1}`]?.includes(label)) throw Error(`Missing flash label ${label}`)
}
mkdirSync('imports/pin-labels', { recursive: true })
const output = JSON.stringify(labels, null, 2) + '\n'
writeFileSync('imports/pin-labels/W25Q16JVUXIQ.json', output)
const converter = JSON.parse(readFileSync('node_modules/easyeda/package.json', 'utf8')).version
const sha = text => createHash('sha256').update(text).digest('hex')
writeFileSync('engineering/easyeda/pin-labels-manifest.json', JSON.stringify({
  part: 'W25Q16JVUXIQ', lcsc: 'C2843335', converter,
  regressionReference: 'https://github.com/tscircuit/easyeda-converter/pull/594',
  sourceSha256: sha(raw), pinLabelsSha256: sha(output),
}, null, 2) + '\n')
console.log(`Imported all nine W25Q16JVUXIQ pin labels with easyeda ${converter}`)