Coder Social home page Coder Social logo

adamws / kicad-kbplacer Goto Github PK

View Code? Open in Web Editor NEW
299.0 6.0 23.0 13.33 MB

KiCad plugin for automatic keyboard's key placement and routing

License: GNU General Public License v3.0

Python 96.18% CSS 0.09% Dockerfile 2.40% PowerShell 0.23% Shell 1.10%
kicad mechanical-keyboard action-plugin pcbnew keyboard kicad-plugin

kicad-kbplacer's Introduction

kicad-kbplacer's People

Contributors

adamws avatar weblate 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

kicad-kbplacer's Issues

Placement of Hot Swap Sockets on the Back Side

Hi,

Thanks for creating this awesome plugin!

I'd love to place not normal keys, but Hot Swap Sockets, which would go on the backside of the PCB. The LEDs and Diodes need to be on the backside too. I have placed everything on the frontside, but when i flip the entire keyboard, it is mirrored.

What I would love, if there could be a feature to select if the keys go on the front or backside, instead of placing them on the frontside by default.

Cheers
Best
ijon

Save and reuse switch-diode connection templates

User should be able to save routed template of first switch-diode pair and reuse it.
I'm thinking about new button in main GUI dialog for Save switch-diode template which would create new kicad_pcb file with copy of switch/diode and it's tracks/vias and new option in Postion dropdown, for example From File. When From File selected, then instead of usual offset/orientation and side selectors, there should be file selector.

KeyPlacement not Following Column order

Describe the bug
Tried different layout export from Keyboard Layout Editor and it doesn't follow the column order

Additional context
Heres kbplacer.log
kbplacer.log

Screenshots
Screenshot_13
Screenshot_14
Screenshot_15
image

KiCad version info

Application: KiCad PCB Editor x64 on x64

Version: 7.0.7, release build

Libraries:
	wxWidgets 3.2.2
	FreeType 2.12.1
	HarfBuzz 6.0.0
	FontConfig 2.14.1
	libcurl/7.88.1-DEV Schannel zlib/1.2.13

Platform: Windows 10 (build 19045), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
	Date: Aug 14 2023 02:42:39
	wxWidgets: 3.2.2 (wchar_t,wx containers)
	Boost: 1.81.0
	OCC: 7.7.1
	Curl: 7.88.1-DEV
	ngspice: 40
	Compiler: Visual C++ 1936 without C++ ABI

Build settings:
	KICAD_SPICE=ON

Exception on python action plugin code

Hi,

trying to run the keyboard placer plugin but I'm getting this error.
Screenshot 2023-06-16 at 22 04 35

Here is the keyboard json, converted from KLE using one of the tools mentioned in the guide.
https://pastebin.com/s0VmUtqL

Kicad info

Application: KiCad PCB Editor arm64 on arm64

Version: 7.0.5-0, release build

Libraries:
	wxWidgets 3.2.2
	FreeType 2.12.1
	HarfBuzz 5.3.1
	FontConfig 2.14.0
	libcurl/7.88.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.51.0

Platform: macOS Ventura Version 13.4 (Build 22F66), 64 bit, Little endian, wxMac

Build Info:
	Date: May 26 2023 08:14:40
	wxWidgets: 3.2.2 (wchar_t,wx containers)
	Boost: 1.80.0
	OCC: 7.6.3
	Curl: 7.77.0
	ngspice: 38
	Compiler: Clang 13.0.0 with C++ ABI 1002

Build settings:
	KICAD_SPICE=ON

Does not start with pre-relase builds

Describe the bug
Plugin release v0.8 does not work with KiCad release candidate due to failing KiCad version parsing:

