diff --git a/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp b/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp index f88d18c..9aeecc7 100644 --- a/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp +++ b/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp @@ -588,18 +588,6 @@ void MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint8_t red, uint8_t green, uint } // colour depth loop (8) } // updateMatrixDMABuffer (full frame paint) -/** - * clear screen to black and reset all service bits - */ -void MatrixPanel_I2S_DMA::clearScreen(){ - clearFrameBuffer(); - brtCtrlOE(brightness); - if (m_cfg.double_buff){ - clearFrameBuffer(1); - brtCtrlOE(brightness, 1); - } -} - /** * @brief - clears and reinitializes color/control data in DMA buffs * When allocated, DMA buffs might be dirtry, so we need to blank it and initialize ABCDE,LAT,OE control bits. diff --git a/ESP32-HUB75-MatrixPanel-I2S-DMA.h b/ESP32-HUB75-MatrixPanel-I2S-DMA.h index 9df1390..cd11b80 100644 --- a/ESP32-HUB75-MatrixPanel-I2S-DMA.h +++ b/ESP32-HUB75-MatrixPanel-I2S-DMA.h @@ -370,7 +370,7 @@ class MatrixPanel_I2S_DMA { // Flush the DMA buffers prior to configuring DMA - Avoid visual artefacts on boot. - clearScreen(); // Must fill the DMA buffer with the initial output bit sequence or the panel will display garbage + resetbuffers(); // Must fill the DMA buffer with the initial output bit sequence or the panel will display garbage // Setup the ESP32 DMA Engine. Sprite_TM built this stuff. configureDMA(m_cfg); //DMA and I2S configuration and setup @@ -398,10 +398,10 @@ class MatrixPanel_I2S_DMA { virtual void fillScreen(uint16_t color); // overwrite adafruit implementation /** - * clears DMA buffers and reinitializes control bits - * to just clear the screen to black fillScreen(0) works faster + * A wrapper to fill the entire Screen with black + * if double buffering is used, than only back buffer is cleared */ - void clearScreen(); + inline void clearScreen(){ updateMatrixDMABuffer(0,0,0); }; #ifndef NO_FAST_FUNCTIONS /** @@ -547,7 +547,7 @@ class MatrixPanel_I2S_DMA { * Stop the ESP32 DMA Engine. Screen will forever be black until next ESP reboot. */ void stopDMAoutput() { - clearScreen(); + resetbuffers(); i2s_parallel_stop_dma(I2S_NUM_1); } @@ -573,6 +573,18 @@ class MatrixPanel_I2S_DMA { /* Update the entire DMA buffer (aka. The RGB Panel) a certain colour (wipe the screen basically) */ void updateMatrixDMABuffer(uint8_t red, uint8_t green, uint8_t blue); + /** + * wipes DMA buffer(s) and reset all color/service bits + */ + inline void resetbuffers(){ + clearFrameBuffer(); + brtCtrlOE(brightness); + if (m_cfg.double_buff){ + clearFrameBuffer(1); + brtCtrlOE(brightness, 1); + } + } + #ifndef NO_FAST_FUNCTIONS /** diff --git a/ESP32-VirtualMatrixPanel-I2S-DMA.h b/ESP32-VirtualMatrixPanel-I2S-DMA.h index 5dee0b4..eba4e95 100644 --- a/ESP32-VirtualMatrixPanel-I2S-DMA.h +++ b/ESP32-VirtualMatrixPanel-I2S-DMA.h @@ -70,7 +70,7 @@ class VirtualMatrixPanel virtual void drawPixel(int16_t x, int16_t y, uint16_t color); virtual void fillScreen(uint16_t color); // overwrite adafruit implementation void clearScreen() { - fillScreen(0); + display->clearScreen(); } //void drawPixelRGB565(int16_t x, int16_t y, uint16_t color); void drawPixelRGB888(int16_t x, int16_t y, uint8_t r, uint8_t g, uint8_t b);