Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per key/layer RGB underglow for 24.12 #36

Open
wants to merge 12 commits into
base: zmk-update
Choose a base branch
from

Conversation

darknao
Copy link

@darknao darknao commented Dec 30, 2024

This adds per key / per layer RGB underglow configuration on top of 24.12.
It's mainly based on @valdur mod with additional changes to make it configurable via devicetree.

This supersedes #30.

It includes:

  • Valdur's RGB mod
  • Refactor, move configuration to devicetree, and some battery life optimization
  • feat(split): Increase split interval during idle #682 from ZMK upstream

How to use:
More instructions are available on my config repo.
TLDR: Add and customize this snippet to the Custom Device-tree field in the layout editor:

#include <dt-bindings/zmk/rgb_colors.h>
/ {
    underglow-layer {
        compatible  = "zmk,underglow-layer";

        // example of RGB layer for the Lower keymap layer
        lower {
            bindings = <
                ______ ______ ______ ______ ______                                                          ______ ______ ______ ______ ______
                PURPLE   PINK   PINK   PINK   PINK   PINK                                            ______   GOLD ORANGE ORANGE ORANGE    RED
                PURPLE ______ ______ ORANGE ______ ______                                            ______ YELLOW YELLOW YELLOW ORANGE ______
                PURPLE ______ ORANGE    RED ORANGE ______                                            ______ YELLOW YELLOW YELLOW ORANGE ______
                  BLUE ______    RED    RED    RED ______ ______ ______ ______  ______ ______ ______ ______ YELLOW YELLOW YELLOW    RED   BLUE
                ______ ______ ORANGE ORANGE ORANGE        ______  GREEN ______  ______ ______ ______        YELLOW YELLOW YELLOW    RED ______
                >;
            layer-id = <LAYER_Lower>;
        };

        // This defines another RGB layer
        another-layer {
            bindings = < [...] >;
            layer-id = <LAYER_Name>;
        };
    };
};

______ means the RGB is off. You can use predefined color name or RGB hex code like 0xFF0000 for red.
Full example on the Layout Editor here

To preserve battery life, I recommend enabling the ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE KConfig to automatically turn off underglow after ZMK_IDLE_TIMEOUT ms (default to 30 seconds).
From my limited experience, you can expect around one week of battery life with no RGB on the base layer.

darknao and others added 12 commits December 30, 2024 13:25
…zation

I tried using event instead of the 25ms underglow_tick to update the underglow on
layer change only. That didn't improve the battery life much....
The second change is cutting off the led strip power if the underglow is
not defined for a layer. Power is restored if a layer with rgb is
activated, and cut off as soon as the layer is disabled.
This, on the other hand, improves the battery life a lot, especially if you
don't use rgb on your base layer.
If you are using rgb on your base layer, setting
CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE is highly recommended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants