Skip to content

Commit

Permalink
Merge pull request #1 from AllYarnsAreBeautiful/main
Browse files Browse the repository at this point in the history
Synchronize fork
  • Loading branch information
VIPQualityPost authored Jun 11, 2024
2 parents d3c3bfb + 8285dfe commit 3ff54fd
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ayab-esp32-design.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Hardware Design

on:
push:
branches:
- main
paths:
- ayab-esp32/**

pull_request:
branches:
- main
paths:
- ayab-esp32/**

env:
workflow_project_dir: ayab-esp32
kicad_project_name: ayab-esp32

jobs:
buildfiles:
name: Design check & documentation build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create output directory
run: mkdir -p ${workflow_project_dir}/outputs/gerbers

- name: Install KiCad
run: sudo bash ./scripts/dependencies.sh

- name: Verify clean design files
run: |
kicad-cli sch erc -o ${workflow_project_dir}/outputs/erc_errors.json --format json --severity-error --exit-code-violations ${workflow_project_dir}/${kicad_project_name}.kicad_sch
kicad-cli pcb drc -o ${workflow_project_dir}/outputs/drc_errors.json --format json --severity-error --exit-code-violations ${workflow_project_dir}/${kicad_project_name}.kicad_pcb
- name: Archive artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: design-artifacts
path: ayab-esp32/outputs
75 changes: 75 additions & 0 deletions .github/workflows/ayab-esp32-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Assembly Documentation

on:
pull_request:
branches:
- main
types:
- closed

push:
branches:
- main

env:
workflow_project_dir: ayab-esp32
kicad_project_name: ayab-esp32

jobs:
buildfiles:
if: github.event.pull_request.merged == true
name: Design check & documentation build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create output directory
run: mkdir -p ${workflow_project_dir}/outputs/gerbers

- name: Install KiCad
run: sudo bash ./scripts/dependencies.sh

- name: Export design file PDFs
run: |
kicad-cli sch export pdf -o ${workflow_project_dir}/pdf/${kicad_project_name}-sch.pdf ${workflow_project_dir}/${kicad_project_name}.kicad_sch
kicad-cli pcb export pdf -o ${workflow_project_dir}/pdf/${kicad_project_name}-pcb-front.pdf -l "F.Cu,F.Mask,Edge.Cuts" ${workflow_project_dir}/${kicad_project_name}.kicad_pcb
kicad-cli pcb export pdf -o ${workflow_project_dir}/pdf/${kicad_project_name}-pcb-back.pdf --erd --ev --mirror -l "B.Cu,B.Mask,Edge.Cuts" ${workflow_project_dir}/${kicad_project_name}.kicad_pcb
- name: Export assembly documentation
run: |
kicad-cli sch export bom -o ${workflow_project_dir}/outputs/raw-BOM.csv --fields "Reference,Value,Footprint,LCSC ID" --exclude-dnp --group-by "Val" --sort-asc ${workflow_project_dir}/${kicad_project_name}.kicad_sch
kicad-cli pcb export pos -o ${workflow_project_dir}/outputs/raw-CPL.csv --side front --format csv --use-drill-file-origin --exclude-dnp ${workflow_project_dir}/${kicad_project_name}.kicad_pcb
- name: Convert BOM & CPL to JLC format
run: |
python3 scripts/jlc_bom_formatter.py ${workflow_project_dir}/outputs/raw-BOM.csv ${workflow_project_dir}/outputs/${kicad_project_name}-BOM.csv
python3 scripts/jlc_cpl_formatter.py ${workflow_project_dir}/outputs/raw-CPL.csv ${workflow_project_dir}/outputs/${kicad_project_name}-CPL.csv
sudo rm ${workflow_project_dir}/outputs/raw-BOM.csv ${workflow_project_dir}/outputs/raw-CPL.csv
- name: Export mechanical files
run: |
kicad-cli pcb export gerbers -o ${workflow_project_dir}/outputs/gerbers/ -l "F.Cu,F.Mask,F.Silkscreen,F.Paste,In1.Cu,In2.Cu,B.Cu,B.Mask,B.Silkscreen,B.Paste,Edge.Cuts"--erd --ev --use-drill-file-origin --no-protel-ext ${workflow_project_dir}/${kicad_project_name}.kicad_pcb
kicad-cli pcb export drill -o ${workflow_project_dir}/outputs/gerbers/ --drill-origin plot --format gerber ${workflow_project_dir}/${kicad_project_name}.kicad_pcb
cd ${workflow_project_dir}/outputs
zip -r ${kicad_project_name}-gerbers.zip gerbers
sudo rm -r gerbers
- name: Add PDFs to repo
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "AYAB Github Action"
git fetch
git checkout documentation
git add ${workflow_project_dir}/pdf/*.pdf
git commit -m "Add design file PDFs to repo [skip ci]"
gh pr create --head documentation --base main --title "Add design file PDFs to repo" --body "Automated PR from GHA"
- name: Archive artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: documentation-artifacts
path: ayab-esp32/outputs
3 changes: 3 additions & 0 deletions ayab-esp32/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Hardware Design](https://github.com/AllYarnsAreBeautiful/ayab-hardware/actions/workflows/ayab-esp32-design.yml/badge.svg?branch=main)](https://github.com/AllYarnsAreBeautiful/ayab-hardware/actions/workflows/ayab-esp32-design.yml)
[![Assembly Documentation](https://github.com/AllYarnsAreBeautiful/ayab-hardware/actions/workflows/ayab-esp32-documentation.yml/badge.svg)](https://github.com/AllYarnsAreBeautiful/ayab-hardware/actions/workflows/ayab-esp32-documentation.yml)

# AYAB-ESP32
These are the design files for the latest generation of AYAB hardware, a new, next controller for knitting machines.\
It currently has compatibility with the Brother KH 900, 910, 930, 940, 950, 965, with support planned for CK-35 and KH-270.\
Expand Down
Binary file removed ayab-esp32/assembly/ayab-esp32.zip
Binary file not shown.
11 changes: 11 additions & 0 deletions scripts/dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -e
set -v

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

sudo add-apt-repository --yes ppa:kicad/kicad-8.0-releases
sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive apt install --install-recommends kicad kicad-packages3d- kicad-demos-

sudo python3 -m pip install pandas
20 changes: 20 additions & 0 deletions scripts/jlc_bom_formatter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import pandas as pd
import os, sys, csv

def footprintFix(fpName):
propertiesList = fpName.split('_')

if len(propertiesList) == 4:
if any(rcl in propertiesList[0] for rcl in ["Resistor", "Capacitor", "Inductor", "Diode"]):
# For things like R/C/L, return something like C0402
return propertiesList[1][-1] + propertiesList[2]

# Strip out library name from FP.
return fpName.split(":")[-1]

bom_file = pd.read_csv(sys.argv[1])

bom_file.columns = ['Designator', 'Value', 'Footprint', 'JLCPCB Part #']
bom_file['Footprint'] = bom_file['Footprint'].apply(lambda x: footprintFix(x))

bom_file.to_csv(sys.argv[2], index=False)
11 changes: 11 additions & 0 deletions scripts/jlc_cpl_formatter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import pandas as pd
import os, sys, csv

cpl_file = pd.read_csv(sys.argv[1])

cpl_file.columns = ['Designator', 'Val', 'Package', 'Mid X', 'Mid Y', 'Rotation', 'Layer']
cpl_file = cpl_file.reindex(columns=['Designator', 'Mid X', 'Mid Y', 'Layer', 'Rotation'])
cpl_file.drop([0,1,2,3,4,5])
cpl_file['Layer'] = "T"

cpl_file.to_csv(sys.argv[2], index=False)

0 comments on commit 3ff54fd

Please sign in to comment.