From 7da97c293da851851c204af065a0c8d2f884effd Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Tue, 17 Aug 2021 11:19:00 -0700 Subject: Rgb matrix/enable modes explicitly (#13758) * Change animations to require explicet activation * Add support for legacy config * Make default for now * Add LED Matrix support * change LED Matrix docs --- quantum/led_matrix/animations/alpha_mods_anim.h | 2 +- quantum/led_matrix/animations/band_anim.h | 2 +- quantum/led_matrix/animations/band_pinwheel_anim.h | 2 +- quantum/led_matrix/animations/band_spiral_anim.h | 2 +- quantum/led_matrix/animations/breathing_anim.h | 2 +- .../led_matrix/animations/cycle_left_right_anim.h | 2 +- quantum/led_matrix/animations/cycle_out_in_anim.h | 2 +- quantum/led_matrix/animations/cycle_up_down_anim.h | 2 +- quantum/led_matrix/animations/dual_beacon_anim.h | 2 +- .../led_matrix/animations/solid_reactive_cross.h | 8 +-- .../led_matrix/animations/solid_reactive_nexus.h | 10 +-- .../animations/solid_reactive_simple_anim.h | 2 +- .../led_matrix/animations/solid_reactive_wide.h | 8 +-- quantum/led_matrix/animations/solid_splash_anim.h | 8 +-- .../led_matrix/animations/wave_left_right_anim.h | 2 +- quantum/led_matrix/animations/wave_up_down_anim.h | 2 +- quantum/led_matrix/led_matrix.h | 1 + quantum/led_matrix/led_matrix_legacy_enables.h | 82 ++++++++++++++++++++++ 18 files changed, 112 insertions(+), 29 deletions(-) create mode 100644 quantum/led_matrix/led_matrix_legacy_enables.h (limited to 'quantum/led_matrix') diff --git a/quantum/led_matrix/animations/alpha_mods_anim.h b/quantum/led_matrix/animations/alpha_mods_anim.h index a4638fde69..14038cd082 100644 --- a/quantum/led_matrix/animations/alpha_mods_anim.h +++ b/quantum/led_matrix/animations/alpha_mods_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_ALPHAS_MODS +#ifdef ENABLE_LED_MATRIX_ALPHAS_MODS LED_MATRIX_EFFECT(ALPHAS_MODS) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/band_anim.h b/quantum/led_matrix/animations/band_anim.h index f9cb85dc4f..5548787b88 100644 --- a/quantum/led_matrix/animations/band_anim.h +++ b/quantum/led_matrix/animations/band_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_BAND +#ifdef ENABLE_LED_MATRIX_BAND LED_MATRIX_EFFECT(BAND) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/band_pinwheel_anim.h b/quantum/led_matrix/animations/band_pinwheel_anim.h index d3144bffbf..89651582d5 100644 --- a/quantum/led_matrix/animations/band_pinwheel_anim.h +++ b/quantum/led_matrix/animations/band_pinwheel_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_BAND_PINWHEEL +#ifdef ENABLE_LED_MATRIX_BAND_PINWHEEL LED_MATRIX_EFFECT(BAND_PINWHEEL) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/band_spiral_anim.h b/quantum/led_matrix/animations/band_spiral_anim.h index defbe69676..70b0ffaea9 100644 --- a/quantum/led_matrix/animations/band_spiral_anim.h +++ b/quantum/led_matrix/animations/band_spiral_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_BAND_SPIRAL +#ifdef ENABLE_LED_MATRIX_BAND_SPIRAL LED_MATRIX_EFFECT(BAND_SPIRAL) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/breathing_anim.h b/quantum/led_matrix/animations/breathing_anim.h index 4f49f50690..e3f600c45c 100644 --- a/quantum/led_matrix/animations/breathing_anim.h +++ b/quantum/led_matrix/animations/breathing_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_BREATHING +#ifdef ENABLE_LED_MATRIX_BREATHING LED_MATRIX_EFFECT(BREATHING) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/cycle_left_right_anim.h b/quantum/led_matrix/animations/cycle_left_right_anim.h index c426d02fd5..769e6d7942 100644 --- a/quantum/led_matrix/animations/cycle_left_right_anim.h +++ b/quantum/led_matrix/animations/cycle_left_right_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT +#ifdef ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT LED_MATRIX_EFFECT(CYCLE_LEFT_RIGHT) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/cycle_out_in_anim.h b/quantum/led_matrix/animations/cycle_out_in_anim.h index 55527556fd..6adf9c25ff 100644 --- a/quantum/led_matrix/animations/cycle_out_in_anim.h +++ b/quantum/led_matrix/animations/cycle_out_in_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_CYCLE_OUT_IN +#ifdef ENABLE_LED_MATRIX_CYCLE_OUT_IN LED_MATRIX_EFFECT(CYCLE_OUT_IN) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/cycle_up_down_anim.h b/quantum/led_matrix/animations/cycle_up_down_anim.h index d97de0d1ec..7a5868ac26 100644 --- a/quantum/led_matrix/animations/cycle_up_down_anim.h +++ b/quantum/led_matrix/animations/cycle_up_down_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_CYCLE_UP_DOWN +#ifdef ENABLE_LED_MATRIX_CYCLE_UP_DOWN LED_MATRIX_EFFECT(CYCLE_UP_DOWN) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/dual_beacon_anim.h b/quantum/led_matrix/animations/dual_beacon_anim.h index e1bc5ae464..3552c9fc39 100644 --- a/quantum/led_matrix/animations/dual_beacon_anim.h +++ b/quantum/led_matrix/animations/dual_beacon_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_DUAL_BEACON +#ifdef ENABLE_LED_MATRIX_DUAL_BEACON LED_MATRIX_EFFECT(DUAL_BEACON) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/solid_reactive_cross.h b/quantum/led_matrix/animations/solid_reactive_cross.h index 94425c959f..3a3c46be13 100644 --- a/quantum/led_matrix/animations/solid_reactive_cross.h +++ b/quantum/led_matrix/animations/solid_reactive_cross.h @@ -1,11 +1,11 @@ #ifdef LED_MATRIX_KEYREACTIVE_ENABLED # if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS) -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS LED_MATRIX_EFFECT(SOLID_REACTIVE_CROSS) # endif -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS) # endif @@ -22,11 +22,11 @@ static uint8_t SOLID_REACTIVE_CROSS_math(uint8_t val, int16_t dx, int16_t dy, ui return qadd8(val, 255 - effect); } -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS bool SOLID_REACTIVE_CROSS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); } # endif -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); } # endif diff --git a/quantum/led_matrix/animations/solid_reactive_nexus.h b/quantum/led_matrix/animations/solid_reactive_nexus.h index 504b1104f1..2520b8e1df 100644 --- a/quantum/led_matrix/animations/solid_reactive_nexus.h +++ b/quantum/led_matrix/animations/solid_reactive_nexus.h @@ -1,11 +1,11 @@ #ifdef LED_MATRIX_KEYREACTIVE_ENABLED -# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) +# if defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS LED_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS) # endif -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS) # endif @@ -19,11 +19,11 @@ static uint8_t SOLID_REACTIVE_NEXUS_math(uint8_t val, int16_t dx, int16_t dy, ui return qadd8(val, 255 - effect); } -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS bool SOLID_REACTIVE_NEXUS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); } # endif -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); } # endif diff --git a/quantum/led_matrix/animations/solid_reactive_simple_anim.h b/quantum/led_matrix/animations/solid_reactive_simple_anim.h index 4752a84162..43f6ad9ab4 100644 --- a/quantum/led_matrix/animations/solid_reactive_simple_anim.h +++ b/quantum/led_matrix/animations/solid_reactive_simple_anim.h @@ -1,5 +1,5 @@ #ifdef LED_MATRIX_KEYREACTIVE_ENABLED -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE LED_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/solid_reactive_wide.h b/quantum/led_matrix/animations/solid_reactive_wide.h index 922e32fe5f..d683b02510 100644 --- a/quantum/led_matrix/animations/solid_reactive_wide.h +++ b/quantum/led_matrix/animations/solid_reactive_wide.h @@ -1,11 +1,11 @@ #ifdef LED_MATRIX_KEYREACTIVE_ENABLED # if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE) -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE LED_MATRIX_EFFECT(SOLID_REACTIVE_WIDE) # endif -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE) # endif @@ -17,11 +17,11 @@ static uint8_t SOLID_REACTIVE_WIDE_math(uint8_t val, int16_t dx, int16_t dy, uin return qadd8(val, 255 - effect); } -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE bool SOLID_REACTIVE_WIDE(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); } # endif -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); } # endif diff --git a/quantum/led_matrix/animations/solid_splash_anim.h b/quantum/led_matrix/animations/solid_splash_anim.h index d95889b813..cf599c8fe6 100644 --- a/quantum/led_matrix/animations/solid_splash_anim.h +++ b/quantum/led_matrix/animations/solid_splash_anim.h @@ -1,11 +1,11 @@ #ifdef LED_MATRIX_KEYREACTIVE_ENABLED # if !defined(DISABLE_LED_MATRIX_SOLID_SPLASH) || !defined(DISABLE_LED_MATRIX_SOLID_MULTISPLASH) -# ifndef DISABLE_LED_MATRIX_SOLID_SPLASH +# ifdef ENABLE_LED_MATRIX_SOLID_SPLASH LED_MATRIX_EFFECT(SOLID_SPLASH) # endif -# ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH +# ifdef ENABLE_LED_MATRIX_SOLID_MULTISPLASH LED_MATRIX_EFFECT(SOLID_MULTISPLASH) # endif @@ -17,11 +17,11 @@ uint8_t SOLID_SPLASH_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uin return qadd8(val, 255 - effect); } -# ifndef DISABLE_LED_MATRIX_SOLID_SPLASH +# ifdef ENABLE_LED_MATRIX_SOLID_SPLASH bool SOLID_SPLASH(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); } # endif -# ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH +# ifdef ENABLE_LED_MATRIX_SOLID_MULTISPLASH bool SOLID_MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); } # endif diff --git a/quantum/led_matrix/animations/wave_left_right_anim.h b/quantum/led_matrix/animations/wave_left_right_anim.h index 8579f1b45f..c062cf968e 100644 --- a/quantum/led_matrix/animations/wave_left_right_anim.h +++ b/quantum/led_matrix/animations/wave_left_right_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT +#ifdef ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT LED_MATRIX_EFFECT(WAVE_LEFT_RIGHT) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/wave_up_down_anim.h b/quantum/led_matrix/animations/wave_up_down_anim.h index 635c608414..5e612f6b6d 100644 --- a/quantum/led_matrix/animations/wave_up_down_anim.h +++ b/quantum/led_matrix/animations/wave_up_down_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_WAVE_UP_DOWN +#ifdef ENABLE_LED_MATRIX_WAVE_UP_DOWN LED_MATRIX_EFFECT(WAVE_UP_DOWN) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h index 6f85854fbe..a7a1c983f7 100644 --- a/quantum/led_matrix/led_matrix.h +++ b/quantum/led_matrix/led_matrix.h @@ -23,6 +23,7 @@ #include #include "led_matrix_types.h" #include "quantum.h" +#include "led_matrix_legacy_enables.h" #ifdef IS31FL3731 # include "is31fl3731-simple.h" diff --git a/quantum/led_matrix/led_matrix_legacy_enables.h b/quantum/led_matrix/led_matrix_legacy_enables.h new file mode 100644 index 0000000000..7738d2f34e --- /dev/null +++ b/quantum/led_matrix/led_matrix_legacy_enables.h @@ -0,0 +1,82 @@ +/* Copyright 2021 QMK + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// to-do: remove this + +#pragma once + +#ifndef DISABLE_LED_MATRIX_ALPHAS_MODS +# define ENABLE_LED_MATRIX_ALPHAS_MODS +#endif +#ifndef DISABLE_LED_MATRIX_BREATHING +# define ENABLE_LED_MATRIX_BREATHING +#endif +#ifndef DISABLE_LED_MATRIX_BAND +# define ENABLE_LED_MATRIX_BAND +#endif +#ifndef DISABLE_LED_MATRIX_BAND_PINWHEEL +# define ENABLE_LED_MATRIX_BAND_PINWHEEL +#endif +#ifndef DISABLE_LED_MATRIX_BAND_SPIRAL +# define ENABLE_LED_MATRIX_BAND_SPIRAL +#endif +#ifndef DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT +#endif +#ifndef DISABLE_LED_MATRIX_CYCLE_UP_DOWN +# define ENABLE_LED_MATRIX_CYCLE_UP_DOWN +#endif +#ifndef DISABLE_LED_MATRIX_CYCLE_OUT_IN +# define ENABLE_LED_MATRIX_CYCLE_OUT_IN +#endif +#ifndef DISABLE_LED_MATRIX_DUAL_BEACON +# define ENABLE_LED_MATRIX_DUAL_BEACON +#endif +#if defined(LED_MATRIX_KEYREACTIVE_ENABLED) +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE +# endif +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE +# endif +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE +# endif +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS +# endif +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS +# endif +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS +# endif +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS +# endif +# ifndef DISABLE_LED_MATRIX_SPLASH +# define ENABLE_LED_MATRIX_SPLASH +# endif +# ifndef DISABLE_LED_MATRIX_MULTISPLASH +# define ENABLE_LED_MATRIX_MULTISPLASH +# endif +#endif +#ifndef DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT +# define ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT +#endif +#ifndef DISABLE_LED_MATRIX_WAVE_UP_DOWN +# define ENABLE_LED_MATRIX_WAVE_UP_DOWN +#endif -- cgit v1.2.3