From 6a45df755c1b78ba4f6b41a1029e4464c5070e11 Mon Sep 17 00:00:00 2001 From: Ben Isaacs <75862+ben-xo@users.noreply.github.com> Date: Sun, 1 Aug 2021 18:10:23 +0100 Subject: Change define NO_CORRECTION in clockless_trinket to NO_CLOCK_CORRECTION (#1263) The more specific use is in clockless_trinket, so this is the one which has been renamed. It was only relevant if you also had FASTLED_ALLOW_INTERRUPTS defined. Existing code will still work exactly the same, but in cases where this define would have altered the code, a warning is now emitted as well. --- src/platforms/avr/clockless_trinket.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/platforms/avr/clockless_trinket.h b/src/platforms/avr/clockless_trinket.h index 2cfbef0d..2b4f3245 100644 --- a/src/platforms/avr/clockless_trinket.h +++ b/src/platforms/avr/clockless_trinket.h @@ -87,7 +87,13 @@ template<> __attribute__((always_inline)) inline void _dc<20>(register uint8_t & // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#if (!defined(NO_CORRECTION) || (NO_CORRECTION == 0)) && (FASTLED_ALLOW_INTERRUPTS == 0) +#if (FASTLED_ALLOW_INTERRUPTS == 1) && defined(NO_CORRECTION) && (NO_CORRECTION == 1) && !(defined(NO_CLOCK_CORRECTION)) +# warning In older versions of FastLED defining NO_CORRECTION 1 would mistakenly turn off color correction as well as clock correction. +# warning As clock correction is unnecessary with FASTLED_ALLOW_INTERRUPTS 1, you should define NO_CLOCK_CORRECTION 1 instead. +# define NO_CLOCK_CORRECTION 1 +#endif + +#if (!defined(NO_CLOCK_CORRECTION) || (NO_CLOCK_CORRECTION == 0)) && (FASTLED_ALLOW_INTERRUPTS == 0) static uint8_t gTimeErrorAccum256ths; #endif @@ -118,7 +124,7 @@ protected: showRGBInternal(pixels); // Adjust the timer -#if (!defined(NO_CORRECTION) || (NO_CORRECTION == 0)) && (FASTLED_ALLOW_INTERRUPTS == 0) +#if (!defined(NO_CLOCK_CORRECTION) || (NO_CLOCK_CORRECTION == 0)) && (FASTLED_ALLOW_INTERRUPTS == 0) uint32_t microsTaken = (uint32_t)pixels.size() * (uint32_t)CLKS_TO_MICROS(24 * (T1 + T2 + T3)); // adust for approximate observed actal runtime (as of January 2015) -- cgit v1.2.3 From 4ef987b78b7b7485934ae81e8719cbb0e280ce6e Mon Sep 17 00:00:00 2001 From: Ben Isaacs <75862+ben-xo@users.noreply.github.com> Date: Sun, 1 Aug 2021 18:30:15 +0100 Subject: Fix the printout of warnings and make warning message clearer. --- src/platforms/avr/clockless_trinket.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platforms/avr/clockless_trinket.h b/src/platforms/avr/clockless_trinket.h index 2b4f3245..4afcbe7b 100644 --- a/src/platforms/avr/clockless_trinket.h +++ b/src/platforms/avr/clockless_trinket.h @@ -87,9 +87,9 @@ template<> __attribute__((always_inline)) inline void _dc<20>(register uint8_t & // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#if (FASTLED_ALLOW_INTERRUPTS == 1) && defined(NO_CORRECTION) && (NO_CORRECTION == 1) && !(defined(NO_CLOCK_CORRECTION)) -# warning In older versions of FastLED defining NO_CORRECTION 1 would mistakenly turn off color correction as well as clock correction. -# warning As clock correction is unnecessary with FASTLED_ALLOW_INTERRUPTS 1, you should define NO_CLOCK_CORRECTION 1 instead. +#if ((FASTLED_ALLOW_INTERRUPTS == 1) && defined(NO_CORRECTION) && (NO_CORRECTION == 1) && !(defined(NO_CLOCK_CORRECTION))) +# pragma message "In older versions of FastLED defining NO_CORRECTION 1 would mistakenly turn off color correction as well as clock correction." +# pragma message "Clock correction is unnecessary with FASTLED_ALLOW_INTERRUPTS 1. define NO_CLOCK_CORRECTION 1 to fix this warning." # define NO_CLOCK_CORRECTION 1 #endif -- cgit v1.2.3 From 97b296543e48dfd5ba380c497bf24eeccf5f82b9 Mon Sep 17 00:00:00 2001 From: Ben Isaacs <75862+ben-xo@users.noreply.github.com> Date: Sun, 1 Aug 2021 18:45:22 +0100 Subject: Fix sense of check - this warning is ONLY if you're trying to disable clock correction without also enabling interrupts --- src/platforms/avr/clockless_trinket.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/platforms/avr/clockless_trinket.h b/src/platforms/avr/clockless_trinket.h index 4afcbe7b..45143d91 100644 --- a/src/platforms/avr/clockless_trinket.h +++ b/src/platforms/avr/clockless_trinket.h @@ -87,9 +87,10 @@ template<> __attribute__((always_inline)) inline void _dc<20>(register uint8_t & // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#if ((FASTLED_ALLOW_INTERRUPTS == 1) && defined(NO_CORRECTION) && (NO_CORRECTION == 1) && !(defined(NO_CLOCK_CORRECTION))) +#if ((FASTLED_ALLOW_INTERRUPTS == 0) && defined(NO_CORRECTION) && (NO_CORRECTION == 1) && !(defined(NO_CLOCK_CORRECTION))) +// we hit this if you were trying to turn off clock correction without also trying to enable interrupts. # pragma message "In older versions of FastLED defining NO_CORRECTION 1 would mistakenly turn off color correction as well as clock correction." -# pragma message "Clock correction is unnecessary with FASTLED_ALLOW_INTERRUPTS 1. define NO_CLOCK_CORRECTION 1 to fix this warning." +# pragma message "define NO_CLOCK_CORRECTION 1 to fix this warning." # define NO_CLOCK_CORRECTION 1 #endif -- cgit v1.2.3