diff options
| author | mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> | 2023-08-10 08:35:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-10 08:35:22 +0100 |
| commit | 9943fcd97d09c2058b6ff278695dab75a2dc8f77 (patch) | |
| tree | e5da5fe7a3672d13dd192946b7b0353dc77e270f /src | |
| parent | 3d7c2dfa4f3305ed80a5a86401e7ef9ed68e8038 (diff) | |
| parent | 9b4926978e223b3d02dc93370a9e36d23669fc55 (diff) | |
Merge pull request #487 from beta-tester/master
minimal optimization and adjustment
Diffstat (limited to 'src')
| -rw-r--r-- | src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp | 6 | ||||
| -rw-r--r-- | src/ESP32-HUB75-MatrixPanel-I2S-DMA.h | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp index c2a725e..85fb055 100644 --- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp +++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp @@ -347,9 +347,9 @@ void IRAM_ATTR MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint16_t x_coord, uint green16 = lumConvTab[green]; blue16 = lumConvTab[blue]; #else - red16 = red << 8; - green16 = green << 8; - blue16 = blue << 8; + red16 = red << 8 | red; + green16 = green << 8 | green; + blue16 = blue << 8 | blue; #endif /* When using the drawPixel, we are obviously only changing the value of one x,y position, diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h index 978715b..4a6e843 100644 --- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h +++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h @@ -880,9 +880,12 @@ private: */ inline void MatrixPanel_I2S_DMA::color565to888(const uint16_t color, uint8_t &r, uint8_t &g, uint8_t &b) { - r = ((((color >> 11) & 0x1F) * 527) + 23) >> 6; - g = ((((color >> 5) & 0x3F) * 259) + 33) >> 6; - b = (((color & 0x1F) * 527) + 23) >> 6; + r = (color >> 8) & 0xf8; + g = (color >> 3) & 0xfc; + b = (color << 3); + r |= r >> 5; + g |= g >> 6; + b |= b >> 5; } inline void MatrixPanel_I2S_DMA::drawPixel(int16_t x, int16_t y, uint16_t color) // adafruit virtual void override |
