Free after we wait (#148)

Dont free the memory while it may still being used.
This commit is contained in:
Michael Miller
2016-12-28 12:25:17 -08:00
committed by GitHub
parent 5b48c48551
commit 033fbe68c0

View File

@@ -63,14 +63,14 @@ NeoEsp8266Uart::NeoEsp8266Uart(uint16_t pixelCount, size_t elementSize)
NeoEsp8266Uart::~NeoEsp8266Uart()
{
free(_pixels);
// Wait until the TX fifo is empty. This way we avoid broken frames
// when destroying & creating a NeoPixelBus to change its length.
while (getUartTxFifoLength() > 0)
{
yield();
}
free(_pixels);
}
void NeoEsp8266Uart::InitializeUart(uint32_t uartBaud)