From df4c14599c1ad6a1a4a7a0b416361844a0241844 Mon Sep 17 00:00:00 2001 From: phiwan-dev <75113544+phiwan-dev@users.noreply.github.com> Date: Sat, 7 Jun 2025 02:00:37 +0200 Subject: [PATCH] dev: add diodes with custom footprint --- phiboard.yaml => config.yaml | 20 ++++++-- footprints/combo_diode.js | 89 ++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 3 deletions(-) rename phiboard.yaml => config.yaml (88%) create mode 100644 footprints/combo_diode.js diff --git a/phiboard.yaml b/config.yaml similarity index 88% rename from phiboard.yaml rename to config.yaml index 6f700e5..cce6f6b 100644 --- a/phiboard.yaml +++ b/config.yaml @@ -2,7 +2,8 @@ meta: engine: 4.1.0 author: phiwan - + + units: kx: cx ky: cy @@ -60,7 +61,6 @@ points: # screw points - outlines: keys: - what: rectangle @@ -126,9 +126,23 @@ pcbs: where: true params: keycaps: true - #keycaps: false + #keycaps: false # outline on the pcb reverse: true hotswap: true from: "{{column_net}}" to: "{{colrow}}" + # smd diodes + diodes: + what: combo_diode + where: true + params: + include_smd: true + include_tht: false + #include_via: false + reversible: true + from: "{{colrow}}" + to: "{{row_net}}" + adjust: + shift: [0, -5] + diff --git a/footprints/combo_diode.js b/footprints/combo_diode.js new file mode 100644 index 0000000..cd86a17 --- /dev/null +++ b/footprints/combo_diode.js @@ -0,0 +1,89 @@ +// Author: Ergogen + @infused-kim improvements +// +// @infused-kim's improvements: +// - Added option to hide thru-holes +// - Added virtual attribute to silence DRC error + +module.exports = { + params: { + designator: "Di", + from: undefined, + to: undefined, + include_smd: true, + include_tht: true, + include_via: true, + side: "B", + reversible: false, + }, + body: (p) => { + const standard_opening = ` + (module Diode_SMD:D_SOD-123 (layer ${p.side}.Cu) (tedit 5B24D78E) + ${p.at /* parametric position */} + (attr virtual) + (fp_text reference "${p.ref}" (at 0 0) (layer ${p.side}.SilkS) ${ + p.ref_hide + } (effects (font (size 1.27 1.27) (thickness 0.15)))) + (fp_text value "" (at 0 0) (layer ${ + p.side + }.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) + `; + const front_silk = ` + (fp_line (start 0.25 0) (end 0.75 0) (layer F.SilkS) (width 0.1)) + (fp_line (start 0.25 0.4) (end -0.35 0) (layer F.SilkS) (width 0.1)) + (fp_line (start 0.25 -0.4) (end 0.25 0.4) (layer F.SilkS) (width 0.1)) + (fp_line (start -0.35 0) (end 0.25 -0.4) (layer F.SilkS) (width 0.1)) + (fp_line (start -0.35 0) (end -0.35 0.55) (layer F.SilkS) (width 0.1)) + (fp_line (start -0.35 0) (end -0.35 -0.55) (layer F.SilkS) (width 0.1)) + (fp_line (start -0.75 0) (end -0.35 0) (layer F.SilkS) (width 0.1)) + `; + const back_silk = ` + (fp_line (start 0.25 0) (end 0.75 0) (layer B.SilkS) (width 0.1)) + (fp_line (start 0.25 0.4) (end -0.35 0) (layer B.SilkS) (width 0.1)) + (fp_line (start 0.25 -0.4) (end 0.25 0.4) (layer B.SilkS) (width 0.1)) + (fp_line (start -0.35 0) (end 0.25 -0.4) (layer B.SilkS) (width 0.1)) + (fp_line (start -0.35 0) (end -0.35 0.55) (layer B.SilkS) (width 0.1)) + (fp_line (start -0.35 0) (end -0.35 -0.55) (layer B.SilkS) (width 0.1)) + (fp_line (start -0.75 0) (end -0.35 0) (layer B.SilkS) (width 0.1)) + `; + const front_pads = ` + (pad 1 smd rect (at -1.65 0 ${p.rot}) (size 0.9 1.2) (layers F.Cu F.Paste F.Mask) ${p.to.str}) + (pad 2 smd rect (at 1.65 0 ${p.rot}) (size 0.9 1.2) (layers F.Cu F.Paste F.Mask) ${p.from.str}) + `; + const back_pads = ` + (pad 1 smd rect (at -1.65 0 ${p.rot}) (size 0.9 1.2) (layers B.Cu B.Paste B.Mask) ${p.to.str}) + (pad 2 smd rect (at 1.65 0 ${p.rot}) (size 0.9 1.2) (layers B.Cu B.Paste B.Mask) ${p.from.str}) + `; + const standard_closing = ` + ) + `; + const tht = ` + (pad 1 thru_hole rect (at -3.81 0 ${p.rot}) (size 1.778 1.778) (drill 0.9906) (layers *.Cu *.Mask) ${p.to.str}) + (pad 2 thru_hole circle (at 3.81 0 ${p.rot}) (size 1.905 1.905) (drill 0.9906) (layers *.Cu *.Mask) ${p.from.str}) + `; + const via = ` + (pad "1" thru_hole circle (at -2.1 0) (size 0.6 0.6) (drill 0.3) (layers "*.Cu" "*.Mask") ${p.to.str}) + (pad "2" thru_hole circle (at 2.1 0) (size 0.6 0.6) (drill 0.3) (layers "*.Cu" "*.Mask") ${p.from.str}) + `; + let final = standard_opening; + if (p.side == "F" || p.reversible) { + final += front_silk; + if (p.include_smd) { + final += front_pads; + } + } + if (p.side == "B" || p.reversible) { + final += back_silk; + if (p.include_smd) { + final += back_pads; + } + } + if (p.include_tht) { + final += tht; + } + if (p.include_via) { + final += via; + } + final += standard_closing; + return final; + }, +};