These are chat archives for Makuna/NeoPixelBus

Jun 2015
Jun 13 2015 21:12
Hello, I was experiencing the same issue with a ocassionally flickering green LED, especially visible when the faded effect is set to a low luminance. A primitve fix for my setup is to disable all interrupts and after the strip data has been send to reenable it, just like for AVR controllers. I can now still access the ESP8266 Webserver when and reload the page without any green flickering.
static inline void send_pixels_800(uint8_t* pixels, uint8_t* end, uint8_t pin)
    const uint32_t pinRegister = _BV(pin);
    uint8_t mask;  
    uint8_t subpix;  
    uint32_t cyclesStart;

    //disable all interrupts globally (might cause unforeseen sideeffects)

    // this set low will help cleanup the first bit
    __asm__ __volatile__("isync");

    cyclesStart = ESP.getCycleCount() + CYCLES_800;
    while (pixels < end)
        subpix = *pixels++;
        for (mask = 0x80; mask; mask >>= 1)
            // do the check here while we are waiting on time to pass
            bool nextBit = (subpix & mask);
            uint32_t cyclesNext = cyclesStart;

            // after we have done as much work as needed for this next bit
            // now wait for the HIGH
                // cache and use this count so we don't incur another 
                // instruction before we turn the bit high
                cyclesStart = ESP.getCycleCount();
            while ((cyclesStart - cyclesNext) < CYCLES_800);

            // set high
            GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, pinRegister);

            // wait for the LOW
            if (nextBit)
                while ((ESP.getCycleCount() - cyclesStart) < CYCLES_800_T1H);
                while ((ESP.getCycleCount() - cyclesStart) < CYCLES_800_T0H);

            // set low
            GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, pinRegister);

    // while accurate, this isn't needed due to the delays at the 
    // top of Show() to enforce between update timing
    // while ((ESP.getCycleCount() - cyclesStart) < CYCLES_800);