From 6e77d49ff1cd91919aa82dc586290555dbfd3ffa Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 21 Oct 2017 21:45:14 -0700 Subject: [PATCH] Suppress Task Switch during show (#186) --- src/internal/NeoEspBitBangMethod.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/internal/NeoEspBitBangMethod.h b/src/internal/NeoEspBitBangMethod.h index 499f1c3..51bb26b 100644 --- a/src/internal/NeoEspBitBangMethod.h +++ b/src/internal/NeoEspBitBangMethod.h @@ -116,11 +116,23 @@ public: yield(); // allows for system yield if needed } - noInterrupts(); // Need 100% focus on instruction timing + // Need 100% focus on instruction timing +#if defined(ARDUINO_ARCH_ESP32) + delay(1); // required + portMUX_TYPE updateMux = portMUX_INITIALIZER_UNLOCKED; + + taskENTER_CRITICAL(&updateMux); +#else + noInterrupts(); +#endif T_SPEED::send_pixels(_pixels, _pixels + _sizePixels, _pin); - + +#if defined(ARDUINO_ARCH_ESP32) + taskEXIT_CRITICAL(&updateMux); +#else interrupts(); +#endif // save EOD time for latch on next call _endTime = micros();