Fixing GMMK pro’s rotary knob after flashing firmware with QMK

I'Boss Potiwarakorn
3 min readNov 4, 2021

--

After flashing firmware on GMMK pro for key mapping using binary produced from QMK Configurator, one might find rotary knob no longer works.

The reason being, the configurator does not have the functionality to handle rotary encoder. We need to build the firmware ourselves.

disclaimer: I am on macbook m1, so I used docker for the job since installing qmk cli locally does not work for me. If you want to thread down the path of installing the cli locally, please check this out.

Environment Setup

You need git and docker installed. If you are a software engineer, you probably already familiar with them, if you are not you need terminal console in order to interact with the following content.

Mac has default Terminal app,

On windows, this could get tricky. Using Linux Subsystem might be the best bet IMHO but I haven’t tested it myself.

For Linux users, I think you know what to do…

Getting Started

  1. Let’s clone the qmk firmware repository and change directory into it.
git clone --recurse-submodules https://github.com/qmk/qmk_firmware.git && cd qmk_firmware

2. Download your already configured keymap json file and move it into qmk_firmware directory mentioned above. By default, the file name would be gmmk_pro_ansi_layout_mine.json

3. On the same terminal console, current directory as qmk_firmware, create directory to store new keymap, you can name it however you like instead of my_keymap_name

mkdir -p keyboards/gmmk/pro/ansi/keymaps/my_keymap_name

4. Convert json to C code for further modification

docker run --rm -it \
-w /qmk_firmware \
-v "$(pwd)":/qmk_firmware qmkfm/qmk_cli \
qmk json2c -o keyboards/gmmk/pro/ansi/keymaps/my_keymap_name/keymap.c gmmk_pro_ansi_layout_mine.json

5. Open the C file with your text editor of choice, any plaintext editor would work (not Words or Pages but TextEdit or Notepads). I use VScode for syntax highlighting but you don’t need to. Then add the following lines at the bottom:

bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
return true;
}

5. Now you can run the following command to build the firmware, which will output the file in qmk_firmware directory. This will take awhile. (it’s the same process as what you click compile in the configurator)

util/docker_build.sh gmmk/pro/ansi:my_keymap_name

6. The first time you flash the firmware, stock reset combination on your keyboard is <Space> + B but after the first time, it is potentially changed. If you have no idea what did you remap the reset command to, it would by default be fn + \

TS;WM

By default, there is the modifier MO(1) down here to go to layer 1

And on layer 1

The RESET is here

7. Go to your QMK Toolbox and open the file gmmk_pro_ansi_my_keymap_name.bin in the qmk_firmware directory. Then unplug your gmmk pro, hold Fn + \, plug the cable back and then flash the firmware.

It is quite a wild ride since it gets very technical, but for me, I just learned about the existence of QMK and I see that there are a lot I can do with it. I can make rotary on different layer behaves differently, for example. And I might do a tutorial for that in the next post.

Have fun typing.

--

--

I'Boss Potiwarakorn

CTO @ █████; EX-ThoughtWorker; FP, Math, Stats, Blockchain & Human Enthusiast