set brighness in zmk_underglow_set_hsb as percentage
This commit is contained in:
parent
3b8c48a20f
commit
4ab2e7c0f4
1 changed files with 5 additions and 2 deletions
|
@ -341,11 +341,14 @@ int zmk_rgb_underglow_toggle() {
|
|||
}
|
||||
|
||||
int zmk_rgb_underglow_set_hsb(struct zmk_led_hsb color) {
|
||||
if (color.h > HUE_MAX || color.s > SAT_MAX || color.b < CONFIG_ZMK_RGB_UNDERGLOW_BRT_MIN ||
|
||||
color.b > CONFIG_ZMK_RGB_UNDERGLOW_BRT_MAX) {
|
||||
if (color.h > HUE_MAX || color.s > SAT_MAX || color.b > BRT_MAX) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
color.b =
|
||||
(uint8_t)((float)(CONFIG_ZMK_RGB_UNDERGLOW_BRT_MAX - CONFIG_ZMK_RGB_UNDERGLOW_BRT_MIN) *
|
||||
(float)color.b / 100.0F) +
|
||||
CONFIG_ZMK_RGB_UNDERGLOW_BRT_MIN;
|
||||
state.color = color;
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue