aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYouCanFly <YCF@users.noreply.github.com>2018-01-03 10:54:56 +0800
committerJack Humbert <jack.humb@gmail.com>2018-01-02 21:54:56 -0500
commit6c24e28b8db255b77b4945cd843a617ee5141678 (patch)
tree5ee39631515136281c0da8130b427893ada6b55f
parentd19805f9de89a6200bc5d85f429cc3f18731b587 (diff)
downloadqmk_firmware-6c24e28b8db255b77b4945cd843a617ee5141678.tar.gz
qmk_firmware-6c24e28b8db255b77b4945cd843a617ee5141678.zip
ADD RGBLIGHT_LIMIT_VAL (#2214)
-rw-r--r--docs/feature_rgblight.md1
-rw-r--r--quantum/rgblight.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md
index 554eb2dcd..f96fa8773 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
41| `RGBLIGHT_HUE_STEP` | 10 | How many hues you want to have available. | 41| `RGBLIGHT_HUE_STEP` | 10 | How many hues you want to have available. |
42| `RGBLIGHT_SAT_STEP` | 17 | How many steps of saturation you'd like. | 42| `RGBLIGHT_SAT_STEP` | 17 | How many steps of saturation you'd like. |
43| `RGBLIGHT_VAL_STEP` | 17 | The number of levels of brightness you want. | 43| `RGBLIGHT_VAL_STEP` | 17 | The number of levels of brightness you want. |
44| `RGBLIGHT_LIMIT_VAL` | 255 | Limit the val of HSV to limit the maximum brightness simply. |
44 45
45### Animations 46### Animations
46 47
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index ab218b8c5..cc49cdf63 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -46,6 +46,12 @@ bool rgblight_timer_enabled = false;
46void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { 46void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) {
47 uint8_t r = 0, g = 0, b = 0, base, color; 47 uint8_t r = 0, g = 0, b = 0, base, color;
48 48
49 #ifdef RGBLIGHT_LIMIT_VAL
50 if (val > RGBLIGHT_LIMIT_VAL) {
51 val=RGBLIGHT_LIMIT_VAL; // limit the val
52 }
53 #endif
54
49 if (sat == 0) { // Acromatic color (gray). Hue doesn't mind. 55 if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
50 r = val; 56 r = val;
51 g = val; 57 g = val;