Skip to content

Commit

Permalink
clearScreen() now wipes only color data for current buffer
Browse files Browse the repository at this point in the history
Signed-off-by: Emil Muratov <[email protected]>
  • Loading branch information
vortigont committed May 21, 2021
1 parent f73552b commit 8ebc5e9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
12 changes: 0 additions & 12 deletions ESP32-HUB75-MatrixPanel-I2S-DMA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 17 additions & 5 deletions ESP32-HUB75-MatrixPanel-I2S-DMA.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
/**
Expand Down Expand Up @@ -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);
}

Expand All @@ -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
/**
Expand Down
2 changes: 1 addition & 1 deletion ESP32-VirtualMatrixPanel-I2S-DMA.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8ebc5e9

Please sign in to comment.