Code Monkey home page Code Monkey logo

ergogen's Introduction

Ergogen

Ergonomic Keyboard Generator


The project aims to provide a common configuration format to describe ergonomic 2D layouts and generate automatic plates, cases, as well as un-routed PCBs for them. The project grew out of (and is an integral part of) the Absolem keyboard, and shares its Discord server as well.





Button WebUI Button Documentation Button Discord Button Donate




Getting Started

Until there's a proper "Getting started" guide, try getting acquainted with Ergogen by following these steps in order:


  1. Read the Documentation.

    D'uuh. They're not complete by any measure, but should give you a fairly good idea what you're dealing with here.


  2. Try one of the web-based deployments.

    Button Official    Button Unofficial

    The unofficial deployment is probably better, tbh, and will soon be replacing the official one. Choose either one, then click things, look at outputs and see if things start to make sense.

    There is no need for you to download the CLI unless you want to do one of the following:

    • Preview in-development features
    • Use custom modifications
    • Contribute code

  3. Search the ergogen topic on GitHub.

    There, you can look at (and reverse engineer) a variety of real life configs using Ergogen. Pop them into the web UI to see what they do, tinker with them and things should start to make more sense.


  4. If a question persists after all of the above, feel free to ask it over on Discord and we'll do our best to help you out.


Contributions

Feature ideas, documentation improvements, examples, tests, or pull requests welcome! Get in touch on our Discord, and we can definitely find something you can help with, if you'd like to.


Sponsors

Huge thanks go to everyone who chooses to support my work! But even huger thanks are due to the following, distinguished sponsors:

ergogen's People

Contributors

aarondovturkel avatar albert-iv avatar anarion80 avatar brow avatar ceoloide avatar electronicsarchiver avatar fanchgadjo avatar infused-kim avatar l-kershaw avatar merlin04 avatar miigon avatar mrzealot avatar mveerd avatar tapioki avatar torik42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ergogen's Issues

KLE import broken

When importing a KLE json

❯ node src/cli.js ~/Downloads/keyboard-layout.json -o kle
Ergogen v4.0.2 CLI

Interpreting format: KLE (Auto-debug)
Preprocessing input...
Calculating variables...
Parsing points...
Error: Unexpected key "rotate" within field "points.zones.key1.columns.key1col"!
    at exports.assert (/home/tilli/git/ergogen/ergogen/src/assert.js:12:15)
    at exports.unexpected (/home/tilli/git/ergogen/ergogen/src/assert.js:35:9)
    at exports._render_zone (/home/tilli/git/ergogen/ergogen/src/points.js:58:11)
    at exports.parse (/home/tilli/git/ergogen/ergogen/src/points.js:296:26)
    at Object.process (/home/tilli/git/ergogen/ergogen/src/ergogen.js:54:31)
    at /home/tilli/git/ergogen/ergogen/src/cli.js:127:29
    at Object.<anonymous> (/home/tilli/git/ergogen/ergogen/src/cli.js:195:3)
    at Module._compile (node:internal/modules/cjs/loader:1267:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
    at Module.load (node:internal/modules/cjs/loader:1125:32)

@mrzealot did some digging and found out that the kle import still uses column level attributes rather than key level ones.

// adding a column-level rotation with origin

The KLE JSON was literally from the ANSI 101 preset in KLE.

Error: Unexpected key "stagger" within field "points.zones.matrix.columns.pinky"!

Hello,
I've tried everything to make my config file work with cli.js, but each time I get:

Ergogen v4.0.0-develop CLI

Interpreting format: YAML
Preprocessing input...
Calculating variables...
Parsing points...
Error: Unexpected key "stagger" within field "points.zones.matrix.columns.pinky"!
    at exports.assert (/home/max/ergogen/src/assert.js:12:15)
    at exports.unexpected (/home/max/ergogen/src/assert.js:35:9)
    at exports._render_zone (/home/max/ergogen/src/points.js:58:11)
    at exports.parse (/home/max/ergogen/src/points.js:295:26)
    at Object.process (/home/max/ergogen/src/ergogen.js:52:31)
    at /home/max/ergogen/src/cli.js:58:29
    at Object.<anonymous> (/home/max/ergogen/src/cli.js:126:3)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)

My config file looks like this:

