aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2021-05-25 19:05:02 +0100
committerGitHub <noreply@github.com>2021-05-25 19:05:02 +0100
commit1d5b3e033fb2e1ef5a9d679de60dc83d3d89e3bf (patch)
treebcd9deb0a96ee3c130994a4be3a64a0697d9f51d
parentf73552b6520df596ba0fd0bb6911e43257590e23 (diff)
parent8ebc5e933a9725cad6577e3c8a09998b6393445b (diff)
Merge pull request #122 from vortigont/newclear
clearScreen() now wipes only color data for current buffer
-rw-r--r--ESP32-HUB75-MatrixPanel-I2S-DMA.cpp12
-rw-r--r--ESP32-HUB75-MatrixPanel-I2S-DMA.h22
-rw-r--r--ESP32-VirtualMatrixPanel-I2S-DMA.h2
3 files changed, 18 insertions, 18 deletions
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
@@ -589,18 +589,6 @@ void MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint8_t red, uint8_t green, uint
} // 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.
* Those control bits are constants during the entire DMA sweep and never changed when updating just pixel color data
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);