From 07360645afd84a4ccdf8cb3fba89c36511b4f7a4 Mon Sep 17 00:00:00 2001 From: Makuna Date: Mon, 8 Jun 2015 17:49:18 -0700 Subject: [PATCH] Out of bounds pixel count check Added ISYNC --- NeoPixelBus.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NeoPixelBus.cpp b/NeoPixelBus.cpp index 13c01b2..598b99b 100644 --- a/NeoPixelBus.cpp +++ b/NeoPixelBus.cpp @@ -92,6 +92,7 @@ static inline void send_pixels_800(uint8_t* pixels, uint8_t* end, uint8_t pin) // this set low will help cleanup the first bit GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, pinRegister); + __asm__ __volatile__("isync"); cyclesStart = ESP.getCycleCount() + CYCLES_800; while (pixels < end) @@ -145,6 +146,7 @@ static inline void send_pixels_400(uint8_t* pixels, uint8_t* end, uint8_t pin) // this set low will help cleanup the first bit GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, pinRegister); + __asm__ __volatile__("isync"); cyclesStart = ESP.getCycleCount() + CYCLES_400; while (pixels < end) @@ -1166,6 +1168,11 @@ RgbColor NeoPixelBus::GetPixelColor(uint16_t n) const void NeoPixelBus::LinearFadePixelColor(uint16_t time, uint16_t n, RgbColor color) { + if (n >= _countPixels) + { + return; + } + if (_animations[n].time != 0) { _activeAnimations--;