If you recall my earlier post on the code for handling WS2812B LEDs with an ESP-12 or similar – I’ve been discovering the odd flicker on the first LED – recall I lengthened the reset pulse to get rid of this – well, I was still getting it very occasionally during a long fade of the lights. I’ve lengthened the reset pulse and it has now completely gone (see code in bold). Enjoy.
void ICACHE_FLASH_ATTR WS2812OutBuffer(uint8_t * buffer, uint16_t length, uint16_t repetition) {
uint16_t i;
os_intr_lock();
for (i = 0; i < 4; i++)
WRITE_PERI_REG(PERIPHS_GPIO_BASEADDR + 8, rainb12);
while (repetition–) {
for (i = 0; i < length; i++) {
uint8_t mask = 0x80;
uint8_t byte = buffer[i];
while (mask) {
(byte & mask) ? SEND_WS_12_1() : SEND_WS_12_0();
mask >>= 1;
}
}
}
os_intr_unlock();
}
If the voltage at the pixel drops too low it can cause such flicker. To avoid these issues, you may find that you will need to “insert” power. You would cut the strip and then just jump the DATA line across and add a new set of POWER and GROUND wires running back to your power supply.
Well now isn’t that funny. After all this time – I started to get issues even though I was using new code (assembly NOOPS) to get the timing more accurate… I was looking around the web to see if anyone else had the same issue – the first LED flashing green when fading or changing colours….. and I stumbled on my own blog. I took the two functions SEND_WS_0 and SEND_WS_1 out of FLASH and the problem magically disappeared – reliably up to now…
i also noticed a few issues with mine when i had the SEND_WS_0 and SEND_WS_1 in the flash. I moved them out of the flash (so they dont have to load from there every time they run) and the timings are excellent now
That’s interesting as mine are still in Flash and I’m getting no issues after I stretched that reset pulse a little. I’m sitting here now with an array of 70 leds changing colours etc… worth noting in case others have issues however.