diff options
| author | mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> | 2023-01-21 11:23:05 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-21 11:23:05 +0000 |
| commit | ff5d69a4fdc82bb23cac45188d115edec7e0ae7f (patch) | |
| tree | 15af8d96198345a8a323c8f51a0ef7a5b113e92d /src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp | |
| parent | 6687ee7d8255d9762df0747b568951b53a06e6dd (diff) | |
| parent | 655b198a78ef1cb2119891b0944964dcc8d68a76 (diff) | |
Merge pull request #376 from Kouzeru/master
Add Hue Spectrum Example
Diffstat (limited to 'src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp')
| -rw-r--r-- | src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp index 383643e..2bb4da0 100644 --- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp +++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp @@ -705,7 +705,20 @@ void MatrixPanel_I2S_DMA::brtCtrlOEv2(uint8_t brt, const int _buff_id) { // let's set OE control bits for specific pixels in each color_index subrows uint8_t colouridx = dma_buff.rowBits[row_idx]->colour_depth; do { - int brightness_in_x_pixels = PIXELS_PER_ROW * brt >> 8 + max( ( dma_buff.rowBits[row_idx]->colour_depth - colouridx - 2 ), 0); + // Multiply brightness according to index of bitplane (color index subrow) + // in respect of accumulating LED intensities with Binary-Coded Modulation: + // bitplane 0 is 1/1 of total brightness; bitplane 1 is 1/2; bitplane 2 is 1/4, etc + // accumulating all of them together means we will get only ~1/4 of the total brightness. + + // During the DMA, assume bitplane 0 shown for 4 subrows; bitplane 1 shown for 2 subrows; + // bitplane 2 and the rest shown for one subrow, would give us ~2/3 of the total brightness, + // which is good balance for the depth, brightness, while the flickers still less noticeable: + // row 0 (blanking)\ row 1 (blanking)\ row 2 (blanking)\ .. + // bitplane : ... 0 0 0 0 1 1 2 3 4 5 6 7 \- 0 0 0 0 1 1 2 3 4 5 6 7 \- 0 0 0 0 1 1 2 3 4 5 6 7 \- .. + // rightshift: ... 0 0 0 0 0 0 0 1 2 3 4 5 -\ 0 0 0 0 0 0 0 1 2 3 4 5 -\ 0 0 0 0 0 0 0 1 2 3 4 5 -\ .. + char bitplane = dma_buff.rowBits[row_idx]->colour_depth-colouridx; + char rightshift = std::max(bitplane-2,0); + int brightness_in_x_pixels = PIXELS_PER_ROW * brt >> 8 + rightshift; --colouridx; // switch pointer to a row for a specific color index |