points:
    zones:
        matrix:
            columns:
                pinky_off: null
                pinky:
                    stagger: 7
                ring:
                    stagger: 12
                middle:
                    stagger: 5
                index:
                    stagger: -6
                inner:
                    stagger: -2
                    row_overrides:
                        bottom: null
                        home: null
                        top: null
                        above: null
            rows:
                under: null
                bottom: null
                home: null
                top: null
                above: null
        thumbfan:
            anchor:
                ref: matrix_inner_bottom
                shift:
                    - 0
                    - 0
            columns:
                home:
                    spread: 21.25
                    rotate: -28
                    origin:
                        - -11.75
                        - -9
                far:
                    spread: 21.25
                    rotate: -28
                    origin:
                        - -9.5
                        - -9
            rows:
                thumb: null
        thumbfn:
            anchor:
                ref: matrix_inner_bottom
                shift:
                    - 0
                    - -70
            columns:
                thumfn: null
            rows:
                thumbfn: null

(copied from canonical.yaml)
What can I do? Am I missing something?
Thanks

Idea: Override config values from command line

@ceoloide came up with a really cool way to do presets in ergogen. This can for example be used to switch between keyboard variations like choc, mx and so on.

You can see it here:
https://github.com/ceoloide/corney-island/blob/main/ergogen/config.yaml

But essentially, you add a preset section to the config with all the unit variables and then you switch between them using:

  switch:
    $extends: presets.mx

Currently to switch a preset you need to change the config.

But I think it would be great if you could do it using the ergogen command:

ergogen config.yaml -o "meta.switch.$extends=presets.choc_v1"

What do you think?

Unnesting does not work for outlines, if primitives are given as array.

The preprocessing usually takes care of unnesting anchor.ref: <something> into {anchor: {ref: <something>}}.
Moreover, one can specify outlines as objects, where each primitive gets an arbitrary name, or as arrays, where one specifies a list of primitives. The latter does not work together with unnesting. Instead, it yields the error Error: Unexpected key "anchor.ref" within field "outlines.exports.does_not_work.0"!. See the example below.

points:
  zones:
    matrix:
      columns:
        col:
          rows:
            row:
outlines:
  exports:
    works1:
      - type: rectangle
        anchor:
          ref: matrix_col_row
        size: [10,10]
    works2:
      rect:
        type: rectangle
        anchor:
          ref: matrix_col_row
        size: [10,10]
    works3:
      rect:
        type: rectangle
        anchor.ref: matrix_col_row
        size: [10,10]
    does_not_work:
      - type: rectangle
        anchor.ref: matrix_col_row
        size: [10,10]

outline.{{id}}.where does not accept a list of refs

Version: v4.0.0 at https://ergogen.cache.works

I've figured out how to draw specific keys by looking at the tests, and ended up with something like:
...
outlines:
keycap_1u:
- what: rectangle
size: [1cx - 0.5, 1cy - 0.5]
bound: false
keycaps:
- what: outline
name: keycap_1u
where:
- ref: matrix_pinkie_home
- what: outline
name: keycap_1u
where:
- ref: matrix_pinkie_top
- what: outline
name: keycap_1u
where:
- ref: matrix_ring_home
- what: outline
name: keycap_1u
where:
- ref: matrix_ring_top
...

I would expect avoiding repetitions by using the following config, but it only draw the last element.

outlines:
  keycap_1u:
    - what: rectangle
      size: [1cx - 0.5, 1cy - 0.5]
      bound: false
  keycaps:
    - what: outline
      name: keycap_1u
      where:
        - ref: matrix_pinkie_home
        - ref: matrix_pinkie_top
        - ref: matrix_ring_home
        - ref: matrix_ring_top
        # Also tried - ref: [matrix_pinkie_home,matrix_pinkie_top,matrix_ring_home,matrix_ring_top]

Error while parsing absolem.yaml using ergogen

Hi, I was trying to generate the output for the default absolem board (with the cases & everything), so I tried to use the absolem config file from the absolem repo (from here).

However, I get the following error:

Preparing input...
Parsing points...
/home/user/keyboards/ergogen/src/assert.js:12
        throw new Error(msg)
        ^

Error: Unexpected key "extends" within field "points.zones.s19"!
    at exports.assert (/home/user/keyboards/ergogen/src/assert.js:12:15)
    at Object.exports.detect_unexpected (/home/user/keyboards/ergogen/src/assert.js:35:9)
    at exports._render_zone (/home/user/keyboards/ergogen/src/points.js:22:7)
    at Object.exports.parse (/home/user/keyboards/ergogen/src/points.js:254:28)
    at Object.process (/home/user/keyboards/ergogen/src/ergogen.js:19:44)
    at Object.<anonymous> (/home/user/keyboards/ergogen/src/cli.js:66:25)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)

I'm running node v15.8.0 and npm v6.14.11 on Manjaro 5.10.15.

anchors at mirrored side has weird behaviour, which is even changed with `affect: xyr`

The configuration anchors-of-mirrored-side.txt creates the following output:
test_outline

