From 5f13a3abffc6e7b6eaeafb5959b3cb2075f1f734 Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Sun, 8 Jan 2023 00:16:29 +0000 Subject: [PATCH] Fix bug with clearScreen() The use of clearFrameBuffer() internally was inadvertently blasting away the 'brightness' information via. the OE toggling. #366 --- src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp | 2 +- src/ESP32-HUB75-MatrixPanel-I2S-DMA.h | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp index 28bdcfb..69368df 100644 --- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp +++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp @@ -454,7 +454,7 @@ void MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint8_t red, uint8_t green, uint * Those control bits are constants during the entire DMA sweep and never changed when updating just pixel colour data * so we could set it once on DMA buffs initialization and forget. * This effectively clears buffers to blank BLACK and makes it ready to display output. - * (Brightness control via OE bit manipulation is another case) + * (Brightness control via OE bit manipulation is another case) - this must be done as well seperately! */ void MatrixPanel_I2S_DMA::clearFrameBuffer(bool _buff_id){ if (!initialized) diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h index 1bc94ba..8175ecc 100644 --- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h +++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h @@ -386,7 +386,7 @@ class MatrixPanel_I2S_DMA { /** * A wrapper to fill whatever selected DMA buffer / screen with black */ - inline void clearScreen(){ startWrite(); clearFrameBuffer(back_buffer_id); endWrite(); /*updateMatrixDMABuffer(0,0,0);*/ }; + inline void clearScreen() { updateMatrixDMABuffer(0,0,0); }; #ifndef NO_FAST_FUNCTIONS /** @@ -491,8 +491,6 @@ class MatrixPanel_I2S_DMA { } /** - * this is just a wrapper to control brightness - * with an 8-bit value (0-255), very popular in FastLED-based sketches :) * @param uint8_t b - 8-bit brightness value */ void setBrightness(const uint8_t b) @@ -532,8 +530,10 @@ class MatrixPanel_I2S_DMA { } */ - // Takes a value between 0-255 now. - void setPanelBrightness(uint8_t b) + /** + * @param uint8_t b - 8-bit brightness value + */ + void setPanelBrightness(const uint8_t b) { setBrightness(b); } @@ -616,8 +616,8 @@ class MatrixPanel_I2S_DMA { * wipes DMA buffer(s) and reset all color/service bits */ inline void resetbuffers(){ + clearFrameBuffer(); - brtCtrlOEv2(brightness, 0); if (m_cfg.double_buff){