1
0

Compare commits

..

No commits in common. "13a40d750ebcf2b4ad3143737873d3a8fe3c1aa7" and "3eac7f8e6dc7d2a09b32c72bcc28bf4683e183cf" have entirely different histories.

24 changed files with 86 additions and 1350 deletions

13
.github/FUNDING.yml vendored
View File

@ -1,13 +0,0 @@
# These are supported funding model platforms
github: [mrzealot] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@ -24,7 +24,6 @@ The project aims to provide a common configuration format to describe ***ergonom
[![Button WebUI]][WebUI]
[![Button Documentation]][Documentation]
[![Button Discord]][Discord]
[![Button Donate]][Donate]
---
@ -80,17 +79,6 @@ Get in touch on our **[Discord]**, and we can definitely find something you can
<br>
## Sponsors
Huge thanks go to everyone who chooses to support my work!
But even huger thanks are due to the following, *distinguished* sponsors:
- [perce](https://madebyperce.com/)
- [Cache](https://github.com/MvEerd)
- [Neil Gilmour](https://github.com/neilgilmour)
- [ochief](https://github.com/ochief)
- [Alyx Brett](https://github.com/alyx-brett)
<!----------------------------------------------------------------------------->
[Absolem keyboard]: https://zealot.hu/absolem
@ -99,7 +87,6 @@ But even huger thanks are due to the following, *distinguished* sponsors:
[WebUI]: https://ergogen.xyz
[Unofficial]: https://ergogen.cache.works/
[Topic]: https://github.com/topics/ergogen
[Donate]: https://github.com/sponsors/mrzealot
<!--------------------------------{ Buttons }---------------------------------->
@ -108,4 +95,3 @@ But even huger thanks are due to the following, *distinguished* sponsors:
[Button Official]: https://img.shields.io/badge/Official-37a779?style=for-the-badge
[Button Documentation]: https://img.shields.io/badge/Documentation-1793D1?style=for-the-badge&logoColor=white&logo=GitBook
[Button Discord]: https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logoColor=white&logo=Discord
[Button Donate]: https://img.shields.io/badge/Donate-EA4AAA?style=for-the-badge&logoColor=white&logo=githubsponsors

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "ergogen",
"version": "4.0.4",
"version": "4.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ergogen",
"version": "4.0.4",
"version": "4.0.1",
"license": "MIT",
"dependencies": {
"fs-extra": "^11.1.0",

View File

@ -1,6 +1,6 @@
{
"name": "ergogen",
"version": "4.0.4",
"version": "4.0.1",
"description": "Ergonomic keyboard layout generator",
"author": "Bán Dénes <mr@zealot.hu>",
"license": "MIT",

View File

@ -15,7 +15,7 @@
### Minor
- Support "direct" anchors, as in, recognize num arrays and parse them as x/y/r
- Add `origin` to zone-wide and global rotation in points
- Add full anchor support to individual points (via `adjust`, probably)
- Handle unnecessary (but seemingly consistent, so easy to confuse) `key` subfield of row-level overrides
- Allow footprints to access raw array/object fields from points with templating
- Include raw kicad footprint integrations

View File

@ -9,8 +9,9 @@ const _false = () => false
const _and = arr => p => arr.map(e => e(p)).reduce((a, b) => a && b)
const _or = arr => p => arr.map(e => e(p)).reduce((a, b) => a || b)
const similar = (keys, reference, name, units) => {
const similar = (key, reference, name, units) => {
let neg = false
if (reference.startsWith('-')) {
neg = true
reference = reference.slice(1)
@ -19,19 +20,15 @@ const similar = (keys, reference, name, units) => {
// support both string or regex as reference
let internal_tester = val => (''+val) == reference
if (reference.startsWith('/')) {
try {
const regex_parts = reference.split('/')
regex_parts.shift() // remove starting slash
const flags = regex_parts.pop()
const regex = new RegExp(regex_parts.join('/'), flags)
internal_tester = val => regex.test(''+val)
} catch (ex) {
throw new Error(`Invalid regex "${reference}" found at filter "${name}"!`)
}
}
// support strings, arrays, or objects as key
const external_tester = (point, key) => {
const external_tester = point => {
const value = u.deep(point, key)
if (a.type(value)() == 'array') {
return value.some(subkey => internal_tester(subkey))
@ -42,12 +39,11 @@ const similar = (keys, reference, name, units) => {
}
}
// consider negation
// negation happens at the end
if (neg) {
return point => keys.every(key => !external_tester(point, key))
} else {
return point => keys.some(key => external_tester(point, key))
return point => !external_tester(point)
}
return external_tester
}
const comparators = {
@ -79,7 +75,7 @@ const simple = (exp, name, units) => {
value = exp
}
return point => comparators[op](keys, value, name, units)(point)
return point => keys.some(key => comparators[op](key, value, name, units)(point))
}
const complex = (config, name, units, aggregator=_or) => {

View File

@ -1,95 +0,0 @@
module.exports = {
nets: {
neg: undefined,
pos: undefined,
},
body: p => `
(module BatteryPads
(layer "F.Cu")
${p.at /* parametric position */}
${'' /* TODO: Does not yet support rotation */}
(fp_text reference "BT1" (at 0 0.5) (layer "F.SilkS") hide (effects (font (size 1 1) (thickness 0.15))))
(fp_text value "Battery_Cell" (at 0 -0.5) (layer "F.Fab") (effects (font (size 1 1) (thickness 0.15))))
(fp_text user "Battery_Cell" (at 0 -0.5) (layer "B.Fab") (effects (font (size 1 1) (thickness 0.15)) (justify mirror)))
(fp_text user "BT01" (at 0 0.5) (layer "B.SilkS") hide (effects (font (size 1 1) (thickness 0.15)) (justify mirror)))
(fp_text user "Battery" (at 3.175 0.79375 90) (layer "F.SilkS") hide (effects (font (size 0.8 0.8) (thickness 0.1))))
(fp_text user "Battery" (at 3.175 0.79375 90) (layer "B.SilkS") hide (effects (font (size 0.8 0.8) (thickness 0.1)) (justify mirror)))
(fp_text user "(+)" (at -1.1 -2.286) (layer "F.SilkS") (effects (font (size 0.8 0.8) (thickness 0.1))))
(fp_text user "(+)" (at -1.1 -2.286) (layer "B.SilkS") (effects (font (size 0.8 0.8) (thickness 0.1)) (justify mirror)))
(fp_text user "(-)" (at 1.1 -2.286) (layer "F.SilkS") (effects (font (size 0.8 0.8) (thickness 0.1))))
(fp_text user "(-)" (at 1.1 -2.286) (layer "B.SilkS") (effects (font (size 0.8 0.8) (thickness 0.1)) (justify mirror)))
(fp_poly (pts
(xy 0.4 -1)
(xy 0.4 1)
(xy 1.8 1)
(xy 1.8 -1)
) (layer "B.Mask") (width 0.1) (fill solid))
(fp_poly (pts
(xy -1.8 -1)
(xy -1.8 1)
(xy -0.4 1)
(xy -0.4 -1)
) (layer "B.Mask") (width 0.1) (fill solid))
(fp_poly (pts
(xy -0.401442 -1)
(xy -0.401442 1)
(xy -1.801442 1)
(xy -1.801442 -1)
) (layer "F.Mask") (width 0.1) (fill solid))
(fp_poly (pts
(xy 1.8 -1)
(xy 1.8 1)
(xy 0.4 1)
(xy 0.4 -1)
) (layer "F.Mask") (width 0.1) (fill solid))
(pad "1" thru_hole circle (at -1.1004 -1.3416) (size 0.4572 0.4572) (drill 0.3048) (layers *.Cu) ${p.net.pos.str})
(pad "1" smd custom (at -1.1 0 180) (size 1.5 2.1) (layers "F.Cu")
(options (clearance outline) (anchor rect))
(primitives
(gr_poly (pts
(xy 0.179 1.3352)
(xy -0.1766 1.3352)
(xy -0.1766 0.762)
(xy 0.179 0.762)
) (width 0.1) (fill yes))
))
(pad "1" smd custom (at -1.1 0) (size 1.5 2.1) (layers "B.Cu")
(options (clearance outline) (anchor rect))
(primitives
(gr_poly (pts
(xy 0.176556 -0.7618)
(xy -0.179044 -0.7618)
(xy -0.179044 -1.335)
(xy 0.176556 -1.335)
) (width 0.1) (fill yes))
))
(pad "2" thru_hole circle (at 1.1 -1.3416) (size 0.4572 0.4572) (drill 0.3048) (layers *.Cu) ${p.net.neg.str})
(pad "2" smd custom (at 1.1 0 180) (size 1.5 2.1) (layers "F.Cu")
(options (clearance outline) (anchor rect))
(primitives
(gr_poly (pts
(xy 0.1786 1.3352)
(xy -0.177 1.3352)
(xy -0.177 0.762)
(xy 0.1786 0.762)
) (width 0.1) (fill yes))
))
(pad "2" smd custom (at 1.1 0) (size 1.5 2.1) (layers "B.Cu")
(options (clearance outline) (anchor rect))
(primitives
(gr_poly (pts
(xy 0.1766 -0.7618)
(xy -0.179 -0.7618)
(xy -0.179 -1.335)
(xy 0.1766 -1.335)
) (width 0.1) (fill yes))
))
)
`
}

View File

@ -1,121 +0,0 @@
// Kailh Choc PG1350
// Nets
// from: corresponds to pin 1
// to: corresponds to pin 2
// Params
// hotswap: default is false
// if true, will include holes and pads for Kailh choc hotswap sockets
// reverse: default is false
// if true, will flip the footprint such that the pcb can be reversible
// keycaps: default is false
// if true, will add choc sized keycap box around the footprint
//
// note: hotswap and reverse can be used simultaneously
module.exports = {
nets: {
from: undefined,
to: undefined
},
params: {
class: 'S',
hotswap: false,
reverse: false,
keycaps: false
},
body: p => {
const standard = `
(module PG1350 (layer F.Cu) (tedit 5DD50112)
${p.at /* parametric position */}
${'' /* footprint reference */}
(fp_text reference "${p.ref}" (at 0 0) (layer F.SilkS) ${p.ref_hide} (effects (font (size 1.27 1.27) (thickness 0.15))))
(fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))
${''/* diode box marker */}
(fp_line (start 2.868 3.326) (end 2.868 5.476) (layer "Dwgs.User") (width 0.15))
(fp_line (start -2.732 5.476) (end 2.868 5.476) (layer "Dwgs.User") (width 0.15))
(fp_line (start 2.868 3.326) (end -2.732 3.326) (layer "Dwgs.User") (width 0.15))
(fp_line (start -2.732 3.326) (end -2.732 5.476) (layer "Dwgs.User") (width 0.15))
${''/* diode direction marker */}
(fp_line (start -0.282 4.426) (end 0.318 4.026) (layer "F.SilkS") (width 0.1))
(fp_line (start 0.318 4.826) (end -0.282 4.426) (layer "F.SilkS") (width 0.1))
(fp_line (start -0.282 4.426) (end -0.282 3.876) (layer "F.SilkS") (width 0.1))
(fp_line (start -0.282 4.426) (end -0.282 4.976) (layer "F.SilkS") (width 0.1))
(fp_line (start -0.682 4.426) (end -0.282 4.426) (layer "F.SilkS") (width 0.1))
(fp_line (start 0.318 4.426) (end 0.818 4.426) (layer "F.SilkS") (width 0.1))
(fp_line (start 0.318 4.026) (end 0.318 4.826) (layer "F.SilkS") (width 0.1))
${''/* diode pads */}
(pad "" smd rect (at 1.776 4.401 ${ p.rot }) (size 1.1 1.9) (layers "B.Cu" "B.Paste" "B.Mask"))
(pad 2 smd rect (at -1.524 4.401 ${ p.rot }) (size 1.1 1.9) (layers "B.Cu" "B.Paste" "B.Mask") ${p.net.to.str})
${''/* corner marks */}
(fp_line (start -7 -6) (end -7 -7) (layer Dwgs.User) (width 0.15))
(fp_line (start -7 7) (end -6 7) (layer Dwgs.User) (width 0.15))
(fp_line (start -6 -7) (end -7 -7) (layer Dwgs.User) (width 0.15))
(fp_line (start -7 7) (end -7 6) (layer Dwgs.User) (width 0.15))
(fp_line (start 7 6) (end 7 7) (layer Dwgs.User) (width 0.15))
(fp_line (start 7 -7) (end 6 -7) (layer Dwgs.User) (width 0.15))
(fp_line (start 6 7) (end 7 7) (layer Dwgs.User) (width 0.15))
(fp_line (start 7 -7) (end 7 -6) (layer Dwgs.User) (width 0.15))
${''/* middle shaft */}
(pad "" np_thru_hole circle (at 0 0) (size 3.429 3.429) (drill 3.429) (layers *.Cu *.Mask))
${''/* stabilizers */}
(pad "" np_thru_hole circle (at 5.5 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at -5.5 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
`
const keycap = `
${'' /* keycap marks */}
(fp_line (start -9 -8.5) (end 9 -8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9 -8.5) (end 9 8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9 8.5) (end -9 8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start -9 8.5) (end -9 -8.5) (layer Dwgs.User) (width 0.15))
`
function pins(def_neg, def_pos, def_side) {
if(p.param.hotswap) {
return `
${'' /* holes */}
(pad "" np_thru_hole circle (at ${def_pos}5 -3.75) (size 3 3) (drill 3) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at 0 -5.95) (size 3 3) (drill 3) (layers *.Cu *.Mask))
${'' /* net pads (other pad is with diode) */}
(pad 1 smd rect (at ${def_neg}3.275 -5.95 ${p.rot}) (size 2.6 2.6) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask) ${p.net.from.str})
${''/* right hotswap pad and trace to diode */}
(pad "" smd custom (at 8.275 -3.75 ${ p.rot }) (size 2.6 2.6) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask)
(clearance 0.2)
(options (clearance outline) (anchor rect))
(primitives
(gr_line (start -0.5 1) (end -0.5 4.6) (width 0.2))
(gr_line (start -3.3284 7.4284) (end -6.5 7.4284) (width 0.2))
(gr_line (start -0.499981 4.599974) (end -3.328408 7.428401) (width 0.2))
))
`
} else {
return `
${''/* pins (other pad is with diode) */}
(pad 1 thru_hole circle (at ${def_pos}5 -3.8) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net.from.str})
`
}
}
if(p.param.reverse) {
return `
${standard}
${p.param.keycaps ? keycap : ''}
${pins('-', '', 'B')}
${pins('', '-', 'F')})
`
} else {
return `
${standard}
${p.param.keycaps ? keycap : ''}
${pins('-', '', 'B')})
`
}
}
}

View File

@ -1,109 +0,0 @@
// Kailh Choc PG1232
// Nets
// from: corresponds to pin 1
// to: corresponds to pin 2
// Params
// reverse: default is false
// if true, will flip the footprint such that the pcb can be reversible
// keycaps: default is false
// if true, will add choc sized keycap box around the footprint
module.exports = {
nets: {
from: undefined,
to: undefined
},
params: {
class: 'S',
side: 'F',
keycaps: false
},
body: p => {
const standard = `
(module lib:Kailh_PG1232 (layer F.Cu) (tedit 5E1ADAC2)
${p.at /* parametric position */}
${'' /* footprint reference */}
(fp_text reference "${p.ref}" (at 0 0) (layer F.SilkS) ${p.ref_hide} (effects (font (size 1.27 1.27) (thickness 0.15))))
(fp_text value Kailh_PG1232 (at 0 -7.3) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15))))
${'' /* corner marks */}
(fp_line (start -7.25 -6.75) (end -6.25 -6.75) (layer Dwgs.User) (width 0.15))
(fp_line (start -7.25 -6.75) (end -7.25 -5.75) (layer Dwgs.User) (width 0.15))
(fp_line (start -7.25 6.75) (end -6.25 6.75) (layer Dwgs.User) (width 0.15))
(fp_line (start -7.25 6.75) (end -7.25 5.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 7.25 -6.75) (end 6.25 -6.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 7.25 -6.75) (end 7.25 -5.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 7.25 6.75) (end 6.25 6.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 7.25 6.75) (end 7.25 5.75) (layer Dwgs.User) (width 0.15))
${''/* diode box marker */}
(fp_line (start 2.8 -5.35) (end -2.8 -5.35) (layer Dwgs.User) (width 0.15))
(fp_line (start -2.8 -3.2) (end 2.8 -3.2) (layer Dwgs.User) (width 0.15))
(fp_line (start 2.8 -3.2) (end 2.8 -5.35) (layer Dwgs.User) (width 0.15))
(fp_line (start -2.8 -3.2) (end -2.8 -5.35) (layer Dwgs.User) (width 0.15))
${''/* diode direction marker */}
(fp_line (start 0.35 -4.3) (end 0.35 -3.75) (layer "F.SilkS") (width 0.1))
(fp_line (start -0.25 -3.9) (end -0.25 -4.7) (layer "F.SilkS") (width 0.1))
(fp_line (start -0.25 -4.3) (end -0.75 -4.3) (layer "F.SilkS") (width 0.1))
(fp_line (start 0.35 -4.3) (end 0.35 -4.85) (layer "F.SilkS") (width 0.1))
(fp_line (start 0.75 -4.3) (end 0.35 -4.3) (layer "F.SilkS") (width 0.1))
(fp_line (start 0.35 -4.3) (end -0.25 -3.9) (layer "F.SilkS") (width 0.1))
(fp_line (start -0.25 -4.7) (end 0.35 -4.3) (layer "F.SilkS") (width 0.1))
${''/* middle shaft */}
(fp_line (start 2.25 2.6) (end 5.8 2.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -2.25 2.6) (end -5.8 2.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start 2.25 3.6) (end 2.25 2.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -2.25 3.6) (end 2.25 3.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -2.25 2.6) (end -2.25 3.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -5.8 2.6) (end -5.8 -2.95) (layer Edge.Cuts) (width 0.12))
(fp_line (start 5.8 -2.95) (end 5.8 2.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -5.8 -2.95) (end 5.8 -2.95) (layer Edge.Cuts) (width 0.12))
${''/* stabilizers */}
(pad 3 thru_hole circle (at 5.3 -4.75) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) (clearance 0.2))
(pad 4 thru_hole circle (at -5.3 -4.75) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) (clearance 0.2))
${''/* bottom-left switch pin */}
(pad 1 thru_hole circle (at -4.58 5.1) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) ${p.net.from.str} (clearance 0.2))
${''/* bottom-right switch pin and trace */}
(pad "" smd custom (at 2 5.4 ${ p.rot }) (size 1.6 1.6) (layers "F.Cu")
(clearance 0.2)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0 0) (end -4 0) (width 0.13))
(gr_line (start -4 0) (end -6 -2) (width 0.13))
(gr_line (start -6 -2) (end -8 -2) (width 0.13))
(gr_line (start -8.5 -2.5) (end -8.5 -8.35) (width 0.13))
(gr_line (start -8 -8.85) (end -3.65 -8.85) (width 0.13))
(gr_line (start -8.5 -8.35) (end -8 -8.85) (width 0.13) (fill yes))
(gr_line (start -8.5 -2.5) (end -8 -2) (width 0.13) (fill yes))
))
(pad "" thru_hole circle (at 2 5.4 22) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) (clearance 0.2))
${''/* diode pads */}
(pad "" smd rect (at -1.65 -4.3 ${ p.rot }) (size 1.1 1.9) (layers "F.Cu" "F.Paste" "F.Mask"))
(pad "2" smd rect (at 1.65 -4.3 ${ p.rot }) (size 1.1 1.9) (layers "F.Cu" "F.Paste" "F.Mask") ${p.net.to.str})
`
const keycap = `
${'' /* keycap marks */}
(fp_line (start -9 -8.5) (end 9 -8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9 -8.5) (end 9 8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9 8.5) (end -9 8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start -9 8.5) (end -9 -8.5) (layer Dwgs.User) (width 0.15))
`
return `
${standard}
${p.param.keycaps ? keycap : ''}
)
`
}
}

View File

@ -4,11 +4,6 @@ module.exports = {
from: undefined,
to: undefined
},
params: {
class: 'D',
through_hole: true,
via_in_pad: false
},
body: p => `
(module ComboDiode (layer F.Cu) (tedit 5B24D78E)
@ -36,32 +31,16 @@ module.exports = {
(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))
${ p.param.via_in_pad ?
`
${''/* Vias in SMD pads */}
(pad 1 thru_hole rect (at -1.65 0 ${ p.rot }) (size 0.9 1.2) (drill 0.3) (layers *.Cu *.Mask) (zone_connect 2) ${ p.net.to.str })
(pad 2 thru_hole rect (at 1.65 0 ${ p.rot }) (size 0.9 1.2) (drill 0.3) (layers *.Cu *.Mask) (zone_connect 2) ${ p.net.from.str })
`
:
`
${ ''/* SMD pads on both sides */ }
(pad 1 smd rect (at -1.65 0 ${ p.rot }) (size 0.9 1.2) (layers F.Cu F.Paste F.Mask) ${ p.net.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.net.from.str })
(pad 1 smd rect (at -1.65 0 ${ p.rot }) (size 0.9 1.2) (layers B.Cu B.Paste B.Mask) ${ p.net.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.net.from.str })
`
}
${''/* SMD pads on both sides */}
(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 B.Cu B.Paste B.Mask) ${p.from.str})
(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 F.Cu F.Paste F.Mask) ${p.from.str})
${ p.param.through_hole === false ?
''
:
`
${''/* THT terminals */}
(pad 1 thru_hole circle (at 3.81 0 ${ p.rot }) (size 1.905 1.905) (drill 0.9906) (layers *.Cu *.Mask) ${ p.net.from.str })
(pad 2 thru_hole rect (at -3.81 0 ${ p.rot }) (size 1.778 1.778) (drill 0.9906) (layers *.Cu *.Mask) ${ p.net.to.str })
`
}
(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})
)
`
}

View File

@ -1,15 +1,11 @@
module.exports = {
alps: require('./alps'),
battery_pads: require('./battery_pads.js'),
button: require('./button'),
choc: require('./choc'),
choc_with_diode: require('./choc_with_diode'),
chocmini: require('./chocmini'),
chocmini_with_diode: require('./chocmini_with_diode'),
diode: require('./diode'),
jstph: require('./jstph'),
jumper: require('./jumper'),
m2_mounting_hole: require('./m2_mounting_hole'),
mx: require('./mx'),
oled: require('./oled'),
omron: require('./omron'),
@ -20,6 +16,5 @@ module.exports = {
scrollwheel: require('./scrollwheel'),
slider: require('./slider'),
trrs: require('./trrs'),
two_lead_button: require('./two_lead_button'),
via: require('./via'),
}

View File

@ -1,16 +0,0 @@
module.exports = {
body: p => `
(module M2MountingHole
(layer "F.Cu")
${p.at /* parametric position */}
(fp_text reference "HOLE1" (at 0 -3.2 22) (layer "F.SilkS") hide
(effects (font (size 1 1) (thickness 0.15))))
(fp_text value "Val**" (at 0 0) (layer "F.SilkS") hide
(effects (font (size 1.27 1.27) (thickness 0.15))))
(fp_circle (center 0 0) (end 2 0) (layer "F.CrtYd") (width 0.05) (fill none))
(pad "1" thru_hole circle (at 0 0 22) (size 3.6 3.6) (drill 2.2) (layers *.Cu *.Mask))
)
`
}

View File

@ -1,19 +0,0 @@
module.exports = {
nets: {
from: undefined,
to: undefined,
},
body: p => `
(module TwoLeadButton
(layer "F.Cu")
${p.at /* parametric position */}
(fp_text reference "B1" (at 0 0 unlocked) (layer "F.SilkS") (effects (font (size 1 1) (thickness 0.15))))
(fp_text value "Button" (at 0 2.54 unlocked) (layer "F.Fab") (effects (font (size 1 1) (thickness 0.15))))
(fp_text user "Button" (at 0 0 unlocked) (layer "F.Fab") (effects (font (size 1 1) (thickness 0.15))))
(pad "1" smd roundrect (at -2.2 0) (size 1 2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) ${p.net.from.str})
(pad "2" smd roundrect (at 2.2 0) (size 1 2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) ${p.net.to.str})
)
`
}

View File

@ -92,7 +92,6 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key,
orient: 0,
shift: [0, 0],
rotate: 0,
adjust: {},
width: units.$default_width,
height: units.$default_height,
padding: units.$default_padding,
@ -169,17 +168,11 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key,
// copy the current column anchor
let point = running_anchor.clone()
// apply cumulative per-key adjustments
// apply per-key adjustments
point.r += key.orient
point.shift(key.shift)
point.r += key.rotate
// commit running anchor
running_anchor = point.clone()
// apply independent adjustments
point = anchor_lib.parse(key.adjust, `${key.name}.adjust`, {}, point)(units)
// save new key
point.meta = key
points[key.name] = point
@ -189,6 +182,7 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key,
col_minmax[col_name].max = Math.max(col_minmax[col_name].max, point.y)
// advance the running anchor to the next position
running_anchor = point.clone()
running_anchor.shift([0, key.padding])
}

View File

@ -14,7 +14,6 @@ matrix:
- 0
- 0
rotate: 0
adjust: {}
width: 18
height: 18
padding: 19

View File

@ -14,7 +14,6 @@ matrix_col_row:
- 0
- 0
rotate: 0
adjust: {}
width: 18
height: 18
padding: 19

View File

@ -3,21 +3,17 @@ points:
matrix:
columns:
left:
middle.rows.home.adjust:
shift: [-2u, 0]
rotate: 45
right:
key:
stagger: 5
spread: 25
splay: -5
splay: 5
origin: [-9, -9]
rows:
home:
top:
orient: -90
shift: [0, 10]
rotate: 90
rows:
bottom:
home:
top:

View File

@ -145,227 +145,35 @@ LINE
8
0
10
-9
20
47
11
9
21
47
0
LINE
8
0
10
9
20
47
11
9
21
29
0
LINE
8
0
10
9
20
29
11
-9
21
29
0
LINE
8
0
10
-9
20
29
11
-9
21
47
0
LINE
8
0
10
10
20
9
11
28
21
9
0
LINE
8
0
10
28
20
9
11
28
21
-9
0
LINE
8
0
10
28
20
-9
11
10
21
-9
0
LINE
8
0
10
10
20
-9
11
10
21
9
0
LINE
8
0
10
-31.7279221
20
19
11
-19
21
31.7279221
0
LINE
8
0
10
-19
20
31.7279221
11
-6.2720779
21
19
0
LINE
8
0
10
-6.2720779
20
19
11
-19
21
6.2720779
0
LINE
8
0
10
-19
20
6.2720779
11
-31.7279221
21
19
0
LINE
8
0
10
10
20
47
11
28
21
47
0
LINE
8
0
10
28
20
47
11
28
21
29
0
LINE
8
0
10
28
20
29
11
10
21
29
0
LINE
8
0
10
10
20
29
11
10
21
47
0
LINE
8
0
10
36.5688034
14.4311966
20
13.9315046
11
54.500308
32.3627012
21
12.3627012
15.500308
0
LINE
8
0
10
54.500308
32.3627012
20
12.3627012
15.500308
11
52.9315046
33.9315046
21
-5.5688034
-2.4311966
0
LINE
8
0
10
52.9315046
33.9315046
20
-5.5688034
-2.4311966
11
35
16
21
-4
0
@ -373,11 +181,11 @@ LINE
8
0
10
35
16
20
-4
11
36.5688034
14.4311966
21
13.9315046
0
@ -385,97 +193,49 @@ LINE
8
0
10
48.1867095
22.7371845
20
31.9876465
33.7307613
11
66.1182141
40.6686891
21
30.4188431
35.2995647
0
LINE
8
0
10
66.1182141
40.6686891
20
30.4188431
35.2995647
11
64.5494107
42.2374925
21
12.4873385
17.3680601
0
LINE
8
0
10
64.5494107
42.2374925
20
12.4873385
17.3680601
11
46.6179061
24.3059879
21
14.0561419
15.7992567
0
LINE
8
0
10
46.6179061
24.3059879
20
14.0561419
15.7992567
11
48.1867095
22.7371845
21
31.9876465
0
LINE
8
0
10
49.8426686
20
50.9153458
11
67.7741732
21
49.3465424
0
LINE
8
0
10
67.7741732
20
49.3465424
11
66.2053698
21
31.4150378
0
LINE
8
0
10
66.2053698
20
31.4150378
11
48.2738652
21
32.9838412
0
LINE
8
0
10
48.2738652
20
32.9838412
11
49.8426686
21
50.9153458
33.7307613
0
ENDSEC
0

View File

@ -17,7 +17,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -29,33 +28,18 @@
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"splay": 5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"top": {
"orient": -90,
"shift": [
0,
@ -69,7 +53,6 @@
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
@ -82,13 +65,13 @@
"row": "bottom",
"bind": [
10,
10,
0,
0,
0
]
}
},
"matrix_left_home": {
"matrix_left_top": {
"x": 0,
"y": 19,
"r": 0,
@ -106,96 +89,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "left_home",
"name": "matrix_left_home",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {},
"key": {},
"name": "left"
},
"row": "home",
"bind": [
10,
10,
10,
0
]
}
},
"matrix_left_top": {
"x": 0,
"y": 38,
"r": 0,
"meta": {
"stagger": 0,
"spread": 19,
"splay": 0,
"origin": [
0,
0
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -207,33 +100,18 @@
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"splay": 5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"top": {
"orient": -90,
"shift": [
0,
@ -247,7 +125,6 @@
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
@ -266,317 +143,14 @@
]
}
},
"matrix_middle_bottom": {
"x": 19,
"y": 0,
"r": 0,
"meta": {
"stagger": 0,
"spread": 19,
"splay": 0,
"origin": [
0,
0
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "middle_bottom",
"name": "matrix_middle_bottom",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"row": "bottom",
"bind": [
10,
0,
0,
10
]
}
},
"matrix_middle_home": {
"x": -19,
"y": 19,
"r": 45,
"meta": {
"stagger": 0,
"spread": 19,
"splay": 0,
"origin": [
0,
0
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "middle_home",
"name": "matrix_middle_home",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"row": "home",
"bind": [
10,
10,
10,
10
]
}
},
"matrix_middle_top": {
"x": 19,
"y": 38,
"r": 0,
"meta": {
"stagger": 0,
"spread": 19,
"splay": 0,
"origin": [
0,
0
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "middle_top",
"name": "matrix_middle_top",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"row": "top",
"bind": [
0,
10,
10,
10
]
}
},
"matrix_right_bottom": {
"x": 44.750154,
"y": 4.1813506,
"r": -5,
"x": 24.181350600000002,
"y": 5.750154,
"r": 5,
"meta": {
"stagger": 5,
"spread": 25,
"splay": -5,
"splay": 5,
"origin": [
-9,
-9
@ -587,7 +161,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -599,33 +172,18 @@
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"splay": 5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"top": {
"orient": -90,
"shift": [
0,
@ -639,7 +197,6 @@
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
@ -648,14 +205,14 @@
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"splay": 5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"top": {
"orient": -90,
"shift": [
0,
@ -675,14 +232,14 @@
]
}
},
"matrix_right_home": {
"x": 56.3680601,
"y": 22.237492500000002,
"r": -5,
"matrix_right_top": {
"x": 32.4873385,
"y": 25.549410700000003,
"r": 5,
"meta": {
"stagger": 5,
"spread": 25,
"splay": -5,
"splay": 5,
"origin": [
-9,
-9
@ -693,113 +250,6 @@
10
],
"rotate": 90,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "right_home",
"name": "matrix_right_home",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
},
"row": "home",
"bind": [
10,
0,
10,
10
]
}
},
"matrix_right_top": {
"x": 58.0240192,
"y": 41.1651918,
"r": -5,
"meta": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -811,33 +261,18 @@
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"splay": 5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"top": {
"orient": -90,
"shift": [
0,
@ -851,7 +286,6 @@
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
@ -860,14 +294,14 @@
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"splay": 5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"top": {
"orient": -90,
"shift": [
0,

View File

@ -17,7 +17,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -69,7 +68,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -121,7 +119,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -173,7 +170,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,

View File

@ -17,7 +17,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -61,7 +60,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,

View File

@ -17,7 +17,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -88,7 +87,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -152,7 +150,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -216,7 +213,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -287,7 +283,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -351,7 +346,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -415,7 +409,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -486,7 +479,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -550,7 +542,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -614,7 +605,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -685,7 +675,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -749,7 +738,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,

View File

@ -17,7 +17,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -86,7 +85,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -155,7 +153,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -226,7 +223,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -297,7 +293,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -368,7 +363,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -443,7 +437,6 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,

View File

@ -49,21 +49,17 @@ describe('Filter', function() {
names(filter('/^o/', '', points)).should.deep.equal(['one', 'three', 'mirror_one'])
// middle spec, should be the same as above, only explicit
names(filter('~ /^o/', '', points)).should.deep.equal(['one', 'three', 'mirror_one'])
// full spec (/n/ would normally match both "one" and "even", but on the tags level, it's just even)
// full spec (n would normally match both one and even, but on the tags level, it's just even)
names(filter('meta.tags ~ /n/', '', points)).should.deep.equal(['two'])
names(filter('meta.name,meta.tags ~ /n/', '', points)).should.deep.equal(['one', 'two', 'mirror_one'])
// negation
names(filter('meta.tags ~ -/n/', '', points)).should.deep.equal(['one', 'three', 'mirror_one'])
names(filter('meta.name,meta.tags ~ -/n/', '', points)).should.deep.equal(['three'])
// arrays OR by default at odd levels (including top level)...
names(filter(['one', 'two'], '', points)).should.deep.equal(['one', 'two'])
// ...and AND at even levels
names(filter([['even', 'prime']], '', points)).should.deep.equal(['two'])
// arbitrary nesting should be possible
names(filter([[['even', 'odd'], 'prime']], '', points)).should.deep.equal(['two', 'three'])
// invalid regexes should throw meaningful errors
filter.bind(this, '/\\/', '', points).should.throw('Invalid regex')
// anything other than string/array/object/undefined is also an error
// anything other than string/array/object/undefined is an error
filter.bind(this, 28, '', points).should.throw('Unexpected type')
})