qmk

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

commit 2038a515d9f6d137a34bd03e1294617e9091ec1e
parent b922a550dc166b1e790906e454ed65c58acfb76f
Author: mtei <2170248+mtei@users.noreply.github.com>
Date:   Mon, 26 Mar 2018 23:36:17 +0900

change rgblight_increase_val() and eeconfig_update_rgblight_default(), use RGBLIGHT_LIMIT_VAL insted of 255.

Diffstat:
quantum/rgblight.c | 16+++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/quantum/rgblight.c b/quantum/rgblight.c @@ -23,6 +23,10 @@ #include "debug.h" #include "led_tables.h" +#ifndef RGBLIGHT_LIMIT_VAL +#define RGBLIGHT_LIMIT_VAL 255 +#endif + __attribute__ ((weak)) const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; __attribute__ ((weak)) @@ -46,11 +50,9 @@ 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) { + 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; @@ -119,7 +121,7 @@ void eeconfig_update_rgblight_default(void) { rgblight_config.mode = 1; rgblight_config.hue = 0; rgblight_config.sat = 255; - rgblight_config.val = 255; + rgblight_config.val = RGBLIGHT_LIMIT_VAL; eeconfig_update_rgblight(rgblight_config.raw); } void eeconfig_debug_rgblight(void) { @@ -313,8 +315,8 @@ void rgblight_decrease_sat(void) { } void rgblight_increase_val(void) { uint8_t val; - if (rgblight_config.val + RGBLIGHT_VAL_STEP > 255) { - val = 255; + if (rgblight_config.val + RGBLIGHT_VAL_STEP > RGBLIGHT_LIMIT_VAL) { + val = RGBLIGHT_LIMIT_VAL; } else { val = rgblight_config.val + RGBLIGHT_VAL_STEP; }