Fix per-key RGB: correct pixel-lookup, chain-length, effect config

- pixel-lookup: column-by-column snake per foostan Corne v1.1 PCB diagram
- chain-length=27 in keymap (fork shield overlay overrides to 10)
- EFF_START=4 (layer indicators), ON_START=y, AUTO_OFF_IDLE=n
- Document per-key RGB in README with LED chain order and usage
This commit is contained in:
afiqzudinhadi 2026-06-26 00:11:45 +08:00
parent 8f25d48822
commit f1ba3dec58
3 changed files with 61 additions and 7 deletions

View file

@ -266,3 +266,45 @@ ZMK Studio is disabled by default in this config. To enable live keymap editing:
**Limitations:** Cannot add combos, custom behaviors, or change display/RGB config.
**Warning:** ZMK Studio saves changes to flash storage. These override the compiled keymap. If layers behave unexpectedly after flashing, do a [Settings Reset](#settings-reset).
# Per-Key RGB Layer Indicators
Uses [darknao's per-key RGB patches](https://github.com/darknao/zmk) cherry-picked onto ZMK v0.3.0 at [afiqzudinhadi/zmk@rgb-layer](https://github.com/afiqzudinhadi/zmk/tree/rgb-layer).
Effect #4 (Layer Indicators) shows different per-key colors based on active keymap layer. Colors are defined as hex RGB values in `corne.keymap` under the `underglow-layer` node.
### LED Chain Order (Foostan Corne v1.1)
Column-by-column snake, not row-by-row:
```
Chain 0-5: Underglow (6 LEDs)
Chain 6-9: Thumb outer → bottom/home/top col0
Chain 10-12: Top/home/bottom col1
Chain 13-14: Thumb mid → Thumb inner
Chain 15-17: Bottom/home/top col2
Chain 18-20: Top/home/bottom col3
Chain 21-23: Bottom/home/top col4
Chain 24-26: Top/home/bottom col5
```
### Changing Layer Colors
Edit `underglow-layer` bindings in `config/corne.keymap`. Each layer has 42 entries (one per key position):
```dts
carp_rgb {
layer-id = <0>;
bindings = <&ug GREEN &ug BLUE ...>; // 42 entries
};
```
Available colors (`dt-bindings/zmk/rgb_colors.h`): `GREEN` `RED` `BLUE` `TEAL` `ORANGE` `YELLOW` `GOLD` `PURPLE` `PINK` `WHITE` `___` (off)
Custom colors: `#define CYAN 0x00ffff` then `&ug CYAN`
### Notes
- **`chain-length = <27>`** must be set in `corne.keymap` — the fork's shield overlay defaults to 10.
- **Underglow LEDs** turn off on effect #4 (mapped to `255` in pixel-lookup). To give them layer colors, map to key positions instead of `255`.
- Brightness/hue/saturation controls don't affect layer indicator colors ([#1](https://github.com/afiqzudinhadi/zmk/issues/1), [#4](https://github.com/afiqzudinhadi/zmk/issues/4)).
- Custom RGB effects can be added in the [ZMK fork](https://github.com/afiqzudinhadi/zmk/tree/rgb-layer) (`app/src/rgb_underglow.c`).

View file

@ -72,12 +72,12 @@ CONFIG_ZMK_EXT_POWER=y
### RGB UNDERGLOW
CONFIG_ZMK_RGB_UNDERGLOW=y
CONFIG_ZMK_RGB_UNDERGLOW_ON_START=n
CONFIG_ZMK_RGB_UNDERGLOW_ON_START=y
CONFIG_WS2812_STRIP=y
# 0=Solid 1=Breathe 2=Spectrum 3=Swirl
CONFIG_ZMK_RGB_UNDERGLOW_EFF_START=3
CONFIG_ZMK_RGB_UNDERGLOW_EFF_START=4
CONFIG_ZMK_RGB_UNDERGLOW_BRT_STEP=1
CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE=y
CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE=n
CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=n
### PER-KEY RGB LAYER (darknao fork)

View file

@ -15,6 +15,10 @@
#include <dt-bindings/zmk/reset.h>
#include <dt-bindings/zmk/rgb_colors.h>
&led_strip {
chain-length = <27>;
};
/ {
behaviors {
ht_mute_pp: ht_mute_pp {
@ -81,12 +85,20 @@
*/
underglow-layer {
compatible = "zmk,underglow-layer";
/* Foostan Corne v1.1 LED chain (left half):
* Column-by-column snake with interleaved thumbs.
* chain 0-5: underglow (skip)
* chain 6-8: thumb0 bottom/home/top col0
* chain 9-12: top/home/bottom col1 thumb1 thumb2
* chain 13-17: bottom/home/top col2 top/home/bottom col3
* chain 18-22: bottom/home/top col4 top/home/bottom col5
*/
pixel-lookup = <
255 255 255 255 255 255
0 1 2 3 4 5
17 16 15 14 13 12
24 25 26 27 28 29
38 37 36
36 24 12 0 1 13
25 37 38 26 14 2
3 15 27 28 16 4
5 17 29
>;
carp_rgb {