The rectangles are created with something like.

      - type: rectangle
        anchor:
          - ref: mirror_matrix_only_top
            affect: xyr
          - shift: [-3,-3]
            orient: 30
        size: [6,6]

Up to the anchors the only difference is, that affect: xyr is removed for the bottom keys. I would expect the behaviour from the left side also on the right (which is the mirrored one), i.e. affect: xyr should make no difference, but also, the upper version is the correct one.

Add ability to load 3D shapes from a library

Pretty much like footprints, add the ability to bundle or load 3D shapes from a library.

This is particularly useful when having to deal with non-planar features like USB-C cutouts for case walls, but is also useful for "mostly-planar" complex shapes like hotswap sockets.

Inconsistent to/from parameters for hotswap pads in choc footprint

The choc footprint bundled with ergogen has an inconsistency: to and from roles are swapped in hotswap mode, compared to non hotswap.
Indeed : in hotswap mode, the pad connected to to net is SMD pad 2, which is the column pad, while in non-hotswap mode, the pad connected to to is TH pad 2, which is the row pad.

Since the non-hotswap follows the tradition (col2row), the hotswap pads should be fixed (also their numbering should be made consistent: SMD-1 should play the same role as TH-1 and SMD-2 the same as TH-2).

Support Rotary Encoders

Support Rotary Encoders like Kyria. Not sure what needs to be done here, but creating a place holder task for development.

`$extends` should be recursive

I have been working on an ergogen cookbook with @jcmkk3's input, and one technique we agree upon is that in our configs we should prefer $extends to yaml &anchors when DRYing up configs. Since ergogen supports both yaml and json file formats, $extends is format-agnostic, while yaml anchors obviously don't work in json files.

The only catch is that you currently cannot nest $extends directives. See below.

Examples

Nested/recursive $extends do not work

# Nested $extends do not work
meta.engine: "4.0.0"

points:
  zones.matrix:
    mirror:
      ref: some_key
      distance: 4U
    key.name: some_key

  zones.moungting_hole_top:
    mirror:
      $extends: points.zones.matrix.mirror
    anchor.shift: [0, -1.25U]
    key.tags: [mounting_hole]

  zones.moungting_hole_bottom:
    $extends: points.zones.moungting_hole_top
    anchor.shift: [0, 1.25U]

Nested yaml anchors do work

# An $extends with an anchor does work
meta.engine: "4.0.0"

points:
  zones.matrix:
    mirror: &mirror
      ref: some_key
      distance: 4U
    key.name: some_key

  zones.moungting_hole_top:
    mirror: *mirror
    anchor.shift: [0, -1.25U]
    key.tags: [mounting_hole]

  zones.moungting_hole_bottom:
    $extends: points.zones.moungting_hole_top
    anchor.shift: [0, 1.25U]

Unexpected YAML properties behavior

WIth this example as context:

points:
  key.tags: [key, key_1u]
  zones:
    matrix:
      columns:
        pinky:
          rows.top.tags: [key_1_25u]
        ring:
        middle:
        index:
        inner:
      rows:
        bottom:
        home:
        top:
outlines:
  debug:
    - what: rectangle
      where: [key]
      size: 14
    - what: rectangle
      where: [key_1u]
      size: 18
      operation: stack
    - what: rectangle
      where: [key_1_25u]
      size: [22.5, 18]
      adjust:
        shift: [-2.25,0]
      operation: stack

I would expect the end result for matrix_pinky_top to either be tags: [key_1_25u] or the full list: tags: [key, key_1u, key_1_25u], but is instead tags: [key_1u, key_1_25u]:

Screenshot 2024-04-12 at 9 36 04 AM

Support for newer OpenJSCAD

Hi, thanks for a great tool.

Currently the .jscad files generated from ergogen are using an older API format from about 2017 (now basically archived as branch V1 of the OpenJSCAD repository). This API has been largely abandoned and replaced with a different API (user guide, API reference).

Unfortunately, due to updates in computing hardware, OS, node.js/npm and other factors, I've been unable to run this V1 variant locally, and as such cannot render or convert the .jscad files produced by ergogen.

I realize ergogen v4 is a WIP and this is not necessarily a high priority, but I'm opening this issue to at least track the request. Time permitting, I might see whether I can take a stab at implementing this request.

Error: Field "outlines.exports.raw" should be of type object!

I am trying to gen my new keyboard but I keep getting the error that 'raw' should be an object, it looks like a list, but when I remove the dashes the error changes to be 'unknown attribute "type"'. I am using basically the same outlines as benvallack who does not seem to be having any issues. I am very new to ergogen.

