summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormtei <2170248+mtei@users.noreply.github.com>2018-03-26 23:36:17 +0900
committerJack Humbert <jack.humb@gmail.com>2018-03-26 13:41:53 -0400
commit2038a515d9f6d137a34bd03e1294617e9091ec1e (patch)
tree9081dbd56334efb69211a6782b99e883d03ea307
parentb922a550dc166b1e790906e454ed65c58acfb76f (diff)
change rgblight_increase_val() and eeconfig_update_rgblight_default(), use RGBLIGHT_LIMIT_VAL insted of 255.
-rw-r--r--quantum/rgblight.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index cc49cdf636..ae18344081 100644
--- 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;
}