Choc footprint fix, status led, generic PCB outlines
This commit is contained in:
parent
f71368b835
commit
852ebbcf95
6 changed files with 76 additions and 27 deletions
|
@ -17,8 +17,8 @@ module.exports = {
|
||||||
(fp_line (start 7 -7) (end 7 -6) (layer F.SilkS) (width 0.15))
|
(fp_line (start 7 -7) (end 7 -6) (layer F.SilkS) (width 0.15))
|
||||||
|
|
||||||
${''/* pins */}
|
${''/* pins */}
|
||||||
(pad 1 thru_hole circle (at 0 -5.9) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net_from})
|
(pad 1 thru_hole circle (at 5 -3.8) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net_from})
|
||||||
(pad 2 thru_hole circle (at -5 -3.8) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net_to})
|
(pad 2 thru_hole circle (at 0 -5.9) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net_to})
|
||||||
|
|
||||||
${''/* middle shaft */}
|
${''/* middle shaft */}
|
||||||
(pad "" np_thru_hole circle (at 0 0) (size 3.429 3.429) (drill 3.429) (layers *.Cu *.Mask))
|
(pad "" np_thru_hole circle (at 0 0) (size 3.429 3.429) (drill 3.429) (layers *.Cu *.Mask))
|
||||||
|
|
|
@ -4,5 +4,6 @@ module.exports = {
|
||||||
choc: require('./choc'),
|
choc: require('./choc'),
|
||||||
diode: require('./diode'),
|
diode: require('./diode'),
|
||||||
promicro: require('./promicro'),
|
promicro: require('./promicro'),
|
||||||
|
rgb: require('./rgb'),
|
||||||
pad: require('./pad')
|
pad: require('./pad')
|
||||||
}
|
}
|
38
src/footprints/rgb.js
Normal file
38
src/footprints/rgb.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
module.exports = {
|
||||||
|
static_nets: ['VCC', 'GND'],
|
||||||
|
nets: ['din', 'dout'],
|
||||||
|
params: {
|
||||||
|
side: 'F'
|
||||||
|
},
|
||||||
|
body: p => `
|
||||||
|
|
||||||
|
(module WS2812B (layer F.Cu) (tedit 53BEE615)
|
||||||
|
|
||||||
|
${p.at /* parametric position */}
|
||||||
|
|
||||||
|
(fp_line (start -1.75 -1.75) (end -1.75 1.75) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||||
|
(fp_line (start -1.75 1.75) (end 1.75 1.75) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||||
|
(fp_line (start 1.75 1.75) (end 1.75 -1.75) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||||
|
(fp_line (start 1.75 -1.75) (end -1.75 -1.75) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||||
|
|
||||||
|
(fp_line (start -2.5 -2.5) (end -2.5 2.5) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||||
|
(fp_line (start -2.5 2.5) (end 2.5 2.5) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||||
|
(fp_line (start 2.5 2.5) (end 2.5 -2.5) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||||
|
(fp_line (start 2.5 -2.5) (end -2.5 -2.5) (layer ${p.param_side}.SilkS) (width 0.15))
|
||||||
|
|
||||||
|
(fp_poly (pts (xy 4 2.2) (xy 4 0.375) (xy 5 1.2875)) (layer ${p.param_side}.SilkS) (width 0.1))
|
||||||
|
|
||||||
|
(pad 1 smd rect (at -2.2 -0.875 ${p.rot}) (size 2.6 1) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_VCC})
|
||||||
|
(pad 2 smd rect (at -2.2 0.875 ${p.rot}) (size 2.6 1) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_dout})
|
||||||
|
(pad 3 smd rect (at 2.2 0.875 ${p.rot}) (size 2.6 1) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_GND})
|
||||||
|
(pad 4 smd rect (at 2.2 -0.875 ${p.rot}) (size 2.6 1) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_din})
|
||||||
|
|
||||||
|
(pad 11 smd rect (at -2.5 -1.6 ${p.rot}) (size 2 1.2) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_VCC})
|
||||||
|
(pad 22 smd rect (at -2.5 1.6 ${p.rot}) (size 2 1.2) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_dout})
|
||||||
|
(pad 33 smd rect (at 2.5 1.6 ${p.rot}) (size 2 1.2) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_GND})
|
||||||
|
(pad 44 smd rect (at 2.5 -1.6 ${p.rot}) (size 2 1.2) (layers ${p.param_side}.Cu ${p.param_side}.Paste ${p.param_side}.Mask) ${p.net_din})
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
|
@ -237,13 +237,14 @@ exports.parse = (config = {}, points = {}) => {
|
||||||
const bevel = a.sane(part.bevel || 0, `${name}.bevel`, 'number')
|
const bevel = a.sane(part.bevel || 0, `${name}.bevel`, 'number')
|
||||||
const rect_mirror = a.sane(part.mirror || false, `${name}.mirror`, 'boolean')
|
const rect_mirror = a.sane(part.mirror || false, `${name}.mirror`, 'boolean')
|
||||||
const rect = rectangle(size[0], size[1], corner, bevel, name)
|
const rect = rectangle(size[0], size[1], corner, bevel, name)
|
||||||
arg = anchor.position(rect)
|
arg = anchor.position(u.deepcopy(rect))
|
||||||
if (rect_mirror) {
|
if (rect_mirror) {
|
||||||
const mirror_part = u.deepcopy(part)
|
const mirror_part = u.deepcopy(part)
|
||||||
a.assert(mirror_part.ref, `Field "${name}.ref" must be speficied if mirroring is required!`)
|
a.assert(mirror_part.ref, `Field "${name}.ref" must be speficied if mirroring is required!`)
|
||||||
mirror_part.ref = `mirror_${mirror_part.ref}`
|
mirror_part.ref = `mirror_${mirror_part.ref}`
|
||||||
anchor = a.anchor(mirror_part, name, points, false)
|
anchor = a.anchor(mirror_part, name, points, false)
|
||||||
arg = u.stack(arg, anchor.position(rect))
|
const mirror_rect = m.model.moveRelative(u.deepcopy(rect), [-size[0], 0])
|
||||||
|
arg = u.union(arg, anchor.position(mirror_rect))
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'circle':
|
case 'circle':
|
||||||
|
@ -257,7 +258,7 @@ exports.parse = (config = {}, points = {}) => {
|
||||||
a.assert(mirror_part.ref, `Field "${name}.ref" must be speficied if mirroring is required!`)
|
a.assert(mirror_part.ref, `Field "${name}.ref" must be speficied if mirroring is required!`)
|
||||||
mirror_part.ref = `mirror_${mirror_part.ref}`
|
mirror_part.ref = `mirror_${mirror_part.ref}`
|
||||||
anchor = a.anchor(mirror_part, name, points, false)
|
anchor = a.anchor(mirror_part, name, points, false)
|
||||||
arg = u.stack(arg, u.circle(anchor.p, radius))
|
arg = u.union(arg, u.circle(anchor.p, radius))
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'polygon':
|
case 'polygon':
|
||||||
|
|
17
src/pcbs.js
17
src/pcbs.js
|
@ -206,12 +206,16 @@ exports.parse = (config, points, outlines) => {
|
||||||
for (const [pcb_name, pcb_config] of Object.entries(pcbs)) {
|
for (const [pcb_name, pcb_config] of Object.entries(pcbs)) {
|
||||||
|
|
||||||
// config sanitization
|
// config sanitization
|
||||||
a.detect_unexpected(pcb_config, `pcb.${pcb_name}`, ['edge', 'footprints'])
|
a.detect_unexpected(pcb_config, `pcb.${pcb_name}`, ['outlines', 'footprints'])
|
||||||
const edge = outlines[pcb_config.edge]
|
|
||||||
if (!edge) throw new Error(`Field "pcb.${pcb_name}.edge" doesn't name a valid outline!`)
|
|
||||||
|
|
||||||
// Edge.Cuts conversion
|
// outline conversion
|
||||||
const kicad_edge = makerjs2kicad(edge)
|
const config_outlines = a.sane(pcb_config.outlines, `pcb.${pcb_name}.outlines`, 'object')
|
||||||
|
const kicad_outlines = {}
|
||||||
|
for (const [outline_name, outline] of Object.entries(config_outlines)) {
|
||||||
|
const ref = a.in(outline.outline, `pcb.${pcb_name}.outlines.${outline_name}.outline`, Object.keys(outlines))
|
||||||
|
const layer = a.sane(outline.layer || 'Edge.Cuts', `pcb.${pcb_name}.outlines.${outline_name}.outline`, 'string')
|
||||||
|
kicad_outlines[outline_name] = makerjs2kicad(outlines[ref], layer)
|
||||||
|
}
|
||||||
|
|
||||||
// making a global net index registry
|
// making a global net index registry
|
||||||
const nets = {"": 0}
|
const nets = {"": 0}
|
||||||
|
@ -247,12 +251,13 @@ exports.parse = (config, points, outlines) => {
|
||||||
const netclass = kicad_netclass.replace('__ADD_NET', add_nets_arr.join('\n'))
|
const netclass = kicad_netclass.replace('__ADD_NET', add_nets_arr.join('\n'))
|
||||||
const nets_text = nets_arr.join('\n')
|
const nets_text = nets_arr.join('\n')
|
||||||
const footprint_text = footprints.join('\n')
|
const footprint_text = footprints.join('\n')
|
||||||
|
const outline_text = Object.values(kicad_outlines).join('\n')
|
||||||
results[pcb_name] = `
|
results[pcb_name] = `
|
||||||
${kicad_prefix}
|
${kicad_prefix}
|
||||||
${nets_text}
|
${nets_text}
|
||||||
${netclass}
|
${netclass}
|
||||||
${footprint_text}
|
${footprint_text}
|
||||||
${kicad_edge}
|
${outline_text}
|
||||||
${kicad_suffix}
|
${kicad_suffix}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
36
test/fixtures/absolem.yaml
vendored
36
test/fixtures/absolem.yaml
vendored
|
@ -559,7 +559,7 @@ outlines:
|
||||||
glue: uniform_s19
|
glue: uniform_s19
|
||||||
size: 14
|
size: 14
|
||||||
bound: false
|
bound: false
|
||||||
classic_s19_middle:
|
pcb_middle:
|
||||||
raw:
|
raw:
|
||||||
type: keys
|
type: keys
|
||||||
side: middle
|
side: middle
|
||||||
|
@ -573,32 +573,26 @@ outlines:
|
||||||
size: [25, 5]
|
size: [25, 5]
|
||||||
ref: thumbfan_home_thumb
|
ref: thumbfan_home_thumb
|
||||||
shift: [0, 12]
|
shift: [0, 12]
|
||||||
|
mirror: true
|
||||||
helper2:
|
helper2:
|
||||||
type: rectangle
|
type: rectangle
|
||||||
size: [25, 5]
|
size: [25, 5]
|
||||||
ref: thumbfan_far_thumb
|
ref: thumbfan_far_thumb
|
||||||
shift: [-25, 12]
|
shift: [-25, 12]
|
||||||
helper3:
|
mirror: true
|
||||||
type: rectangle
|
|
||||||
size: [25, 5]
|
|
||||||
ref: mirror_thumbfan_home_thumb
|
|
||||||
shift: [25, 12]
|
|
||||||
helper4:
|
|
||||||
type: rectangle
|
|
||||||
size: [25, 5]
|
|
||||||
ref: mirror_thumbfan_far_thumb
|
|
||||||
shift: [0, 12]
|
|
||||||
outer_bounds:
|
outer_bounds:
|
||||||
type: outline
|
type: outline
|
||||||
name: classic_s19_outline
|
name: classic_s19_outline
|
||||||
operation: intersect
|
operation: intersect
|
||||||
mounting_holes:
|
|
||||||
type: outline
|
|
||||||
name: mounting_holes
|
|
||||||
operation: stack
|
|
||||||
pcbs:
|
pcbs:
|
||||||
main:
|
main:
|
||||||
edge: intersected_outline
|
outlines:
|
||||||
|
edge:
|
||||||
|
outline: intersected_outline
|
||||||
|
layer: Edge.Cuts
|
||||||
|
middle:
|
||||||
|
outline: pcb_middle
|
||||||
|
layer: F.SilkS
|
||||||
footprints:
|
footprints:
|
||||||
mcu:
|
mcu:
|
||||||
type: promicro
|
type: promicro
|
||||||
|
@ -634,3 +628,13 @@ pcbs:
|
||||||
width: 3
|
width: 3
|
||||||
height: 3
|
height: 3
|
||||||
front: false
|
front: false
|
||||||
|
led:
|
||||||
|
type: rgb
|
||||||
|
anchor:
|
||||||
|
ref:
|
||||||
|
- matrix_inner_bottom
|
||||||
|
- mirror_matrix_inner_bottom
|
||||||
|
shift: [0, -48]
|
||||||
|
nets:
|
||||||
|
din: 'P9'
|
||||||
|
dout: ''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue