jeroen94704 / klepcbgen

Generates a KiCAD schematic and PCB layout using a Keyboard Layout Editor json file as input
Other
343 stars 42 forks source link

Key placement produced too many columns #10

Closed alex313962 closed 1 year ago

alex313962 commented 3 years ago

If i try to create a pcb for my design it gives an error and the script quit

jeroen94704 commented 3 years ago

The software is currently limited to generating a PCB for keyboard layouts with a maximum of 18 columns. Apparently the keyboard layout you used has more columns than that. If you think this is not correct, please share the json and I will take a look.

alex313962 commented 3 years ago

well, yes my design have more than 18 colums. http://www.keyboard-layout-editor.com/#/gists/643c06cd45f22283325e1aa89aaa87c5 i'm not good with py but i didn't understand why you have set a limit that low. My kb is, in fact, with 4 colums in surplus if compared with a standard 100% iso standard kb (that is also larger than 18 column i guess)

brianredbeard commented 3 years ago

Here's a more canonical example of a layout which is broken: the default 104 key layout from http://www.keyboard-layout-editor.com.

104_ansi_layout.json

Note: GitHub does now allow "attaching" JSON files (it blindly checks the file extension), thus this JSON file has .txt added to the filename.

jeroen94704 commented 3 years ago

The 18 column limit comes from the available number of inputs (25) on the atmega32u4. Detecting which key gets pressed requires grouping the keys in rows and columns. With 25 inputs, this means a theoretical maximum of 156 keys (12 or 13 rows with 13 or 12 columns), but wiring the keys of a rectangular keyboard layout into a square matrix would make the resulting schematic headache-inducing. So, as a compromise, I opted to reserve 7 input pins for rows and 18 for columns, resulting in the aforementioned limits.

Given that this limit seems to be problematic for many people I may try a square matrix anyway and see what happens.

phpbbireland commented 4 days ago

My layout 17 columns (6x17) and I get the same error? Also, could the max columns be included in the error report...

jeroen94704 commented 4 days ago

That's odd. Can you post the json file of the layout (giving it a .txt extension, as suggested by @brianredbeard)?

phpbbireland commented 4 days ago

Here you go keyboard_layout.txt Oops... one row has 18 column... but that should work? I best check the rest...

jeroen94704 commented 4 days ago

Yes, that should work, but there was an off-by-one bug in the code. I just pushed a fix for this, so you can re-download the code and try again.

phpbbireland commented 4 days ago

Many thanks, much appreciated... Up and running... ;)