Fix bug with clearScreen()

The use of clearFrameBuffer() internally was inadvertently blasting away the 'brightness' information via. the OE toggling. #366
This commit is contained in:
mrfaptastic 2023-01-08 00:16:29 +00:00
parent 9ca210d3ac
commit 5f13a3abff
2 changed files with 7 additions and 7 deletions

View file

@ -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 * 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. * 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. * 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){ void MatrixPanel_I2S_DMA::clearFrameBuffer(bool _buff_id){
if (!initialized) if (!initialized)

View file

@ -386,7 +386,7 @@ class MatrixPanel_I2S_DMA {
/** /**
* A wrapper to fill whatever selected DMA buffer / screen with black * 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 #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 * @param uint8_t b - 8-bit brightness value
*/ */
void setBrightness(const uint8_t b) 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); setBrightness(b);
} }
@ -616,8 +616,8 @@ class MatrixPanel_I2S_DMA {
* wipes DMA buffer(s) and reset all color/service bits * wipes DMA buffer(s) and reset all color/service bits
*/ */
inline void resetbuffers(){ inline void resetbuffers(){
clearFrameBuffer(); clearFrameBuffer();
brtCtrlOEv2(brightness, 0); brtCtrlOEv2(brightness, 0);
if (m_cfg.double_buff){ if (m_cfg.double_buff){