here is my current file:
points: key: padding: cy tags: 1u: true footprints: choc_hotswap: type: choc nets: from: =column_net to: GND params: keycaps: true reverse: true hotswap: true choc: type: choc anchor: rotate: 180 nets: from: =column_net to: GND params: keycaps: true reverse: true zones: mousemode: anchor: rotate: 0 shift: [94, -5] pinkygroup: anchor: rotate: 10 shift: [-22, 16] columns: pinky: rows: top: bottom: matrix: anchor: rotate: 10 columns: pinky: ring: key.origin: [-12, -19] key.stagger: 8 key.splay: -4 middle: key.stagger: 2 key.splay: -4 index: key.stagger: -2 key.splay: -4 inner: key.stagger: -8 rows: bottom: home: top: thumbgroup: anchor: ref: matrix_inner_bottom shift: [-32, -32] columns: inner: key.splay: -22 home: key.splay: -4 outer: key.splay: -4 far: key.splay: -4 rows: upper: lower: rotate: -20 outlines: exports: raw: - type: keys side: left size: [1cx , 1cx] - type: rectangle size: [7, 5] anchor: ref: board_index_top shift: [21, 6] cutouta: - type: outline name: raw fillet: 3 cutoutb: - type: outline name: cutouta fillet: 1 cutout: - type: outline name: cutoutb fillet: 0.5 keycap_outlines: - type: keys side: left size: [1cx - 0.5, 1cy - 0.5] # Choc keycaps are 17.5 x 16.5 bound: false pcbs: card: outlines: main: outline: cutout footprints: promicro: type: promicro anchor: ref: board_far_bottom shift: [0.6, cx+6.3] rotate: -90 params: orientation: down pcm12: type: pcm12 anchor: ref: board_index_top shift: [16.5, 6.5] rotate: 180 nets: from: pos to: RAW params: reverse: true via3: type: via anchor: ref: board_index_top shift: [16,3] nets: net: RAW via4: type: via anchor: ref: board_index_top shift: [18,3] nets: net: pos via5: type: via anchor: ref: board_index_top shift: [23,6.5] nets: net: GND via6: type: via anchor: ref: board_index_top shift: [25,6.5] nets: net: RST b3u1000p: type: b3u1000p nets: r1: RST r2: GND anchor: ref: board_index_top shift: [24.5, 9] rotate: 0 params: reverse: true bat: type: bat nets: neg: GND anchor: ref: board_far_bottom shift: [0.2 , 9] rotate: 90

No more choc hotswap footprints?

What happened to the choc hotswap socket footprints, mentioned here: #16?
I saw that a commit took them out.
Can I just revert back to an older version of the repo and use them normally or what happened?

No support for Cherry MX Low Profile Switches. (Specifications links provided)

Hello Guys,
Cherry MX Low Profile foot print seems to be missing from Ergogen footprint types.

Helper Article:
https://geekhack.org/index.php?topic=108218.0

Another Helper Article:
https://geekhack.org/index.php?topic=106825.0

Possibly Helper File:
https://github.com/keebio/Keebio-Parts.pretty/blob/master/Cherry-MX-Low-Profile.kicad_mod

Possibly Helper Repository:
https://github.com/floookay/crkbd-mxlp/tree/master

Can anyone add it please (or how do we add that), thank you

Add Schematic support

Hello,

Schematic support would enable users to add custom components to the Schematic without learning how to add them to the available footprints of ergogen. You could just add the components and nets in the schematic editor and update the PCB this way.

I would be happy to work on this, but want to first hear some feedback if this would be appreciated.

Warm regards,
Jonas

Best way to implement per-key LEDs?

I'm using this tool for the first time and loving it! So far, I've been able to implement the few things that the tool couldn't do on my own, but I'm struggling with this. I've been looking through the source code and I don't see an immediately obvious way of implementing this nicely, was hoping someone here might have a suggestion.

I'd like to implement per-key LEDs for a keyboard I'm working on. I already have the LEDs getting placed, but I'm struggling to come up with a way to create and link the nets. The LEDs I'm using are sk6812s, which have VCC and GND (easy) as well as DIN and DOUT, which need to be linked to the previous and next LED in the chain, respectively. The first LED needs to have DIN linked to a pin on the micro, and the last LED leaves DOUT unconnected.

There are two problems here:

  1. need to be able to traverse the list of keys in order to link each LED to either the previous or next LED (probably next)
  2. there needs to be some way to define the chain in the yaml.

The first problem is mostly just due to unfamiliarity with the source code. There's probably an easy way to do this.

As for the second one, presumably every layout will have a different ideal chain pattern. For example, you might want to start at the top left and zig-zag across the rows, or you might want to go column-by-column, etc. I can't think of a good way to define this chain in the yaml file.

Anybody have any suggestions or opinions on what a good way to implement this might be? Thanks!

