You are browsing as a guest. Sign up (or log in) to start making projects!

5h 9m 12s logged

Final Devlog (build phase)

PCB soldering + Assembly

I’ve successfully soldered my PCB and assembled my parts using some 3d prints and the kit that arrived a while ago.
There was an issue with my design where 2 out of the 6 screws in my design ended up being redundant, but it still works as-is!


KMK fixes + added input display functionality

I tested the KMK code that I wrote earlier and due to several errors in the code, it didn’t work.

I refactored the code to fix the errors, and I also added additional functionality:

  1. Expanded the number of profiles (KMK layers) from 2 to 5
  2. Added modifier key-like functionality (e.g. Ctrl and Shift) using the said profiles
  3. Added a custom input display class for the OLED that logs the user’s keypresses and displays the following action!

Input display

The OLED screen features an input display that keylogs the user the key commands and combinations that they press.
Making it work was actually surprisingly hard. For one, KMK does not provide much built-in functionality to perform an action after a specific key is pressed. I decided to create my own custom class - OLEDManager - to manage the keyboard’s TextEntry’s. OLEDManager can be placed itself in the actual firmware loop of KMK by adding it to keyboard.modules - allowing it to activate after keys are pressed or after the matrix is scanned. However, this took a while for me to figure out - there was some boilerplate required that I only corrected after some trial and error.
Initially, the keylogging functionality didn’t work if multiple keys were pressed at once, as KMK did not store key press events in some sort of log. I made a workaround that tracked the keypresses by adding and removing them incrementally based on the keypress and keyrelease events. After that, I ran into the issue where some keys wouldn’t be logged at all, or would only show up on the display AFTER the keys were released. This took me a really long time to figure out, but any keys that aren’t associated with layer change keys (e.g. KC.MO and KC.TG) don’t prompt any KMK Display rerenders. I could not simply update the text property of the TextEntry objects, I had to actually force a rerender after every keypress in order for the logging functionality to perform as expected.

0
17

Comments 0

No comments yet. Be the first!