Skip to content

Commit

Permalink
add makefile to generate presentation page with kikit
Browse files Browse the repository at this point in the history
  • Loading branch information
vroland committed Nov 3, 2023
1 parent a1040f0 commit bcbb47a
Show file tree
Hide file tree
Showing 9 changed files with 532 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
fp-info-cache
.cache
*-backups/

build/
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.PHONY: web

# inspired by https://github.com/RoboticsBrno/RB0002-BatteryPack/blob/master/Makefile


BOARDS = epdiy-v7 extension-cable

web: build/web/index.html

.SECONDEXPANSION:
build/boards/%: $$*/$$*.kicad_pcb $$*/$$*.kicad_sch
mkdir -p build/boards
kicad-cli sch export pdf $(word 2,$^) -o $@_schematic.pdf
kicad-cli sch export python-bom $(word 2,$^) -o $@_BoM.xml
xsltproc -o $@_BoM.csv present/bom2grouped_csv_jlcpcb.xsl $@_BoM.xml
#
kicad-cli pcb export pos $< --side front --format csv --units mm -o $@_top_pos.csv
kicad-cli pcb export step --subst-models $< -o $@_model.step
xz $@_model.step
touch $@

build/web/index.html: README.md present/template/index.html $(addprefix build/boards/,$(BOARDS))
mkdir -p build/web
kikit present boardpage \
-d $< \
--name "EPDiy" \
$(shell for board in ${BOARDS}; do echo -n "-b" $$board "\"\$$(cmark $$board/README.md)\"" "$$board/$$board.kicad_pcb " ; done) \
--repository 'https://github.com/vroland/epdiy-hardware' \
--template present/template/ \
$$(for f in build/boards/*; do echo "-r $$f"; done) \
build/web
20 changes: 6 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
## EPDiy Hardware
# EPDiy Hardware

Design files for [EPDiy](https://github.com/vroland/epdiy) controllers, controller variants, display adaptors, and other related hardware.

#### What is EPDiy?

## What is EPDiy?

Please refer to the [main project repository](https://github.com/vroland/epdiy) for more information.

#### Cloning
## Cloning

Make sure to clone recursively, to get hardware library submodules:
```
git clone [email protected]:vroland/epdiy.git --recursive
```

### Available Hardware

#### Epdiy V7

At `epdiy-v7`.
## Available Hardware

The V7 controller iteration is based on the ESP32S3. Highlights of the new board include:
* Support for high-resolution displays with 16 data lines
* Much faster updates thanks to the ESP32S3 SOC and the LCD peripheral
* An on-board RTC, LiPo charging
TODO: Link.

<a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/80x15.png" /></a> <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
<a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License <img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/80x15.png" /></a>
7 changes: 7 additions & 0 deletions epdiy-v7/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Epdiy V7

The V7 controller iteration is based on the ESP32S3. Highlights of the new board include:

- Support for high-resolution displays with 16 data lines
- Much faster updates thanks to the ESP32S3 SOC and the LCD peripheral
- An on-board RTC, LiPo charging
3 changes: 3 additions & 0 deletions extension-cable/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### 33 Pin Extension Cable

Extension cable for 33 pin FPC connections.
104 changes: 104 additions & 0 deletions present/bom2grouped_csv_jlcpcb.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<!--XSL style sheet to convert EESCHEMA XML Partlist Format to grouped CSV BOM Format
Copyright (C) 2014, Wolf Walter.
Copyright (C) 2013, Stefan Helmert.
Copyright (C) 2018, Kicad developers.
Copyright (C) 2019, arturo182.
GPL v2.
Functionality:
Generation of JLCPCB PCBA compatible BOM
How to use this is explained in eeschema.pdf chapter 14. You enter a command line into the
netlist exporter using a new (custom) tab in the netlist export dialog.
The command line is
xsltproc -o "%O.csv" "FullPathToFile/bom2grouped_csv_jlcpcb.xsl" "%I"
-->
<!--
@package
Generates a JLCPCB PCBA service compatible BOM
Functionality:
* Generate a comma separated value BOM list (csv file type).
* Components are sorted by ref and grouped by same value+footprint
One value per line
Fields are
Comment,Designator,Footprint,LCSC
The command line is
xsltproc -o "%O.csv" "full_path/bom2grouped_csv_jlcpcb.xsl" "%I"
-->


<!DOCTYPE xsl:stylesheet [
<!ENTITY nl "&#xd;&#xa;"> <!--new line CR, LF, or LF, your choice -->
]>


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>

<xsl:variable name="digits" select="'1234567890'" />

<!-- for matching grouping of footprint and value combination -->
<xsl:key name="partTypeByValueAndFootprint" match="comp" use="concat(footprint, '-', value)" />

<!-- for table head and empty table fields-->
<xsl:key name="headentr" match="field" use="@name"/>

<!-- main part -->
<xsl:template match="/export">
<xsl:text>Comment,Designator,Footprint,LCSC</xsl:text>
<!-- all table entries -->
<xsl:apply-templates select="components"/>
</xsl:template>

<xsl:template match="components">
<!-- for Muenchian grouping of footprint and value combination -->
<xsl:for-each select="comp[count(. | key('partTypeByValueAndFootprint', concat(footprint, '-', value))[1]) = 1]">
<xsl:sort select="@ref" />
<xsl:text>&nl;</xsl:text>
<xsl:text>"</xsl:text><xsl:value-of select="value"/><xsl:text>","</xsl:text>
<!-- list of all references -->
<xsl:for-each select="key('partTypeByValueAndFootprint', concat(footprint, '-', value))">
<!-- strip non-digits from reference and sort based on remaining number -->
<xsl:sort select="translate(@ref, translate(@ref, $digits, ''), '')" data-type="number" />
<xsl:value-of select="@ref"/>
<xsl:if test="position() != last()"><xsl:text>,</xsl:text></xsl:if>
</xsl:for-each>
<xsl:text>","</xsl:text>

<xsl:value-of select="footprint"/><xsl:text>","</xsl:text>
<xsl:value-of select="fields/field[@name='LCSC']"/><xsl:text>"</xsl:text>
</xsl:for-each>
</xsl:template>

<!-- table entries with dynamic table head -->
<xsl:template match="fields">

<!-- remember current fields section -->
<xsl:variable name="fieldvar" select="field"/>

<!-- for all existing head entries -->
<xsl:for-each select="/export/components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]">
<xsl:variable name="allnames" select="@name"/>
<xsl:text>,"</xsl:text>

<!-- for all field entries in the remembered fields section -->
<xsl:for-each select="$fieldvar">

<!-- only if this field entry exists in this fields section -->
<xsl:if test="@name=$allnames">
<!-- content of the field -->
<xsl:value-of select="."/>
</xsl:if>
<!--
If it does not exist, use an empty cell in output for this row.
Every non-blank entry is assigned to its proper column.
-->
</xsl:for-each>

<xsl:text>"</xsl:text>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>
62 changes: 62 additions & 0 deletions present/template/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>{{name}}</title>
</head>

<body>
<div class="container mx-auto px-3">
<div class="w-full my-3 text-sm text-right bg-gray-200 px-3 py-1">
Last update: {{datetime}}
{{#if gitRev}}(git revision
{{#if repo}}<a href="{{repo}}/tree/{{gitRev}}">{{/if}}
{{gitRevShort}}
{{#if repo}}</a>{{/if}})
{{/if}}
</div>

{{{description}}}

<h1>Available Boards</h1>

{{#each boards}}
<div class="w-full bg-gray-200 py-3 px-3 my-2 rounded">
<p>{{{this.comment}}}</p>
<div class="flex flex-wrap">
<div class="w-full md:w-1/3">
<h3>Front</h3>
<img src="{{this.front}}" class="boardPreview">
</div>
<div class="w-full md:w-1/3">
<h3>Back</h3>
<img src="{{this.back}}" class="boardPreview">
</div>
<div class="w-full md:w-1/3 px-4">
<h3>Downloads:</h3>
<p>
<ul>
<li><a href="{{this.file}}">Download source board</a></li>
<li><a href="{{this.gerbers}}">Download gerbers</a></li>
<li><a href="build/boards/{{this.name}}_BoM.csv">{{this.name}} BoM (csv)</a></li>
<li><a href="build/boards/{{this.name}}_BoM.xml">{{this.name}} BoM (xml)</a></li>
<li><a href="build/boards/{{this.name}}_top_pos.csv">{{this.name}} Part Positioning</a></li>
<li><a href="build/boards/{{this.name}}_schematic.pdf">{{this.name}} Schematic (PDF)</a></li>
<li><a href="build/boards/{{this.name}}_model.step.xz">{{this.name}} 3D Model (STEP)</a></li>
</ul>
</p>
</div>
</div>
</div>
{{/each}}

<div class="w-full mt-16 mb-1 p-2 bg-gray-200 text-center txt-xs rounded">
Generated by <a href="https://github.com/yaqwsx/KiKit">KiKit</a>
</div>
</div>
</body>

</html>
Loading

0 comments on commit bcbb47a

Please sign in to comment.