diff options
| author | mtei <2170248+mtei@users.noreply.github.com> | 2018-03-26 23:36:17 +0900 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2018-03-26 13:41:53 -0400 |
| commit | 2038a515d9f6d137a34bd03e1294617e9091ec1e (patch) | |
| tree | 9081dbd56334efb69211a6782b99e883d03ea307 /quantum/rgblight.c | |
| parent | b922a550dc166b1e790906e454ed65c58acfb76f (diff) | |
| download | qmk_firmware-2038a515d9f6d137a34bd03e1294617e9091ec1e.tar.gz qmk_firmware-2038a515d9f6d137a34bd03e1294617e9091ec1e.zip | |
change rgblight_increase_val() and eeconfig_update_rgblight_default(), use RGBLIGHT_LIMIT_VAL insted of 255.
Diffstat (limited to 'quantum/rgblight.c')
| -rw-r--r-- | quantum/rgblight.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index cc49cdf63..ae1834408 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c | |||
| @@ -23,6 +23,10 @@ | |||
| 23 | #include "debug.h" | 23 | #include "debug.h" |
| 24 | #include "led_tables.h" | 24 | #include "led_tables.h" |
| 25 | 25 | ||
| 26 | #ifndef RGBLIGHT_LIMIT_VAL | ||
| 27 | #define RGBLIGHT_LIMIT_VAL 255 | ||
| 28 | #endif | ||
| 29 | |||
| 26 | __attribute__ ((weak)) | 30 | __attribute__ ((weak)) |
| 27 | const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; | 31 | const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; |
| 28 | __attribute__ ((weak)) | 32 | __attribute__ ((weak)) |
| @@ -46,11 +50,9 @@ bool rgblight_timer_enabled = false; | |||
| 46 | void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { | 50 | void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { |
| 47 | uint8_t r = 0, g = 0, b = 0, base, color; | 51 | uint8_t r = 0, g = 0, b = 0, base, color; |
| 48 | 52 | ||
| 49 | #ifdef RGBLIGHT_LIMIT_VAL | 53 | if (val > RGBLIGHT_LIMIT_VAL) { |
| 50 | if (val > RGBLIGHT_LIMIT_VAL) { | ||
| 51 | val=RGBLIGHT_LIMIT_VAL; // limit the val | 54 | val=RGBLIGHT_LIMIT_VAL; // limit the val |
| 52 | } | 55 | } |
| 53 | #endif | ||
| 54 | 56 | ||
| 55 | if (sat == 0) { // Acromatic color (gray). Hue doesn't mind. | 57 | if (sat == 0) { // Acromatic color (gray). Hue doesn't mind. |
| 56 | r = val; | 58 | r = val; |
| @@ -119,7 +121,7 @@ void eeconfig_update_rgblight_default(void) { | |||
| 119 | rgblight_config.mode = 1; | 121 | rgblight_config.mode = 1; |
| 120 | rgblight_config.hue = 0; | 122 | rgblight_config.hue = 0; |
| 121 | rgblight_config.sat = 255; | 123 | rgblight_config.sat = 255; |
| 122 | rgblight_config.val = 255; | 124 | rgblight_config.val = RGBLIGHT_LIMIT_VAL; |
| 123 | eeconfig_update_rgblight(rgblight_config.raw); | 125 | eeconfig_update_rgblight(rgblight_config.raw); |
| 124 | } | 126 | } |
| 125 | void eeconfig_debug_rgblight(void) { | 127 | void eeconfig_debug_rgblight(void) { |
| @@ -313,8 +315,8 @@ void rgblight_decrease_sat(void) { | |||
| 313 | } | 315 | } |
| 314 | void rgblight_increase_val(void) { | 316 | void rgblight_increase_val(void) { |
| 315 | uint8_t val; | 317 | uint8_t val; |
| 316 | if (rgblight_config.val + RGBLIGHT_VAL_STEP > 255) { | 318 | if (rgblight_config.val + RGBLIGHT_VAL_STEP > RGBLIGHT_LIMIT_VAL) { |
| 317 | val = 255; | 319 | val = RGBLIGHT_LIMIT_VAL; |
| 318 | } else { | 320 | } else { |
| 319 | val = rgblight_config.val + RGBLIGHT_VAL_STEP; | 321 | val = rgblight_config.val + RGBLIGHT_VAL_STEP; |
| 320 | } | 322 | } |
