JanLunge / pog

A Kmk firmware flashing and configuration tool
https://pog.heaper.de/
MIT License
255 stars 17 forks source link

rowsPins/colPins not ignored in "direct" wiring mode. #14

Closed Gadgetoid closed 1 month ago

Gadgetoid commented 1 month ago

Hello, just watched the introductory YouTube video about this project and it sounds awesome.

I realise this is a very special and awkward case- but I tried to bring up our (Pimoroni) Keybow 2040 in pog, and ran into a few blockers, bugs and whatnot. I'm happy to try and raise PRs to address these but I'll probably take a while to grok the project before I can be useful.

I set up the board in matrix mode, forgetting that we had one key per pin. I switched back to direct wiring mode and now I'm ending up with the following in pog.json:

    "rowPins": [
        null,
        null,
        null,
        null
    ],
    "colPins": [
        null,
        null,
        null,
        null
    ],

This causes a crash with:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "code.py", line 3, in <module>
  File "pog.py", line 37, in <module>
  File "pog.py", line 28, in renderPin
TypeError: unsupported types for __add__: 'str', 'NoneType'

Since it tries to parse these arrays before checking the wiringMethod property.

I think there are a few bugs here:

  1. The UI would not let me continue unless I switched back into Matrix mode and added at least a 1x1 matrix
  2. Even with a 1x1 matrix I'm seeing a 4 null rows and 4 null column pins being added to pog.json
  3. pog.py should check config['wiringMethod'] first and ignore rowPins and colPins if it's "direct".

Another bug, in code.py there's a code path which runs the keyboard in coordmaphelper mode:

    from coordmaphelper import KMKKeyboard
    if __name__ == '__main__':
        KMKKeyboard().go()

If this crashes/soft fails then there's no exit here, so it will continue to hit the line:

keyboard = KMKKeyboard(features=['basic', ...

Which then throws a fatal error because coordmaphelper.KMKKeyboard does not include a features kwarg.

Finally I am bitten by the VBUS_SENSE issue, but I see that's in hand!

Sorry this was a bit of a random hodge podge of findings!

JanLunge commented 1 month ago

yes these are all very valid issues I started a PR to address them though I'm not quite sure if I can reproduce the issue you had while in the initial setup and then going back steps.

Gadgetoid commented 1 month ago

I'll see if I can repro breaking it. I had switched my board back to MicroPython to play with USB stuff there, so I've got a clean slate again.

Another issue I had was with the layout editor- when I positioned my 16 keys into a 4x4 grid by manually setting the offsets, about half of them overflowed the parent element and were no longer selectable.

JanLunge commented 1 month ago

All this should now be fixed with the latest release 1.4.2

Gadgetoid commented 1 month ago

Thank you! On my todo list to give set up another shot!