From c7dfa155dfd98271eda3ac48dd8986fb193c3635 Mon Sep 17 00:00:00 2001 From: Ben Isaacs <75862+ben-xo@users.noreply.github.com> Date: Sun, 1 Aug 2021 19:18:54 +0100 Subject: Make the minimum wait optional by defining NO_MINIMUM_WAIT You may want this if you are doing your own frame-rate accounting and don't want to waste cycles. You may also want this if you are intentionally calling show() multiple times for the same strip. --- src/fastled_delay.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/fastled_delay.h b/src/fastled_delay.h index a14e8a29..4f99e3f6 100644 --- a/src/fastled_delay.h +++ b/src/fastled_delay.h @@ -8,6 +8,9 @@ FASTLED_NAMESPACE_BEGIN + +#if (!defined(NO_MINIMUM_WAIT) || (NO_MINIMUM_WAIT==0)) + /// Class to ensure that a minimum amount of time has kicked since the last time run - and delay if not enough time has passed yet /// this should make sure that chipsets that have template class CMinWait { @@ -26,6 +29,18 @@ public: void mark() { mLastMicros = micros() & 0xFFFF; } }; +#else + +// if you keep your own FPS (and therefore don't call show() too quickly for pixels to latch), you may not want a minimum wait. +template class CMinWait { +public: + CMinWait() { } + void wait() { } + void mark() {} +}; + +#endif + //////////////////////////////////////////////////////////////////////////////////////////// // -- cgit v1.2.3