diff --git a/ESP32-RGB64x32MatrixPanel-I2S-DMA.cpp b/ESP32-RGB64x32MatrixPanel-I2S-DMA.cpp index 4666967..286cab1 100644 --- a/ESP32-RGB64x32MatrixPanel-I2S-DMA.cpp +++ b/ESP32-RGB64x32MatrixPanel-I2S-DMA.cpp @@ -269,6 +269,8 @@ bool RGB64x32MatrixPanel_I2S_DMA::allocateDMAmemory() delay(1000); #endif + // Just os we know + everything_OK = true; return true; @@ -389,16 +391,12 @@ void RGB64x32MatrixPanel_I2S_DMA::configureDMA(int r1_pin, int g1_pin, int b1_ delay(1000); #endif - - // Just os we know - everything_OK = true; - + } // end initMatrixDMABuff - /* Update a specific co-ordinate in the DMA buffer */ void RGB64x32MatrixPanel_I2S_DMA::updateMatrixDMABuffer(int16_t x_coord, int16_t y_coord, uint8_t red, uint8_t green, uint8_t blue) { diff --git a/ESP32-RGB64x32MatrixPanel-I2S-DMA.h b/ESP32-RGB64x32MatrixPanel-I2S-DMA.h index 28ffbda..539a312 100644 --- a/ESP32-RGB64x32MatrixPanel-I2S-DMA.h +++ b/ESP32-RGB64x32MatrixPanel-I2S-DMA.h @@ -249,6 +249,9 @@ class RGB64x32MatrixPanel_I2S_DMA : public GFX { #if SERIAL_DEBUG Serial.printf("Set back buffer to: %d\n", back_buffer_id); #endif + + // Wait before we allow any writing to the buffer. Stop flicker. + while(!i2s_parallel_is_previous_buffer_free()) {} } inline void showDMABuffer() @@ -261,6 +264,9 @@ class RGB64x32MatrixPanel_I2S_DMA : public GFX { #endif i2s_parallel_flip_to_buffer(&I2S1, back_buffer_id); + + // Wait before we allow any writing to the buffer. Stop flicker. + while(!i2s_parallel_is_previous_buffer_free()) {} }