diff options
author | yiancar <yiangosyiangou@cytanet.com.cy> | 2018-07-03 19:52:04 +0300 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-07-03 12:52:04 -0400 |
commit | a7df902734b6aa8975e3a62a07ddb5544fd4ae85 (patch) | |
tree | 744f176d5abdfd98907a7baf8fa4dcfd33718f7b /quantum/rgb_matrix.c | |
parent | dad851d47dd81dfd9829581bf61ba76e5ad30061 (diff) | |
download | qmk_firmware-a7df902734b6aa8975e3a62a07ddb5544fd4ae85.tar.gz qmk_firmware-a7df902734b6aa8975e3a62a07ddb5544fd4ae85.zip |
Addition of hard brigtness limit for RGB_Matrix (#3299)
* Addition of hard brigtness limit for RGB_Matrix
- Added a define "RGB_MATRIX_MAXIMUM_BRIGHTNESS" to enable hard limiting the maximum brightness for rgb_matrix
- Used the above define to limit the maximum brigthness of HS60 for better stability
* Added docs for new rgb_matrix define
* Addition of check for maximum brightness
Diffstat (limited to 'quantum/rgb_matrix.c')
-rw-r--r-- | quantum/rgb_matrix.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index 8c41fc54d..b7424d637 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c | |||
@@ -41,6 +41,10 @@ rgb_config_t rgb_matrix_config; | |||
41 | #define EECONFIG_RGB_MATRIX EECONFIG_RGBLIGHT | 41 | #define EECONFIG_RGB_MATRIX EECONFIG_RGBLIGHT |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #if !defined(RGB_MATRIX_MAXIMUM_BRIGHTNESS) || RGB_MATRIX_MAXIMUM_BRIGHTNESS > 255 | ||
45 | #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255 | ||
46 | #endif | ||
47 | |||
44 | bool g_suspend_state = false; | 48 | bool g_suspend_state = false; |
45 | 49 | ||
46 | // Global tick at 20 Hz | 50 | // Global tick at 20 Hz |
@@ -68,7 +72,7 @@ void eeconfig_update_rgb_matrix_default(void) { | |||
68 | rgb_matrix_config.mode = RGB_MATRIX_CYCLE_LEFT_RIGHT; | 72 | rgb_matrix_config.mode = RGB_MATRIX_CYCLE_LEFT_RIGHT; |
69 | rgb_matrix_config.hue = 0; | 73 | rgb_matrix_config.hue = 0; |
70 | rgb_matrix_config.sat = 255; | 74 | rgb_matrix_config.sat = 255; |
71 | rgb_matrix_config.val = 255; | 75 | rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS; |
72 | rgb_matrix_config.speed = 0; | 76 | rgb_matrix_config.speed = 0; |
73 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); | 77 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); |
74 | } | 78 | } |
@@ -858,12 +862,12 @@ void rgblight_decrease_sat(void) { | |||
858 | } | 862 | } |
859 | 863 | ||
860 | void rgblight_increase_val(void) { | 864 | void rgblight_increase_val(void) { |
861 | rgb_matrix_config.val = increment( rgb_matrix_config.val, 8, 0, 255 ); | 865 | rgb_matrix_config.val = increment( rgb_matrix_config.val, 8, 0, RGB_MATRIX_MAXIMUM_BRIGHTNESS ); |
862 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); | 866 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); |
863 | } | 867 | } |
864 | 868 | ||
865 | void rgblight_decrease_val(void) { | 869 | void rgblight_decrease_val(void) { |
866 | rgb_matrix_config.val = decrement( rgb_matrix_config.val, 8, 0, 255 ); | 870 | rgb_matrix_config.val = decrement( rgb_matrix_config.val, 8, 0, RGB_MATRIX_MAXIMUM_BRIGHTNESS ); |
867 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); | 871 | eeconfig_update_rgb_matrix(rgb_matrix_config.raw); |
868 | } | 872 | } |
869 | 873 | ||