From c89565cc3dda82642a0c6c839176602f05fc56f1 Mon Sep 17 00:00:00 2001 From: yiancar Date: Thu, 10 May 2018 05:31:24 +0100 Subject: [PATCH] General RGB matrix fixes (#2931) * Added Modular keyboards L,R and NUM Created code modules for the 3 modules of the modular keyboard. Original idea by MechboardsUK. Uses i2c implementation similar to lets split * Remove modular from master This is to fix incorrect branching * General fixes for RGB_matrix - Complited speed support for all effects - Fixed raindrop effects to initialized after toggle - Fixed raindrop effects to use all available LEDs - Fixed effect step reverse function - Moved RGB_MATRIX_SOLID_REACTIVE under correct flag * Documentation update for RGBmatrix * More doc updates --- docs/feature_rgb_matrix.md | 4 ++-- quantum/rgb_matrix.c | 29 ++++++++++++++++------------- quantum/rgb_matrix.h | 2 +- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 084e87ec48..5d2db3b970 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -81,7 +81,6 @@ These are the effects that are currently available: enum rgb_matrix_effects { RGB_MATRIX_SOLID_COLOR = 1, - RGB_MATRIX_SOLID_REACTIVE, RGB_MATRIX_ALPHAS_MODS, RGB_MATRIX_DUAL_BEACON, RGB_MATRIX_GRADIENT_UP_DOWN, @@ -94,6 +93,7 @@ These are the effects that are currently available: RGB_MATRIX_RAINBOW_MOVING_CHEVRON, RGB_MATRIX_JELLYBEAN_RAINDROPS, #ifdef RGB_MATRIX_KEYPRESSES + RGB_MATRIX_SOLID_REACTIVE, RGB_MATRIX_SPLASH, RGB_MATRIX_MULTISPLASH, RGB_MATRIX_SOLID_SPLASH, @@ -118,7 +118,7 @@ A similar function works in the keymap as `rgb_matrix_indicators_user`. #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) #define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects #define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended - #define RGB_MATRIX_SKIP_FRAMES 1 // number of frames to skip when displaying animations (0 is full effect) + #define RGB_MATRIX_SKIP_FRAMES 1 // number of frames to skip when displaying animations (0 is full effect) if not defined defaults to 1 ## EEPROM storage diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index 558e28dece..f3d012bc3e 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c @@ -324,8 +324,8 @@ void rgb_matrix_raindrops(bool initialize) { HSV hsv; RGB rgb; - // Change one LED every tick - uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % DRIVER_LED_TOTAL : 255; + // Change one LED every tick, make sure speed is not 0 + uint8_t led_to_change = ( g_tick & ( 0x0A / (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed) ) ) == 0 ? rand() % (DRIVER_LED_TOTAL) : 255; for ( int i=0; i