Quellcode durchsuchen

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
MxBlu vor 7 Jahren
Ursprung
Commit
f28f569600
3 geänderte Dateien mit 35 neuen und 8 gelöschten Zeilen
  1. 6 6
      keyboards/mxss/info.json
  2. 4 0
      keyboards/mxss/mxss.c
  3. 25 2
      keyboards/mxss/rgblight.c

Datei-Diff unterdrückt, da er zu groß ist
+ 6 - 6
keyboards/mxss/info.json


+ 4 - 0
keyboards/mxss/mxss.c

@@ -113,6 +113,7 @@ void led_set_kb(uint8_t usb_led) {
         setrgb(0, 0, 0, &fleds[0]);
     }
 
+    rgblight_set();
 	led_set_user(usb_led);
 }
 
@@ -182,6 +183,7 @@ void fled_mode_cycle(void)
     
     // Update stored config
     eeprom_update_conf();
+    rgblight_set();
 }
 
 void fled_val_increase(void)
@@ -194,6 +196,7 @@ void fled_val_increase(void)
     
     // Update stored config
     eeprom_update_conf();
+    rgblight_set();
 }
 
 void fled_val_decrease(void)
@@ -206,4 +209,5 @@ void fled_val_decrease(void)
     
     // Update stored config
     eeprom_update_conf();
+    rgblight_set();
 }

+ 25 - 2
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;