Skip to content

Commit

Permalink
v6: fix battery switchover
Browse files Browse the repository at this point in the history
  • Loading branch information
vroland committed Aug 29, 2021
1 parent 70cb663 commit 1647406
Show file tree
Hide file tree
Showing 24 changed files with 5,637 additions and 4,937 deletions.
10 changes: 5 additions & 5 deletions hardware/epaper-breakout/BOM.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Comment,Designator,Footprint,LCSC
"2.2uF","C27,C33","Capacitor_SMD:C_0805_2012Metric","C49217"
"1uF/50V","C34,C36","Capacitor_SMD:C_1206_3216Metric","C1848"
"1uF/25V","C35,C37,C38","Capacitor_SMD:C_0805_2012Metric","C28323"
"1N5817","D10","Diode_SMD:D_SOD-123"," C8598"
"1N5817","D7,D10","Diode_SMD:D_SOD-123"," C8598"
"MBR0540","D1,D2,D3,D4,D5,D6","Diode_SMD:D_SOD-123","C21353"
"LED GREEN","D8","LED_SMD:LED_0805_2012Metric","C2297"
"LED RED","D9","LED_SMD:LED_0805_2012Metric"," C84256"
Expand All @@ -34,19 +34,19 @@ Comment,Designator,Footprint,LCSC
"1M","R19,R23","Resistor_SMD:R_0603_1608Metric","C22935"
"47.5k","R24","Resistor_SMD:R_0603_1608Metric","C25819"
"47k","R26,R27,R28,R29","Resistor_SMD:R_0603_1608Metric","C25819"
"100k","R30","Resistor_SMD:R_0603_1608Metric","C25803"
"100k","R7,R30","Resistor_SMD:R_0603_1608Metric","C25803"
"0","R5","Resistor_SMD:R_0603_1608Metric",""
"1k","R3,R8","Resistor_SMD:R_0603_1608Metric","C21190"
"6.8k","R9","Resistor_SMD:R_0603_1608Metric","C23212"
"+22V","TP1","TestPoint:TestPoint_Pad_D2.5mm",""
"+15V","TP2","TestPoint:TestPoint_Pad_D2.5mm",""
"-15V","TP2","TestPoint:TestPoint_Pad_D2.5mm",""
"-20V","TP3","TestPoint:TestPoint_Pad_D2.5mm",""
"-15V","TP4","TestPoint:TestPoint_Pad_D2.5mm",""
"+15V","TP4","TestPoint:TestPoint_Pad_D2.5mm",""
"VCOM","TP5","TestPoint:TestPoint_Pad_D2.5mm",""
"MCP1700-3302E_SOT23","U1","Package_TO_SOT_SMD:SOT-23","C39051"
"TP4056","U11","epaper-breakout:TP4056_SOP-8-PP"," C16581"
"CH340C","U12","Package_SO:SOIC-16_3.9x9.9mm_P1.27mm"," C84681"
"PCA9555PW","U2","Package_SO:TSSOP-24_4.4x7.8mm_P0.65mm","C128392"
"PCA9535PW","U2","Package_SO:TSSOP-24_4.4x7.8mm_P0.65mm","C255606"
"TPS651851RSLR","U3","tps65185:TPS651851RSLR","C139292"
"XC6206PxxxMR","U4","Package_TO_SOT_SMD:SOT-23"," C5446"
"ESP32-WROVER","U5","esp32-wrover:ESP32-WROVER"," C503591"
Expand Down
104 changes: 104 additions & 0 deletions hardware/epaper-breakout/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>

0 comments on commit 1647406

Please sign in to comment.