Broken Templating

Hi I recently (perhaps ill-advisedly) switched to the development branch in my project so I could get the footprint array parameter support from b27e103. When I did, I noticed that templating was broken. Going through the recent commits, I've narrowed the issue down to the following change:

-            boolean: v => v === 'true',
-            net: v => v,
-            anchor: v => v,
-            array: v => v
+            boolean: v => v === 'true'

from c45523f#diff-a6c84603fa491ebeb2ebb2ec5eab53e62069a455a716360df36f302c0cbabf50L200-R213

You can use this minimal config to test:

points:
  zones.main:
    rows.home:
    columns.home:
pcbs.minimal.footprints.choc:
  what: choc
  where: true
  params:
      from: "{{name}}"
      to: GND

Using the current develop branch (as of f0d2232) with the minimal config to generate a PCB will yield a net of {{name}} instead of the expected main_home_home. If you then revert that change and build again, you will get the expected main_home_home net.

Footprints should publish what minimum ergogen version they need

This commit streamlined footprint params, introducing additional functions that are not present in older Ergogen versions.

For example, it's now possible to do ${p.r} instead of ${p.rot}. If one were to use a >4.0.4 footprint on Ergogen v4.0.4 they would get "undefined" or other errors that are not easy to debug.

My proposal is to introduce a minimum version for footprints, so that ergogen can detect an older engine version before trying to build, and alert the user to update ergogen.

Unable to change kicad layer for outlines

According to the documentation, I should be able to change what kicad layer outlines go onto.

As far as I can tell, this doesn't work (at least in Kicad v7 which I am using).

I'm using the unofficial ergogen generator at https://ergogen.cache.works/

ergogen_layer_issue.yaml

---
units:
  kx: cx
  ky: cy
points:
  zones: # define actual zones for the keys
    keymatrix:
      key:
        padding: ky
        spread: kx
      columns:
        1:
          key:
        2:
          key:
      rows:
        2:
        1:
outlines:
  raw:
    - what: rectangle
      where: true
      size: [kx, ky]
pcbs:
  layerissue:
    outlines:
      raw:
        outline: raw
        layer: User.Comments
    footprints:
      choc_hotswap:
        what: choc
        where: true
        params:
          keycaps: true
          reverse: false
          hotswap: true
          from: "{{column_net}}"
          to: "{{colrow}}"

When I try to open the kicad_pcb file, I get this:
image

I can rescue the layer, but AFAICT it won't accept any layer, even if those layers exist in Kicad.

Unexpected `bind` behavior with `asym`

When creating an asymmetric split keyboard using mirror and asym: clone to skip a single column on the left side, then creating an outline with bound: true and where: true, we get an unexpected outline on the left side, seemingly binding a non-existing point to the next key.

Here is a test case for reference:

points:
  zones:
    matrix:
      columns:
        pinky.key:
          asym: clone
        ring:
      rows:
        home:
  mirror:
    ref: matrix_ring_home
    distance: 40
outlines:
  _keycaps:
    - what: rectangle
      where: true
      size: 18
      fillet: 1
  test:
    - what: rectangle
      where: true
      bound: true
      size: u
    - what: circle
      where: true
      radius: 1.5
      operation: stack
    - what: outline
      name: _keycaps
      operation: stack

And this is what the output looks like for the test outline:
Screenshot 2024-01-22 at 9 15 36 AM

However the expected result is this:
Screenshot 2024-01-22 at 9 17 29 AM

So it looks like Ergogen is trying to bind the matrix_ring_home key to the non-existing matrix_pinky_home one.

Source code for the 'unofficial' (ergogen.cache.works) webUI

