Num lock indicator

Hey guys, recently got my batch 1 FW16 and have been enjoying it so far. I haven’t had an issue with keyboard flex the way I thought I would and everything has been great so far.

The only thing that slightly annoys me is the lack of a num lock indicator on the numpad module. There’s an LED for caps lock so why not one for num lock? Also the numpad backlight is dimmer than the main keyboard backlight which is interesting.

To help remedy this problem I decided to learn QMK and edited the firmware for the numpad module so that the backlight turns on when you toggle numlock.

Took a little while to find the QMK keyboard files but I realized that they’re in another branch of the repository located here.

Anyways, to implement this just edit the end of the keymapping for the numpad I just added backlight_toggle()

bool led_update_user(led_t led_state) {
    // Change layer if numlock state changes, either triggered by OS or
    // by numlock key on this keyboard
    if (led_state.num_lock) {
        backlight_toggle();
        layer_off(_FN);
    } else {
        backlight_toggle();
        layer_on(_FN);
    }
    return true;
}

hopefully future iteration of the numpad gets a num lock indicator light :pray:

27 Likes

I think us getting an RGB keypad would be more likely than getting a dedicated Numlock led. But RGB would be fine, we could just set a color to the Numlock key to indicate it’s on.

4 Likes

Thank you!
I love this community. And this post is a shining example of why!
Lack of a numlock light would certainly have bothered the heck out of me when my Batch 17 arrived.
Here we have a problem (ok, minor annoyance) and a solution in one post.

If there isn’t an RGB num pad by the time batch 17 is built, I will certainly buy one when it becomes available.

Hey guys quick update I realize now that the backlight also has 3 brightness levels. I don’t know if I screwed up the firmware but the enter key doesn’t work and I plan to fix that.

3 Likes

Interestingly, this didn’t work for me as it didn’t always sync the numlock state across reboots. What I ended up with is slightly different solution.

In keymap.c I change function to the following (added lines marked with ###):

bool led_update_user(led_t led_state) {
    // Change layer if numlock state changes, either triggered by OS or
    // by numlock key on this keyboard
    if (led_state.num_lock) {
        layer_off(_FN);
        backlight_enable();   ###
    } else {
        layer_on(_FN);
        backlight_disable();   ###
    }
    return true;
}

In numpad.c I did the equivalent:

void keyboard_post_init_user(void) {
    // Sync initial numlock state from the host
    if (host_keyboard_led_state().num_lock) {
        layer_on(_NUMLOCK);
        backlight_enable();   ###
    } else {
        layer_off(_FN);
        backlight_disable();   ###
    }
}

Of couse, instead of setting backlight to 0, one can also set it to any value 0-3. I actually like backlight_set(1) for _FN layer and backlight_set(2) for _NUMLOCK.


[Edited to use backlight_enable/disable instead of set]

5 Likes

This is the same conclusion I reached as well. Quick question though does your numpad enter key work? Mine doesn’t actually work and is instead binded to the ./del key. I’m just curious if that happens for you too.

I had issues with it when I was working of framework16-keyboards branch. To solve it, I used v0.2.9 tag. It seems that this is a more up-to-date version of files.

I also got bored of pressing 2 and 6 while plugging in the numpad to get into boot mode. I adjusted the code to enter boot mode after holding Esc for 5 seconds. Fork is available on GitHub

1 Like

thanks man it appears I am using v0.2.2 firmware which i just noticed now.

Hey quick question the v0.2.9 firmware doesn’t compile for me

Hm… not sure, what error are you seeing (and what command are you using)?

using qmk compile -kb framework/numpad -km default

error i get is below

Compiling: keyboards/framework/matrix.c                                                            keyboards/framework/matrix.c: In function 'handle_idle':
keyboards/framework/matrix.c:293:13: error: implicit declaration of function 'backlight_enable_old_level' [-Werror=implicit-function-declaration]
  293 |             backlight_enable_old_level();
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors
 [ERRORS]
 |
 |
 |
make: *** [builddefs/common_rules.mk:373: .build/obj_framework_numpad_default/matrix.o] Error 1

commenting this out still gives me an error about OS_UEFI isn’t defined.
do you think this is potentially from me just putting the 0.2.9 keyboard folder into my existing qmk keyboard folder?

Probably, as changes between versions are also in QMK baseline files (quantum, etc). I would recommend you make a new clone of the repo and then checkout v0.2.9 to get into correct state.

ok i’ll do that tomorrow. thanks for the help

To get the 0.2.9 branch properly, do
git clone -b v0.2.9 --recurse-submodules https://github.com/FrameworkComputer/qmk_firmware.git

0.2.9 compiled without error for me. I just don’t have a FW16 to try flashing it to. I do have a spare RP2040 board, though. I’ve been meaning to check if I need to change anything to try it on my board. ~edit~ Flashed ok, and I could configure with Via at https://keyboard.frame.work

1 Like

this works! thank you

2 Likes

Does the numpad support per-key lighting? If so, it should be possible to simply switch off the light under the num-lock key if not active.

The current numpad doesn’t. Only the macropad has per-key.

I am using Linux Mint Cinnamon. There is an Applet you can install which shows an Indicator in the Taskbar for NumLock, CapsLock and ScrollLock.

2 Likes

The applet is shown below. I have used it for about 2 years.