From f7c092ce05a82e2bf02173dd86fde674bbd66b41 Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Tue, 7 Aug 2018 20:21:52 +0900 Subject: [PATCH] modify rgblight_task() --- quantum/rgblight.c | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 6b110d0e45..be01b1cff3 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -580,35 +580,60 @@ void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) { void rgblight_task(void) { if (rgblight_timer_enabled) { // mode = 1, static light, do nothing here - if (rgblight_config.mode >= RGBLIGHT_MODE_BREATHING && + if ( 1 == 0 ) { //dummy + } +#ifdef RGBLIGHT_EFFECT_BREATHING + else if (rgblight_config.mode >= RGBLIGHT_MODE_BREATHING && rgblight_config.mode <= RGBLIGHT_MODE_BREATHING_end) { // mode = 2 to 5, breathing mode rgblight_effect_breathing(rgblight_config.mode - RGBLIGHT_MODE_BREATHING ); - } else if (rgblight_config.mode >= RGBLIGHT_MODE_RAINBOW_MOOD && + } +#endif +#ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD + else if (rgblight_config.mode >= RGBLIGHT_MODE_RAINBOW_MOOD && rgblight_config.mode <= RGBLIGHT_MODE_RAINBOW_MOOD_end) { // mode = 6 to 8, rainbow mood mod rgblight_effect_rainbow_mood(rgblight_config.mode - RGBLIGHT_MODE_RAINBOW_MOOD); - } else if (rgblight_config.mode >= RGBLIGHT_MODE_RAINBOW_SWIRL && + } +#endif +#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL + else if (rgblight_config.mode >= RGBLIGHT_MODE_RAINBOW_SWIRL && rgblight_config.mode <= RGBLIGHT_MODE_RAINBOW_SWIRL_end) { // mode = 9 to 14, rainbow swirl mode rgblight_effect_rainbow_swirl(rgblight_config.mode - RGBLIGHT_MODE_RAINBOW_SWIRL); - } else if (rgblight_config.mode >= RGBLIGHT_MODE_SNAKE && + } +#endif +#ifdef RGBLIGHT_EFFECT_SNAKE + else if (rgblight_config.mode >= RGBLIGHT_MODE_SNAKE && rgblight_config.mode <= RGBLIGHT_MODE_SNAKE_end) { // mode = 15 to 20, snake mode rgblight_effect_snake(rgblight_config.mode - RGBLIGHT_MODE_SNAKE); - } else if (rgblight_config.mode >= RGBLIGHT_MODE_KNIGHT && + } +#endif +#ifdef RGBLIGHT_EFFECT_KNIGHT + else if (rgblight_config.mode >= RGBLIGHT_MODE_KNIGHT && rgblight_config.mode <= RGBLIGHT_MODE_KNIGHT_end) { // mode = 21 to 23, knight mode rgblight_effect_knight(rgblight_config.mode - RGBLIGHT_MODE_KNIGHT); - } else if (rgblight_config.mode == RGBLIGHT_MODE_CHRISTMAS) { + } +#endif +#ifdef RGBLIGHT_EFFECT_CHRISTMAS + else if (rgblight_config.mode == RGBLIGHT_MODE_CHRISTMAS) { // mode = 24, christmas mode rgblight_effect_christmas(); - } else if (rgblight_config.mode == RGBLIGHT_MODE_RGB_TEST) { + } +#endif +#ifdef RGBLIGHT_EFFECT_RGB_TEST + else if (rgblight_config.mode == RGBLIGHT_MODE_RGB_TEST) { // mode = 35, RGB test rgblight_effect_rgbtest(); - } else if (rgblight_config.mode == RGBLIGHT_MODE_ALTERNATING){ + } +#endif +#ifdef RGBLIGHT_EFFECT_ALTERNATING + else if (rgblight_config.mode == RGBLIGHT_MODE_ALTERNATING){ rgblight_effect_alternating(); } +#endif } }