diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2016-06-08 07:08:07 +0300 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2016-06-08 07:08:07 +0300 |
commit | 7a6a22387558fdefe5d93dfd9ee9ebf312aca87c (patch) | |
tree | eb7d50b9ef41d641ef7d9bdb2bbbc2595ed2c3b8 | |
parent | 4a71eeabe8ef570de676cc1f57fca599283cde28 (diff) |
Fix #309 and wrap up #306
-rw-r--r-- | fastled_config.h | 7 | ||||
-rw-r--r-- | platforms/esp/8266/clockless_block_esp8266.h | 3 | ||||
-rw-r--r-- | platforms/esp/8266/clockless_esp8266.h | 9 |
3 files changed, 10 insertions, 9 deletions
diff --git a/fastled_config.h b/fastled_config.h index 125ded21..b1d5d83b 100644 --- a/fastled_config.h +++ b/fastled_config.h @@ -38,4 +38,11 @@ #define FASTLED_SCALE8_FIXED 1 // define FASTLED_SCALE8_FIXED 0 +// Use this to determine how many times FastLED will attempt to re-transmit a frame if interrupted +// for too long by interrupts. +#ifndef FASTLED_INTERRUPT_RETRY_COUNT +#define FASTLED_INTERRUPT_RETRY_COUNT 2 +#endif + + #endif diff --git a/platforms/esp/8266/clockless_block_esp8266.h b/platforms/esp/8266/clockless_block_esp8266.h index 90690c3c..0738323f 100644 --- a/platforms/esp/8266/clockless_block_esp8266.h +++ b/platforms/esp/8266/clockless_block_esp8266.h @@ -25,12 +25,11 @@ public: virtual void showPixels(PixelController<RGB_ORDER, LANES, PORT_MASK> & pixels) { // mWait.wait(); /*uint32_t clocks = */ - int cnt=2; + int cnt=FASTLED_INTERRUPT_RETRY_COUNT; while(!showRGBInternal(pixels) && cnt--) { os_intr_unlock(); delayMicroseconds(WAIT_TIME * 10); os_intr_lock(); - showRGBInternal(pixels); } // #if FASTLED_ALLOW_INTTERUPTS == 0 // Adjust the timer diff --git a/platforms/esp/8266/clockless_esp8266.h b/platforms/esp/8266/clockless_esp8266.h index 5e6d0a08..746e9613 100644 --- a/platforms/esp/8266/clockless_esp8266.h +++ b/platforms/esp/8266/clockless_esp8266.h @@ -9,10 +9,6 @@ __attribute__ ((always_inline)) inline static uint32_t __clock_cycles() { return cyc; } -#ifndef FASTLED_INTERRUPT_RETRY_COUNT -#define FASTLED_INTERRUPT_RETRY_COUNT 2 -#endif - #define FASTLED_HAS_CLOCKLESS 1 template <int DATA_PIN, int T1, int T2, int T3, EOrder RGB_ORDER = RGB, int XTRA0 = 0, bool FLIP = false, int WAIT_TIME = 5> @@ -37,11 +33,10 @@ protected: virtual void showPixels(PixelController<RGB_ORDER> & pixels) { // mWait.wait(); int cnt = FASTLED_INTERRUPT_RETRY_COUNT; - while(!showRGBInternal(pixels) && cnt--) { + while((showRGBInternal(pixels)==0) && cnt--) { os_intr_unlock(); - delayMicroseconds(WAIT_TIME * 20); + delayMicroseconds(WAIT_TIME); os_intr_lock(); - showRGBInternal(pixels); } // mWait.mark(); } |