Devlog #3: Coding the Advanced SolidWorks Firmware with QMK
This is devlog number three, and i unfortunately came to the code! This is the last for this project. Then i also want to say and recommend everyone to go to bed.
Finishing up the github repository at 3 am as im writing this isnt especially fun as i promissed some old friends from another country to meet up in 6 hours. So if you looking through commits, dont.
Since this pad uses a Direct Pin layout (every switch goes straight to its own pin and GND), QMK forced me to trick its system. It is built for huge keyboards with regular row/column grids, so I had to map my XIAO RP2040 pins into a “virtual” 4x2 rutenett grid in the info.json file, filling blank spaces with null tokens so the compiler wouldn’t crash.
The not fun and the biggest headache was writing the manual C-functions in keymap.c to handle my specific SolidWorks workflow:
-
The 0.1mm Problem: I originally wanted the knob to toggle down to a
0.1interval. But you remember quickly that QMK integer variables (uint8_t) doesnt work with decimals. If you pass0.1, it compresses to0and the wheel stops working. I just changed the interval to (1mm-10mm-25mm) -
The Blind Macro: Since a keyboard is “blind” and can’t read what’s on my screen, making the SW4_Round click function actually work required a clipboard loop. When you click the knob, it grabs whatever number you have highlighted (
Ctrl + AthenCtrl + X), types out=round(, pastes it back (Ctrl + V), and adds/10)*10to do the rounding math inside SolidWorks.