Since 4.0.0 introduced a lot of breaking changes a lot of older configurations are not working anymore. For example the Atreus (simplified) on https://ergogen.cache.works/.
Since the 'unofficial' webUI, aka the one used on https://ergogen.cache.works/ is very useful for development, it would be helpful to still use the old configs.
There are two solutions that come to mind:

  1. publicly host a version that accepts the old configs
  2. get access to the source code (https://ergogen.cache.works) to host it locally

[feature] Import footprints from URLs

Goals:

  • Allow the community to easily create and distribute footprints libraries
  • Would allow to integrate custom footprint libraries with the Web UI.

Proposal:
An import.footprints key, that accepts a list of URL.
If the URL is a file, import the file content. If the URL is a directory, import all files from the directory and subdirectories.

Extend changes order of yaml

I noticed a problem with the extend preprocessor function. It moves the extended yaml objects to the top of the yaml section.

For example:

settings:
  preset_points:
    $extends: presets.kim.points

presets:
  kim:
    points:
      edge_thumb_cluster_top.anchor.shift: [10, 10]

units:


points:
  zones:
    $extends: settings.preset_points
    #
    # Thumb Cluster
    #
    thumbs:
      anchor:
        shift: [100, -100]
      columns:
        inner:
            key:
              column_net: C5
      rows:
        cluster:
          row_net: R4
    #
    # Helper Points
    #
    edge_thumb_cluster_top:
      anchor:
        ref: thumbs_inner_cluster
        shift: [0, 0]
      key:
        name: edge_thumb_cluster_top

If you run ergogen against it, you will get the following error:

❯ ergogen ./debug -o ./debug/output -d
Ergogen v4.0.4 CLI (Debug Mode)

Analyzing folder...
Interpreting format: YAML
Preprocessing input...
Calculating variables...
Parsing points...
Error: Unknown point reference "thumbs_inner_cluster" in anchor "points.zones.edge_thumb_cluster_top.anchor"!
    at exports.assert (/opt/homebrew/lib/node_modules/ergogen/src/assert.js:12:15)
    at /opt/homebrew/lib/node_modules/ergogen/src/anchor.js:69:15
    at exports.parse (/opt/homebrew/lib/node_modules/ergogen/src/points.js:294:103)
    at Object.process (/opt/homebrew/lib/node_modules/ergogen/src/ergogen.js:55:31)
    at /opt/homebrew/lib/node_modules/ergogen/src/cli.js:127:29

You can output the preprocessed config by adding the following lines to ergogen.js:

At the top:

const yaml = require('js-yaml')

And around line 31:

    if (debug) {
        logger(`After preprocess: ${yaml.safeDump(results.canonical)}`)
    }

You will see:

  preset_points:
    edge_thumb_cluster_top:
      anchor:
        shift:
          - 10
          - 10
presets:
  kim:
    points:
      edge_thumb_cluster_top:
        anchor:
          shift:
            - 10
            - 10
units: null
points:
  zones:
    edge_thumb_cluster_top:
      anchor:
        shift:
          - 0
          - 0
        ref: thumbs_inner_cluster
      key:
        name: edge_thumb_cluster_top
    thumbs:
      anchor:
        shift:
          - 100
          - -100
      columns:
        inner:
          key:
            column_net: C5
      rows:
        cluster:
          row_net: R4

As you can see the edge_thumb_cluster_top section was moved to the top and that's causing the error.

RGB LEDs should be mirrored on the B side of PCB

Hi,
I've been making my keyboard, which has one flippable PCB for both sides, with RGB LED backlight and when it came to soldering I've noticed that pins for the LED's on the back side of the PCB's are incorrect.

I've been using my custom LED footprint print of SK6812 Mini 3535 but took and inspiration from RGB LED from this repo.

Did I've done something wrong or should it be mirrored if it's on the back side of the PCB?

Add the ability to load outlines from a library

Pretty much like footprints, add the ability to bundle or load outlines from a library.

This is particularly useful when having to deal with mechanical footprints, like the shape of hotswap sockets, to cut from acrylic plates or 3D printed cases.

Upgrade to KiCad 7 format

Now that KiCad 7 has been around for a while, it would be nice for Ergogen to generate *.kicad_pcb files using the latest version, to allow for KiCad 7 footprint features.

keys outline generation inconsistency

Description

I'm trying to use outlines.exports with type keys and I am experiencing non-generating lines or lines generating incorrectly.

Replication

Here is a YAML sample:

units:
  angle: 1
  keysize: 19.05
  
points:
  zones:
    a:
      columns:
        one:
      rows:
        one:
        two:
        three:
        four:
      rotate: angle
outlines:
  exports:
    key_outline:
      main:
        type: keys
        side: left
        size: keysize

Edit the units.angle to 2 and it will render properly. In my testing, I can only replicate in specific sizes of units.keysize which affects outlines.exports.key_outline.main.size. Various decimal values completely alters the result.

Replicated on both ergogen.xyz and ergogen.cache.works just in case one was a different build than the other. I have not tried local replication via CLI.

Solution

I am unaware of one. I do not know exactly which module is causing this. Using 19mm for now to avoid the issue.

Error: Cannot find module 'fs-extra'

I'm trying to run the CLI by following these instructions:

Command line usage requires node v14.4.0+ with npm v6.14.5+ to be installed, the repo to be checked out, and then simply calling the CLI interface through node src/cli.js.

Here is what happens:

> git rev-parse HEAD
f4835e53151ce1a69a7b2c5d08bd6d7b3e60258c
> node --version
v14.5.0
> npm --version
6.14.5
> node src/cli.js
internal/modules/cjs/loader.js:1033
  throw err;
  ^

Error: Cannot find module 'fs-extra'
Require stack:
- /Users/tombrow/Documents/ergogen/src/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1030:15)
    at Function.Module._load (internal/modules/cjs/loader.js:899:27)
    at Module.require (internal/modules/cjs/loader.js:1090:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at Object.<anonymous> (/Users/tombrow/Documents/ergogen/src/cli.js:5:12)
    at Module._compile (internal/modules/cjs/loader.js:1201:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
    at Module.load (internal/modules/cjs/loader.js:1050:32)
    at Function.Module._load (internal/modules/cjs/loader.js:938:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/tombrow/Documents/ergogen/src/cli.js' ]
}

where-Negation behaves like where: True

Negation using e.g. where: -/pinky/ does currently behave like where: True.

Seems to be unrelated to what actually is negated: tags, bool values, regex; all end up as True.

    regex:
      - what: circle
        where: -/pinky/
        radius: 5
        operation: stack
      - what: circle
        where: /pinky/
        radius: 7
        operation: stack

Should result in just the bigger circles around the pinky, and smaller circles around every other point, but actually results in
image

Complete Example YAML showing the Issue
points:
  zones:
    matrix:
      columns:
        pinky:
        ring.key.stagger: 3
        middle.key.stagger: 5
        index.key.stagger: -5
        inner.key.stagger: -6
        thumb:
          key.stagger: 10
          rows:
            bottom: $unset
            top: $unset
            num: $unset
      rows:
        bottom.tags: aTag
        home:
        top:
        num:
  rotate: -10
  mirror:
    ref: matrix_thumb_home
    distance: 22
outlines:
    tagged:
      - what: rectangle
        where: aTag
        size: 14
      - what: rectangle
        where: -aTag
        size: 10
        operation: stack
    regex:
      - what: circle
        where: -/pinky/
        radius: 5
        operation: stack
      - what: circle
        where: /pinky/
        radius: 7
        operation: stack
    true:
      - what: circle
        where: True
        radius: 5
        operation: stack
      - what: circle
        where: -True
        radius: 7
        operation: stack

Add concat to the preprocessor

What do you think of the idea to add concat to the ergogen preprocessor.

Perhaps something like this...

meta:
  engine: 4.0.4
  name: 'ThinkCorney'
  version: v1-b1
  author: "@infused-kim"
  name_full: $ergogen_concat(meta.name, ' - ', meta.version)

Which would result in ThinkCorney - v1-b1.

Just a few thoughts

Hi there,

This is really a cool project! Lots of features are fascinating!

Coincidentally, I was doing the same thing in the last one year. A different route to help DIYers to create keyboard automatically.

Fs3OgazzkX_0pOJIU2d6VjTGS1fr

You may take a look at:
https://nine-fox.com/diy

While a simple guide locates:
https://nine-fox.com/docs/diy/#/quickstart

screenshots (Chinese page although):
https://www.zfrontier.com/app/flow/9zQGMWLLkVg8

So this is my different approach and my thoughts are as follows you may take consideration if you like.

  1. KiCAD vs JLCPCB

I was thinking to generate the whole sch and pcb using KICAD, however, the main drawback is, it needs lots professional skills and also needs to download and install it from website(what a big package!). And, there is no great support for SMT directly even with skills.

To me, I didn't like handsoldering, and searching every pieces of components from taobao or market. That's really annoying and cost lots time. So I moved to gen PCB under JLCPCB(https://lceda.cn, https://jlcpcb.com/easyeda). Currently, I can gen rectangle keys(probably support custom rotation in the future).

  1. 2D vs 3D

With the help of https://github.com/zalo/CascadeStudio, opencascade wasm can generate the everthing in 3d format(glb and STEP). While Glb can be used for 3d printing, however, to me, I think the most importance is to generate STEP while CNC is supported. That would be a great help for opening group buy. I would suggest to support it. There.js's open source editor would help.

  1. Realistic rendering

I would strongly suggest to support 3d realistic rendering. That's a quite great feature to view the best result.
截屏图片3

While keycap can be generated, its not difficult to render online with webgl. There are lots of open sourced projects(https://github.com/topics/path-tracing). You may take a look at the rendering screenshot my website at:
https://www.zfrontier.com/app/flow/9zQGMWLLkVg8

By the way, if you want to download the whole zip, you may reach me to get the free code. Any thoughts are welcomed.

98a7875a21dc

That's download code today.

bug: tests no longer work on Windows

None of the tests run on Windows anymore, I think this is due to updating the glob version and this.
I'll have a look through the code and see if I can find an easy fix.

Setting switch footprint hotswap param to `true` reverses the order of its pins

I was updating my board from soldered choc switches to hotswap-able choc switches and noticed that when setting the hotswap param to true, the pins of the switch also reversed.

Here is a quick minimal example i made on https://ergogen.cache.works/ using mx switches

points:
  zones:
    matrix:
pcbs:
  board:
    footprints:
      keys:
        what: mx
        params:
          from: GND
          to: VCC
          hotswap: true

Changing hotswap to either true or false will result in the VCC and GND labels switching places.

I believe the issue can be found on these lines, but I am not too familiar with the footprint datasheets so i am opening up this issue

if(p.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 */}
(pad 1 smd rect (at ${def_neg}3.275 -5.95 ${p.r}) (size 2.6 2.6) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask) ${p.from})
(pad 2 smd rect (at ${def_pos}8.275 -3.75 ${p.r}) (size 2.6 2.6) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask) ${p.to})
`
} else {
return `
${''/* pins */}
(pad 1 thru_hole circle (at ${def_pos}5 -3.8) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.from})
(pad 2 thru_hole circle (at ${def_pos}0 -5.9) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.to})
`
}
}

TypeError: Cannot read property '0' of null

I encounter this error when I set my glue's top.right.rotate equal to points.rotate and top.left.rotate equal to the negation of that.

> git rev-parse HEAD
8f416d7e0d1e39a4b832cebc0ddcd024d460fb38
> node src/cli.js -c jklp.yaml -o jklp --debug
Parsing points...
Generating outlines...
/Users/tombrow/Documents/ergogen/src/utils.js:6
    return a[0] === b[0] && a[1] === b[1]
                     ^

TypeError: Cannot read property '0' of null
    at Object.exports.eq (/Users/tombrow/Documents/ergogen/src/utils.js:6:22)
    at /Users/tombrow/Documents/ergogen/src/outlines.js:155:27
    at Object.exports.parse (/Users/tombrow/Documents/ergogen/src/outlines.js:238:27)
    at Object.<anonymous> (/Users/tombrow/Documents/ergogen/src/cli.js:79:31)
    at Module._compile (internal/modules/cjs/loader.js:1201:30)

The error does not occur if top.right.rotate differs from points.rotate or from negative top.left.rotate.

Example Config?

It would be really awesome if there could be an example configuration somewhere in the repository to view what the results would roughly look like. You could then work from there and work on your own design and lean on the docs to add whatever you need from there.

Overall though, this is really cool!

Use a 2u key

It's possible to set a single key to 2u? I want to make something like the corne, that has a 2u key as the outer thumb key, but I didn't find how to do that.

Thanks for developing this awesome program!

meta.author renders pcb to unquoted title.company

If you add a meta.author field with spaces, it's rendered like (company firstname lastname)

This is a syntax error in kicad (tested on 8). This should be quoted e.g. (company "firstname lastname").

Repro:

# https://ergogen.cache.works/
meta:
  version: 0.1.0
  author: test test
points:
  key:
  zones:
    dummy:
outlines:
  board:
    - what: rectangle

pcbs:
  keyboard:
    outlines:
      main:
        outline: board

Documentation for 4.0

As there is some breaking changes in v4, especially around outlines (and probably the other advanced topics, too, I got stuck on outlines), the documentation about that is even more confusing. Since most examples out there are using earlier versions the tip about searching for #ergogen is also not very helpful.

I think a first big help would be to have at least one complete example with outlines, pcb, etc. using the new syntax.

I dug around in the tests and found a completely new list of keywords (what, where, ... ) which isn't mentioned in the docs. Using those I managed to make a circle and a rectangle, but no success with creating a plate ;-)

Keys outline generation failure

Description

If the size and corner values are such that the corners would generate a perfect circle, downloaded DXF only contains dot data despite clearly correct rendered view.

How it looks on ergogen.cache.works:

image

How it looks in DWG TrueView:

image

Replication

Use this outline export:

outlines:
  exports:
    keys:
      main:
        type: keys
        side: left
        size: u*0.47
        corner: (u*0.47)/2

Workaround

Make the corner just slightly smaller:

outlines:
  exports:
    keys:
      main:
        type: keys
        side: left
        size: u*0.47
        corner: (u*0.46)/2

While I do not think this is intended use, it is very useful for very specific circumstances, such as for Topre and buckling spring. I am using this for instance to draw a DXF for foam padding outline for a Model F AT.

Error: Unexpected key "rotate" within field "..."

While attempting to build my layout, I came across an error and decided to try build the example Absolem and noticed that this also has the same error.

 .../ergogen > node src/cli.js test.yaml output-test
Ergogen v4.0.0-develop CLI

Interpreting format: YAML
Preprocessing input...
Calculating variables...
Parsing points...
Error: Unexpected key "rotate" within field "points.zones.matrix.columns.ring"!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.