浏览代码

Update LED/RGB Matrix flag function behavior (#17651)

Drashna Jaelre 2 年之前
父节点
当前提交
1dfe2bb49a
共有 4 个文件被更改,包括 25 次插入3 次删除
  1. 12 2
      quantum/led_matrix/led_matrix.c
  2. 1 0
      quantum/led_matrix/led_matrix.h
  3. 11 1
      quantum/rgb_matrix/rgb_matrix.c
  4. 1 0
      quantum/rgb_matrix/rgb_matrix.h

+ 12 - 2
quantum/led_matrix/led_matrix.c

@@ -618,10 +618,20 @@ void led_matrix_decrease_speed(void) {
     led_matrix_decrease_speed_helper(true);
     led_matrix_decrease_speed_helper(true);
 }
 }
 
 
+void led_matrix_set_flags_eeprom_helper(led_flags_t flags, bool write_to_eeprom) {
+    led_matrix_config.flags = flags;
+    eeconfig_flag_led_matrix(write_to_eeprom);
+    dprintf("led matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_config.flags);
+}
+
 led_flags_t led_matrix_get_flags(void) {
 led_flags_t led_matrix_get_flags(void) {
-    return led_matrix_eeconfig.flags;
+    return led_matrix_config.flags;
 }
 }
 
 
 void led_matrix_set_flags(led_flags_t flags) {
 void led_matrix_set_flags(led_flags_t flags) {
-    led_matrix_eeconfig.flags = flags;
+    led_matrix_set_flags_eeprom_helper(flags, true);
+}
+
+void led_matrix_set_flags_noeeprom(led_flags_t flags) {
+    led_matrix_set_flags_eeprom_helper(flags, false);
 }
 }

+ 1 - 0
quantum/led_matrix/led_matrix.h

@@ -158,6 +158,7 @@ void        led_matrix_decrease_speed(void);
 void        led_matrix_decrease_speed_noeeprom(void);
 void        led_matrix_decrease_speed_noeeprom(void);
 led_flags_t led_matrix_get_flags(void);
 led_flags_t led_matrix_get_flags(void);
 void        led_matrix_set_flags(led_flags_t flags);
 void        led_matrix_set_flags(led_flags_t flags);
+void        led_matrix_set_flags_noeeprom(led_flags_t flags);
 
 
 typedef struct {
 typedef struct {
     /* Perform any initialisation required for the other driver functions to work. */
     /* Perform any initialisation required for the other driver functions to work. */

+ 11 - 1
quantum/rgb_matrix/rgb_matrix.c

@@ -731,10 +731,20 @@ void rgb_matrix_decrease_speed(void) {
     rgb_matrix_decrease_speed_helper(true);
     rgb_matrix_decrease_speed_helper(true);
 }
 }
 
 
+void rgb_matrix_set_flags_eeprom_helper(led_flags_t flags, bool write_to_eeprom) {
+    rgb_matrix_config.flags = flags;
+    eeconfig_flag_rgb_matrix(write_to_eeprom);
+    dprintf("rgb matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.flags);
+}
+
 led_flags_t rgb_matrix_get_flags(void) {
 led_flags_t rgb_matrix_get_flags(void) {
     return rgb_matrix_config.flags;
     return rgb_matrix_config.flags;
 }
 }
 
 
 void rgb_matrix_set_flags(led_flags_t flags) {
 void rgb_matrix_set_flags(led_flags_t flags) {
-    rgb_matrix_config.flags = flags;
+    rgb_matrix_set_flags_eeprom_helper(flags, true);
+}
+
+void rgb_matrix_set_flags_noeeprom(led_flags_t flags) {
+    rgb_matrix_set_flags_eeprom_helper(flags, false);
 }
 }

+ 1 - 0
quantum/rgb_matrix/rgb_matrix.h

@@ -182,6 +182,7 @@ void        rgb_matrix_increase_speed_noeeprom(void);
 void        rgb_matrix_decrease_speed(void);
 void        rgb_matrix_decrease_speed(void);
 void        rgb_matrix_decrease_speed_noeeprom(void);
 void        rgb_matrix_decrease_speed_noeeprom(void);
 led_flags_t rgb_matrix_get_flags(void);
 led_flags_t rgb_matrix_get_flags(void);
+led_flags_t rgb_matrix_get_flags_noeeprom(void);
 void        rgb_matrix_set_flags(led_flags_t flags);
 void        rgb_matrix_set_flags(led_flags_t flags);
 
 
 #ifndef RGBLIGHT_ENABLE
 #ifndef RGBLIGHT_ENABLE