summaryrefslogtreecommitdiffstats
path: root/keyboards/mxss/rgblight.c
diff options
context:
space:
mode:
authorMxBlu <mundekkat@hotmail.com>2018-07-08 13:50:55 +0200
committerDrashna Jaelre <drashna@live.com>2018-07-08 13:50:55 +0200
commitf28f5696005bdc51b9d1ff3a59c70bf47b8b897a (patch)
tree1282eb95e35484c98b3d117b1dc1e0771962a22c /keyboards/mxss/rgblight.c
parentebe4c3dbbe257b7be2146950ad57d753140e02a7 (diff)
downloadqmk_firmware-f28f5696005bdc51b9d1ff3a59c70bf47b8b897a.tar.gz
qmk_firmware-f28f5696005bdc51b9d1ff3a59c70bf47b8b897a.tar.xz
Fixed issues with MxSS RGB functionality (#3341)
* Added basic MxSS support * Fixed split RSHFT for ISO layouts * Updated readme.md for MxSS * Added initial support for individual control of front RGB LEDs * Changed RGBLED color selection to work using hue and saturation rather than RGB Added code for LED state change on layer change * Avoid needing an entire 8 bits to store the brightness value * Added custom keycodes, along with their handlers * Added EEPROM storage for front LED config * Fixed up ability to use QMK Configurator and updated readme.md * Applied suggested changes from pull request: https://github.com/standard/standard/issues/452 Updated name in license descriptions Updated layouts to snake case Corrected mistakes in info.json Updated layer_colors to a weak attributed array in mxss.c * Defined a new safe range for custom keycodes in keymap.c * Fixed up issues with front LED Fixed LEDs not always updating in indicator mode Added support for the other RGBLIGHT modes in RGB mode * Attempted fix for ISO layouts for QMK configurator
Diffstat (limited to 'keyboards/mxss/rgblight.c')
-rw-r--r--keyboards/mxss/rgblight.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/keyboards/mxss/rgblight.c b/keyboards/mxss/rgblight.c
index f65d23c8c..da7959c6a 100644
--- a/keyboards/mxss/rgblight.c
+++ b/keyboards/mxss/rgblight.c
@@ -428,6 +428,8 @@ void rgblight_sethsv_noeeprom_old(uint16_t hue, uint8_t sat, uint8_t val) {
if (rgblight_config.enable) {
LED_TYPE tmp_led;
sethsv(hue, sat, val, &tmp_led);
+ fled_hs[0].hue = fled_hs[1].hue = hue;
+ fled_hs[0].sat = fled_hs[1].sat = sat;
// dprintf("rgblight set hue [MEMORY]: %u,%u,%u\n", inmem_config.hue, inmem_config.sat, inmem_config.val);
rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b);
}
@@ -439,6 +441,10 @@ void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool
// same static color
LED_TYPE tmp_led;
sethsv(hue, sat, val, &tmp_led);
+
+ fled_hs[0].hue = fled_hs[1].hue = hue;
+ fled_hs[0].sat = fled_hs[1].sat = sat;
+
rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b);
} else {
// all LEDs in same color
@@ -545,8 +551,15 @@ void rgblight_set(void) {
break;
case FLED_RGB:
- sethsv(fled_hs[0].hue, fled_hs[0].sat, fled_val, &led[RGBLIGHT_FLED1]);
- sethsv(fled_hs[1].hue, fled_hs[1].sat, fled_val, &led[RGBLIGHT_FLED2]);
+ if (fled_hs[0].hue == 0 && fled_hs[0].hue == 0 && (rgblight_config.mode >= 15 && rgblight_config.mode <= 23))
+ setrgb(0, 0, 0, &led[RGBLIGHT_FLED1]);
+ else
+ sethsv(fled_hs[0].hue, fled_hs[0].sat, fled_val, &led[RGBLIGHT_FLED1]);
+
+ if (fled_hs[1].hue == 0 && fled_hs[1].hue == 0 && (rgblight_config.mode >= 15 && rgblight_config.mode <= 23))
+ setrgb(0, 0, 0, &led[RGBLIGHT_FLED2]);
+ else
+ sethsv(fled_hs[1].hue, fled_hs[1].sat, fled_val, &led[RGBLIGHT_FLED2]);
break;
default:
@@ -690,10 +703,15 @@ void rgblight_effect_snake(uint8_t interval) {
return;
}
last_timer = timer_read();
+
+ fled_hs[0].hue = fled_hs[1].hue = 0;
+ fled_hs[0].sat = fled_hs[1].sat = 0;
+
for (i = 0; i < RGBLED_NUM; i++) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
+
for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) {
k = pos + j * increment;
if (k < 0) {
@@ -740,6 +758,11 @@ void rgblight_effect_knight(uint8_t interval) {
if (i >= low_bound && i <= high_bound) {
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[cur]);
} else {
+ if (i == RGBLIGHT_FLED1 || i == RGBLIGHT_FLED2) {
+ fled_hs[0].hue = fled_hs[1].hue = 0;
+ fled_hs[0].sat = fled_hs[1].sat = 0;
+ }
+
led[cur].r = 0;
led[cur].g = 0;
led[cur].b = 0;