rushabhcodes/wireless-split-keyboard

Wireless Split Keyboard — custom routed nRF52840 split PCBs with a printable enclosure

Version
0.4.5
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone rushabhcodes/wireless-split-keyboard  # download the package files into ./wireless-split-keyboard
tsci add rushabhcodes/wireless-split-keyboard    # add it to your project as @tsci/rushabhcodes.wireless-split-keyboard

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

scripts/check-routed.ts

import {spawnSync} from 'node:child_process'
import {readFileSync,writeFileSync} from 'node:fs'
import {createHash} from 'node:crypto'
for(const half of ['left','right']) {
  const file=`outputs/${half}/keyboard.circuit.json`
  const geometry=spawnSync('.venv/bin/python',['scripts/check-routing-geometry.py',half,'native'],{stdio:'inherit'})
  if(geometry.status!==0)process.exit(1)
  const models=spawnSync('.venv/bin/python',['scripts/check-socket-models.py',half],{stdio:'inherit'})
  if(models.status!==0)process.exit(1)
  const assembly=spawnSync('.venv/bin/python',['scripts/check-assembly-models.py',half],{stdio:'inherit'})
  if(assembly.status!==0)process.exit(1)
  const fit=spawnSync('.venv/bin/python',['scripts/check-enclosure-fit.py',half],{stdio:'inherit'})
  if(fit.status!==0)process.exit(1)
  const previews=spawnSync('.venv/bin/python',['scripts/check-preview-quality.py',half],{stdio:'inherit'})
  if(previews.status!==0)process.exit(1)
  console.log(`Checking ${half} Gerber copper`)
  const shorts=spawnSync(process.execPath,['node_modules/tscircuit/cli.mjs','check','shorts',file],{encoding:'utf8',maxBuffer:10*1024*1024})
  const log=shorts.stdout+shorts.stderr
  writeFileSync(`outputs/${half}/check-shorts.log`,log)
  console.log(log)
  writeFileSync(`outputs/${half}/gerber-shorts-check.json`,JSON.stringify({
    circuitJsonSha256:createHash('sha256').update(readFileSync(file)).digest('hex'),
    command:`tsci check shorts ${file}`,mode:'gerber',layers:'all',exitCode:shorts.status,
    passed:shorts.status===0&&log.includes('No shorts detected'),
  },null,2)+'\n')
  if(shorts.status!==0||!log.includes('No shorts detected'))process.exit(1)
}