from .board_modifier import (
  File "/home/aws/.local/share/kicad/8.0/3rdparty/plugins/com_github_adamws_kicad-kbplacer/board_modifier.py", line 14, in <module>
    KICAD_VERSION = tuple(
                    ^^^^^^
ValueError: invalid literal for int() with base 10: '0~rc1'

KiCad version info

Application: KiCad PCB Editor x86_64 on x86_64

Version: 8.0.0-rc1-67-g7b24167398-dirty, release build

Libraries:
	wxWidgets 3.2.4
	FreeType 2.13.2
	HarfBuzz 8.3.0
	FontConfig 2.15.0
	libcurl/8.5.0 OpenSSL/3.2.0 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh2/1.11.0 nghttp2/1.58.0

Platform: Arch Linux, 64 bit, Little endian, wxGTK, X11, , tty

Build Info:
	Date: Jan 18 2024 11:44:15
	wxWidgets: 3.2.4 (wchar_t,wx containers) GTK+ 3.24
	Boost: 1.83.0
	OCC: 7.7.2
	Curl: 8.5.0
	ngspice: 42
	Compiler: GCC 13.2.1 with C++ ABI 1018

Build settings:
	KICAD_USE_EGL=ON

GUI state tests fail randomly

Some of the tests, for example test_gui_state_restore are flaky and fail on circleci randomly, with errors like this:

tmpdir = local('/tmp/pytest-of-root/pytest-0/test_gui_state_restore_no_addi0')
screen_manager = <tests.test_gui.LinuxVirtualScreenManager object at 0x7faae1481410>
window_name = 'kbplacer'
gui_callback = <function test_gui_state_restore.<locals>._callback at 0x7faae147a7a0>

    def run_gui_test(tmpdir, screen_manager, window_name, gui_callback) -> None:
        is_ok = True
        # for some reason, it occasionally may fail with
        # 'wxEntryStart failed, unable to initialize wxWidgets!' error, most likely
        # this is not related with plugin's code - try to get screenshot 3 times
        # to limit false positives
        max_attempts = 3
        for i in range(0, max_attempts):
            with screen_manager as mgr:
                p = gui_callback()
                is_ok = mgr.screenshot(window_name, f"{tmpdir}/screenshot.png")
                try:
                    outs, errs = p.communicate("q\n", timeout=1)
                except subprocess.TimeoutExpired:
                    p.kill()
                    outs, errs = p.communicate()
    
                assert outs == "Press any key to exit: "
>               assert errs == ""
E               AssertionError: assert 'double free ...ion (!prev)\n' == ''
E                 + double free or corruption (!prev)

tests/test_gui.py:224: AssertionError

This can be reproduced when running tests in docker container (just like circleci does it).
Most likely this is the problem with tests because no problems has been observed when running this directly on host.

Unexpected behavior: diode "relative" place method rotates diodes

Describe the bug
What it says in the title. When I use diode autoplacement relatively to the first switch-diode pair, all switches are rotated to a certain degree. I expect that diodes should remain square to switches in this case. Plugin does not crash though.

Additional context
I observe this behavior on switches which are not square to the PCB drawing. I assume it is connected to the layout I am building?

Screenshots
First I was like
Plugin window
But then
diode_bug.zip

KiCad version info

Application: KiCad PCB Editor x86_64 on x86_64

Version: 7.0.9-7.0.9~ubuntu22.04.1, release build

Libraries:
	wxWidgets 3.2.1
	FreeType 2.11.1
	HarfBuzz 6.0.0
	FontConfig 2.13.1
	libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.16

Platform: Ubuntu 22.04.3 LTS, 64 bit, Little endian, wxGTK, ubuntu, x11

Build Info:
	Date: Nov  8 2023 19:01:25
	wxWidgets: 3.2.1 (wchar_t,wx containers) GTK+ 3.24
	Boost: 1.74.0
	OCC: 7.5.2
	Curl: 7.88.1
	ngspice: 38
	Compiler: GCC 11.4.0 with C++ ABI 1016

Build settings:
	KICAD_SPICE=ON

Deprecated python list calls

Python 3.8.10 Kicad Version: 7.0.2-6a45011f42172ubuntu20.04.1, release build

The version of the plugin that can be downloaded from the plugin editor will not run by default as the list[item] calls used in board_modifier.py and key_placer.py are deprecated, causing an error and the plugin to fail to import. A solution was add from __future__ import annotations at the beginning of both of these files and then the plugin shows up on the toolbar and in the external plugins menu

My own version of the placer

Just thought I'd mention and bring light to my take on this plugin here.

It removes the need for a kle-serial compatible json. It has it's own serializer/deserializer code. There's also some stuff which lets you customize rotations, do multi-layout, support more complicated layouts with rotation, and also specify diode location.

Disclaimer, I did use a lot of the logic from this project while I was making it (yours wasn't updated to V6 at the time).

(If this interests you, I also have this, which is where the serialization code first came from)

Routing not working with latest KiCad 7.0.7 release

โš ๏ธ To anyone using release v0.5 with KiCad 7.0.7 - routing is not working due to KiCad's API change. Do not use Route tracks option. It does work with 7.0.6.

        for track in self.board.GetTracks():
>           if connectivity.TestTrackEndpointDangling(track):
E           TypeError: CONNECTIVITY_DATA.TestTrackEndpointDangling() missing 1 required positional argument: 'aIgnoreTracksInPads'

Can't get plugin to work

Hi,

I'm trying to use the plugin but i can't get it to work, it just shows the following stack trace:

image

I've tried it both on Windows (Kicad 7.0) and on Linux (Kicad 7 and Kicad 6).
This happens on both the example files and my own json files converted with https://adamws.github.io/kle-serial/ as the instructions say. Do you know what I might be doing wrong?

Split `Route tracks` option to `Route switch-diode pairs` and `Route matrix`

Main router use case is routing diodes with switches (which is often repeatable because diodes are usually at fixed position in relation to corresponding switch). Having columns/rows routing is byproduct of that feature and it works 'ok' only for simple layouts (ortholinear, simple staggered) but falls short for complex 'ergo' ones with lots of rotations etc.
Let the user choose which types of routing shall be run. This is already pretty well separated in placer class, need to update GUI and CLI interfaces.
Route switch-diode-pairs should be located in Switch diodes settings section, Route matrix should remain in Other settings.

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.