diff --git a/keyboards/keychron/q1/config.h b/keyboards/keychron/q1/config.h index 847a6b874c5d..47508b86924f 100644 --- a/keyboards/keychron/q1/config.h +++ b/keyboards/keychron/q1/config.h @@ -25,9 +25,6 @@ /* Disable DIP switch in matrix data */ #define MATRIX_MASKED -/* Disable RGB lighting when PC is in suspend */ -#define RGB_DISABLE_WHEN_USB_SUSPENDED - // RGB Matrix Animation modes. Explicitly enabled // For full list of effects, see: // https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects @@ -80,8 +77,15 @@ #define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_KEYPRESSES +#ifdef RGB_MATRIX_ENABLE +# define RGB_DISABLE_WHEN_USB_SUSPENDED // Disable RGB lighting when PC is in suspend +# undef RGB_DISABLE_TIMEOUT +# define RGB_DISABLE_TIMEOUT 900000 // 15 minutes (15 * 60 * 1000ms) +#endif + /* GEEKRGB config */ #define GEEKRGB_USE_UNIVERSAL_BRIGHTNESS +#define GEEKRGB_WELCOME_ANIM_SPD 170 #define OPENRGB_DEFAULT_KEYMAP_ID 2 //read windows keymap for openrgb /* Enable receive custom command from host */ diff --git a/keyboards/melgeek/tegic/config.h b/keyboards/melgeek/tegic/config.h index c79bd80dfa2b..a96eead93044 100755 --- a/keyboards/melgeek/tegic/config.h +++ b/keyboards/melgeek/tegic/config.h @@ -25,9 +25,6 @@ /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 3 -/* Disable RGB lighting when PC is in suspend */ -#define RGB_DISABLE_WHEN_USB_SUSPENDED - // #define RGB_ENABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects #define RGB_MATRIX_KEYPRESSES // #define RGB_MATRIX_FRAMEBUFFER_EFFECTS @@ -43,6 +40,12 @@ #define RGB_MATRIX_STARTUP_SPD 40 +#ifdef RGB_MATRIX_ENABLE +# define RGB_DISABLE_WHEN_USB_SUSPENDED // Disable RGB lighting when PC is in suspend +# undef RGB_DISABLE_TIMEOUT +# define RGB_DISABLE_TIMEOUT 900000 // 15 minutes (15 * 60 * 1000ms) +#endif + #define DRIVER_ADDR_1 0b0110000 #define DRIVER_COUNT 1 @@ -64,7 +67,7 @@ #define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN #define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN -#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +// #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL #define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL #define ENABLE_RGB_MATRIX_CYCLE_SPIRAL #define ENABLE_RGB_MATRIX_DUAL_BEACON @@ -95,9 +98,10 @@ // #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH //new effects -#define ENABLE_RGB_MATRIX_PIXEL_RAIN +// #define ENABLE_RGB_MATRIX_PIXEL_RAIN // #define ENABLE_RGB_MATRIX_PIXEL_FLOW // #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL +/* GEEKRGB config */ #define GEEKRGB_USE_UNIVERSAL_BRIGHTNESS //no use OPENRGB_DIRECT_MODE_USE_UNIVERSAL_BRIGHTNESS - +#define GEEKRGB_WELCOME_ANIM_SPD 170 diff --git a/quantum/geekrgb.c b/quantum/geekrgb.c index 5124ae3f2e28..4965c6ec20b6 100644 --- a/quantum/geekrgb.c +++ b/quantum/geekrgb.c @@ -19,37 +19,35 @@ #include "raw_hid.h" #if !defined(GEEKRGB_STARTUP_RED) -# define GEEKRGB_STARTUP_RED 40 +# define GEEKRGB_STARTUP_RED 20 #endif #if !defined(GEEKRGB_STARTUP_GREEN) -# define GEEKRGB_STARTUP_GREEN 255 +# define GEEKRGB_STARTUP_GREEN 120 #endif #if !defined(GEEKRGB_STARTUP_BLUE) -# define GEEKRGB_STARTUP_BLUE 140 +# define GEEKRGB_STARTUP_BLUE 190 #endif // global -uint16_t g_geekrgb_timer = 0; -bool g_geekrgb_anim_playing = false; +uint16_t g_geekrgb_timer = 0; +bool g_geekrgb_anim_playing = false; // internals -static uint8_t hidrgb_mode = HID_MODE_OPENRGB; -static RGB last_openrgb_colors[DRIVER_LED_TOTAL] = {[0 ... DRIVER_LED_TOTAL - 1] ={GEEKRGB_STARTUP_GREEN, GEEKRGB_STARTUP_RED, GEEKRGB_STARTUP_BLUE}}; +static uint8_t geekrgb_mode = HID_MODE_OPENRGB; +static RGB last_openrgb_colors[DRIVER_LED_TOTAL] = {[0 ... DRIVER_LED_TOTAL - 1] = {GEEKRGB_STARTUP_GREEN, GEEKRGB_STARTUP_RED, GEEKRGB_STARTUP_BLUE}}; -//static RGB last_openrgb_colors[DRIVER_LED_TOTAL] = {[0 ... DRIVER_LED_TOTAL - 1] ={0,0,0}}; -//static RGB last_signalrgb_colors[DRIVER_LED_TOTAL] = {[0 ... DRIVER_LED_TOTAL - 1] ={0,0,0}}; //set one matrix led color -void hidrgb_set_color(int index, uint8_t red, uint8_t green, uint8_t blue){ +void geekrgb_set_color(int index, uint8_t red, uint8_t green, uint8_t blue){ if (rgb_matrix_get_mode() != RGB_MATRIX_GEEKRGB) { // if matrix mode not signalrgb, do not streaming led. return; } //cache openRGB colors - if (hidrgb_get_mode() == HID_MODE_OPENRGB) { + if (geekrgb_get_mode() == HID_MODE_OPENRGB) { last_openrgb_colors[index].r = red; last_openrgb_colors[index].g = green; last_openrgb_colors[index].b = blue; @@ -64,36 +62,36 @@ void hidrgb_set_color(int index, uint8_t red, uint8_t green, uint8_t blue){ } //set openrgb colors -void hidrgb_reload_openrgb_colors(void){ - if (hidrgb_get_mode() == HID_MODE_OPENRGB) { +void geekrgb_reload_openrgb_colors(void){ + if (geekrgb_get_mode() == HID_MODE_OPENRGB) { for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { - hidrgb_set_color(i,last_openrgb_colors[i].r,last_openrgb_colors[i].g,last_openrgb_colors[i].b); + geekrgb_set_color(i,last_openrgb_colors[i].r,last_openrgb_colors[i].g,last_openrgb_colors[i].b); } } } -void hidrgb_reload_openrgb_anim(void){ +void geekrgb_reload_openrgb_anim(void){ if (!g_geekrgb_anim_playing) g_geekrgb_timer = 0; rgb_matrix_set_color_all(0,0,0); } //get openrgb colors -RGB* hidrgb_get_openrgb_colors(void){ +RGB* geekrgb_get_openrgb_colors(void){ return last_openrgb_colors; } -RGB hidrgb_get_openrgb_color(int index){ +RGB geekrgb_get_openrgb_color(int index){ return last_openrgb_colors[index]; } //set hidrgb software mode, HID_MODE_OPENRGB or HID_MODE_SIGNALRGB -void hidrgb_set_mode(int mode){ - hidrgb_mode = mode; +void geekrgb_set_mode(int mode){ + geekrgb_mode = mode; } //get hidrgb software mode, HID_MODE_OPENRGB or HID_MODE_SIGNALRGB -uint8_t hidrgb_get_mode(void){ - return hidrgb_mode; +uint8_t geekrgb_get_mode(void){ + return geekrgb_mode; } //receive HIDRGB usbhid raw data. diff --git a/quantum/geekrgb.h b/quantum/geekrgb.h index 52d5da8b3d92..9101f1b43b64 100644 --- a/quantum/geekrgb.h +++ b/quantum/geekrgb.h @@ -27,12 +27,12 @@ enum hidrgb_mode { extern uint16_t g_geekrgb_timer; extern bool g_geekrgb_anim_playing; -void hidrgb_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); //set one led color -void hidrgb_set_mode(int mode); //set hidrgb software mode, HID_MODE_OPENRGB or HID_MODE_SIGNALRGB -uint8_t hidrgb_get_mode(void); //get software mode +void geekrgb_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); //set one led color +void geekrgb_set_mode(int mode); //set hidrgb software mode, HID_MODE_OPENRGB or HID_MODE_SIGNALRGB +uint8_t geekrgb_get_mode(void); //get software mode -void hidrgb_reload_openrgb_colors(void); //reload openrgb colors -void hidrgb_reload_openrgb_anim(void);//reload openrgb colors in animation -RGB* hidrgb_get_openrgb_colors(void); //get openrgb colors -RGB hidrgb_get_openrgb_color(int index); +void geekrgb_reload_openrgb_colors(void); //reload openrgb colors +void geekrgb_reload_openrgb_anim(void);//reload openrgb colors in animation +RGB* geekrgb_get_openrgb_colors(void); //get openrgb colors +RGB geekrgb_get_openrgb_color(int index); diff --git a/quantum/openrgb.c b/quantum/openrgb.c index d3e5871c970c..34d997d98dcf 100644 --- a/quantum/openrgb.c +++ b/quantum/openrgb.c @@ -263,7 +263,7 @@ void openrgb_get_mode_info(void) { void openrgb_get_led_info(uint8_t *data) { const uint8_t first_led = data[1]; const uint8_t number_leds = data[2]; - const RGB* openrgb_colors = hidrgb_get_openrgb_colors(); + const RGB* openrgb_colors = geekrgb_get_openrgb_colors(); raw_hid_buffer[0] = OPENRGB_GET_LED_INFO; @@ -330,7 +330,7 @@ void openrgb_set_mode(uint8_t *data) { return; } - hidrgb_set_mode(HID_MODE_OPENRGB); + geekrgb_set_mode(HID_MODE_OPENRGB); if (save == 1) { rgb_matrix_mode(mode); @@ -344,13 +344,13 @@ void openrgb_set_mode(uint8_t *data) { } if (rgb_matrix_get_mode() == RGB_MATRIX_GEEKRGB) { // if matrix mode not signalrgb, do not streaming led. - hidrgb_reload_openrgb_anim(); + geekrgb_reload_openrgb_anim(); } raw_hid_buffer[OPENRGB_EPSIZE - 2] = OPENRGB_SUCCESS; } void openrgb_direct_mode_set_single_led(uint8_t *data) { - if (hidrgb_get_mode() != HID_MODE_OPENRGB || rgb_matrix_get_mode() != RGB_MATRIX_GEEKRGB) { + if (geekrgb_get_mode() != HID_MODE_OPENRGB || rgb_matrix_get_mode() != RGB_MATRIX_GEEKRGB) { raw_hid_buffer[OPENRGB_EPSIZE - 2] = OPENRGB_FAILURE; return; } @@ -367,12 +367,12 @@ void openrgb_direct_mode_set_single_led(uint8_t *data) { return; } - hidrgb_set_color(led,r,g,b); + geekrgb_set_color(led,r,g,b); raw_hid_buffer[OPENRGB_EPSIZE - 2] = OPENRGB_SUCCESS; } void openrgb_direct_mode_set_leds(uint8_t *data) { - if (hidrgb_get_mode() != HID_MODE_OPENRGB || rgb_matrix_get_mode() != RGB_MATRIX_GEEKRGB) { + if (geekrgb_get_mode() != HID_MODE_OPENRGB || rgb_matrix_get_mode() != RGB_MATRIX_GEEKRGB) { return; } @@ -382,6 +382,6 @@ void openrgb_direct_mode_set_leds(uint8_t *data) { const uint8_t data_idx = i * 4; const uint8_t color_idx = data[data_idx + 2]; - hidrgb_set_color(color_idx,data[data_idx + 3],data[data_idx + 4],data[data_idx + 5]); + geekrgb_set_color(color_idx,data[data_idx + 3],data[data_idx + 4],data[data_idx + 5]); } } diff --git a/quantum/rgb_matrix/animations/geek_rgb_anim.h b/quantum/rgb_matrix/animations/geek_rgb_anim.h index 60f1bcfb4adb..42fb4f5d2df3 100644 --- a/quantum/rgb_matrix/animations/geek_rgb_anim.h +++ b/quantum/rgb_matrix/animations/geek_rgb_anim.h @@ -8,7 +8,7 @@ RGB_MATRIX_EFFECT(GEEKRGB) static void set_openrgb_color(uint8_t led_index, uint8_t val){ - RGB rgb = hidrgb_get_openrgb_color(led_index); + RGB rgb = geekrgb_get_openrgb_color(led_index); # ifdef GEEKRGB_USE_UNIVERSAL_BRIGHTNESS float brightness = (float) val / UINT8_MAX; @@ -49,7 +49,7 @@ bool GEEKRGB(effect_params_t* params){ if (g_geekrgb_anim_playing) g_geekrgb_timer++; //tick counter } - if (hidrgb_get_mode() == HID_MODE_OPENRGB) { + if (geekrgb_get_mode() == HID_MODE_OPENRGB) { set_openrgb_colors(params); } diff --git a/quantum/signalrgb.c b/quantum/signalrgb.c index 79db153c8cf5..59840c305624 100644 --- a/quantum/signalrgb.c +++ b/quantum/signalrgb.c @@ -44,7 +44,7 @@ void led_streaming(uint8_t *data) //Stream data from HID Packets to Keyboard. uint8_t index = data[1]; uint8_t numberofleds = data[2]; - if (hidrgb_get_mode() != HID_MODE_SIGNALRGB) { + if (geekrgb_get_mode() != HID_MODE_SIGNALRGB) { return; } @@ -63,21 +63,21 @@ void led_streaming(uint8_t *data) //Stream data from HID Packets to Keyboard. uint8_t g = data[offset + 1]; uint8_t b = data[offset + 2]; - hidrgb_set_color(index + i,r,g,b); + geekrgb_set_color(index + i,r,g,b); } } void signalrgb_mode_enable(void) { - hidrgb_set_mode(HID_MODE_SIGNALRGB); + geekrgb_set_mode(HID_MODE_SIGNALRGB); rgb_matrix_mode_noeeprom(RGB_MATRIX_GEEKRGB); //Set RGB Matrix to SignalRGB Compatible Mode } void signalrgb_mode_disable(void) { - hidrgb_set_mode(HID_MODE_OPENRGB); //switch to OpenRGB mode + geekrgb_set_mode(HID_MODE_OPENRGB); //switch to OpenRGB mode #ifdef OPENRGB_ENABLE - hidrgb_reload_openrgb_anim(); + geekrgb_reload_openrgb_anim(); #else rgb_matrix_reload_from_eeprom(); //Reloading last effect from eeprom #endif