aboutsummaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authoryiancar <yiangosyiangou@cytanet.com.cy>2018-07-03 19:52:04 +0300
committerJack Humbert <jack.humb@gmail.com>2018-07-03 12:52:04 -0400
commita7df902734b6aa8975e3a62a07ddb5544fd4ae85 (patch)
tree744f176d5abdfd98907a7baf8fa4dcfd33718f7b /quantum
parentdad851d47dd81dfd9829581bf61ba76e5ad30061 (diff)
downloadfirmware-a7df902734b6aa8975e3a62a07ddb5544fd4ae85.tar.gz
firmware-a7df902734b6aa8975e3a62a07ddb5544fd4ae85.tar.bz2
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')
-rw-r--r--quantum/rgb_matrix.c10
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;
#define EECONFIG_RGB_MATRIX EECONFIG_RGBLIGHT
#endif
+#if !defined(RGB_MATRIX_MAXIMUM_BRIGHTNESS) || RGB_MATRIX_MAXIMUM_BRIGHTNESS > 255
+ #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255
+#endif
+
bool g_suspend_state = false;
// Global tick at 20 Hz
@@ -68,7 +72,7 @@ void eeconfig_update_rgb_matrix_default(void) {
rgb_matrix_config.mode = RGB_MATRIX_CYCLE_LEFT_RIGHT;
rgb_matrix_config.hue = 0;
rgb_matrix_config.sat = 255;
- rgb_matrix_config.val = 255;
+ rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS;
rgb_matrix_config.speed = 0;
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
@@ -858,12 +862,12 @@ void rgblight_decrease_sat(void) {
}
void rgblight_increase_val(void) {
- rgb_matrix_config.val = increment( rgb_matrix_config.val, 8, 0, 255 );
+ rgb_matrix_config.val = increment( rgb_matrix_config.val, 8, 0, RGB_MATRIX_MAXIMUM_BRIGHTNESS );
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgblight_decrease_val(void) {
- rgb_matrix_config.val = decrement( rgb_matrix_config.val, 8, 0, 255 );
+ rgb_matrix_config.val = decrement( rgb_matrix_config.val, 8, 0, RGB_MATRIX_MAXIMUM_BRIGHTNESS );
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}