From 6c24e28b8db255b77b4945cd843a617ee5141678 Mon Sep 17 00:00:00 2001 From: YouCanFly Date: Wed, 3 Jan 2018 10:54:56 +0800 Subject: [PATCH] ADD RGBLIGHT_LIMIT_VAL (#2214) --- docs/feature_rgblight.md | 1 + quantum/rgblight.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md index 554eb2dc..f96fa877 100644 --- a/docs/feature_rgblight.md +++ b/docs/feature_rgblight.md @@ -41,6 +41,7 @@ You can change the behavior of the RGB Lighting by setting these configuration v | `RGBLIGHT_HUE_STEP` | 10 | How many hues you want to have available. | | `RGBLIGHT_SAT_STEP` | 17 | How many steps of saturation you'd like. | | `RGBLIGHT_VAL_STEP` | 17 | The number of levels of brightness you want. | +| `RGBLIGHT_LIMIT_VAL` | 255 | Limit the val of HSV to limit the maximum brightness simply. | ### Animations diff --git a/quantum/rgblight.c b/quantum/rgblight.c index ab218b8c..cc49cdf6 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -46,6 +46,12 @@ bool rgblight_timer_enabled = false; void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { uint8_t r = 0, g = 0, b = 0, base, color; + #ifdef RGBLIGHT_LIMIT_VAL + if (val > RGBLIGHT_LIMIT_VAL) { + val=RGBLIGHT_LIMIT_VAL; // limit the val + } + #endif + if (sat == 0) { // Acromatic color (gray). Hue doesn't mind. r = val; g = val;