aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2021-06-24 19:38:14 +0100
committerGitHub <noreply@github.com>2021-06-24 19:38:14 +0100
commitd02eaa7ea57abd2ce0c2f16783a3f1533632d346 (patch)
tree66f3cdf961377149a20b8c8ec41e72f134af3ad0
parentc049fc8b7e4c377022ae94e1778cc21337366ebf (diff)
parent2c3919ffcf103758ce4a52e892c7960a43944e75 (diff)
Merge pull request #139 from mrfaptastic/donnersm
Fix noise if brightness too high.
-rw-r--r--ESP32-HUB75-MatrixPanel-I2S-DMA.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp b/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp
index fd31f73..c21d2a1 100644
--- a/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp
+++ b/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp
@@ -637,6 +637,7 @@ void MatrixPanel_I2S_DMA::clearFrameBuffer(bool _buff_id){
// drive latch while shifting out last bit of RGB data
row[dma_buff.rowBits[row_idx]->width - 2] |= BIT_LAT; // -1 pixel to compensate array index starting at 0
+ row[dma_buff.rowBits[row_idx]->width - 1] |= BIT_LAT; // -1 pixel to compensate array index starting at 0
// need to disable OE before/after latch to hide row transition
// Should be one clock or more before latch, otherwise can get ghosting
@@ -661,8 +662,8 @@ void MatrixPanel_I2S_DMA::brtCtrlOE(int brt, const bool _buff_id){
if (!initialized)
return;
- if (brt > PIXELS_PER_ROW - m_cfg.latch_blanking) // can't control values larger than (row_width - latch_blanking) to avoid ongoing issues being raised about brightness and ghosting.
- brt = PIXELS_PER_ROW - m_cfg.latch_blanking;
+ if (brt > PIXELS_PER_ROW - (MAX_LAT_BLANKING + 2)) // can't control values larger than (row_width - latch_blanking) to avoid ongoing issues being raised about brightness and ghosting.
+ brt = PIXELS_PER_ROW - (MAX_LAT_BLANKING + 2); // +2 for a bit of buffer...
if (brt < 0)
brt = 0;
@@ -686,16 +687,16 @@ void MatrixPanel_I2S_DMA::brtCtrlOE(int brt, const bool _buff_id){
// Brightness control via OE toggle - disable matrix output at specified x_coord
if((coloridx > lsbMsbTransitionBit || !coloridx) && ((x_coord) >= brt)){
- row[x_coord] |= BIT_OE; continue; // For Brightness control
+ row[x_coord] |= BIT_OE; // Disable output after this point.
+ continue;
}
// special case for the bits *after* LSB through (lsbMsbTransitionBit) - OE is output after data is shifted, so need to set OE to fractional brightness
if(coloridx && coloridx <= lsbMsbTransitionBit) {
// divide brightness in half for each bit below lsbMsbTransitionBit
int lsbBrightness = brt >> (lsbMsbTransitionBit - coloridx + 1);
if((x_coord) >= lsbBrightness)
- row[x_coord] |= BIT_OE; // For Brightness
-
- continue;
+ row[x_coord] |= BIT_OE; // Disable output after this point.
+ continue;
}
// clear OE bit for all other pixels