HUB75 optimization (double buffer only)
In double duffer mode, the screen is blanked at each show(). So we can drop setPixelColor(BLACK) calls until we receive a pixel with different color.
This commit is contained in:
@@ -503,7 +503,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
|
|||||||
|
|
||||||
_valid = false;
|
_valid = false;
|
||||||
mxconfig.double_buff = false; // default to off, known to cause issue with some effects but needs more memory
|
mxconfig.double_buff = false; // default to off, known to cause issue with some effects but needs more memory
|
||||||
|
isBlack = false;
|
||||||
|
|
||||||
fourScanPanel = nullptr;
|
fourScanPanel = nullptr;
|
||||||
|
|
||||||
@@ -671,6 +671,8 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_valid = true;
|
_valid = true;
|
||||||
|
display->clearScreen(); // initially clear the screen buffer
|
||||||
|
isBlack = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(bc.type) {
|
switch(bc.type) {
|
||||||
@@ -700,6 +702,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
|
|||||||
|
|
||||||
void __attribute__((hot)) BusHub75Matrix::setPixelColor(uint16_t pix, uint32_t c) {
|
void __attribute__((hot)) BusHub75Matrix::setPixelColor(uint16_t pix, uint32_t c) {
|
||||||
if (!_valid || pix >= _len) return;
|
if (!_valid || pix >= _len) return;
|
||||||
|
if (isBlack && (c == BLACK)) return; // reject black pixels directly after clearScreen()
|
||||||
#ifndef NO_CIE1931
|
#ifndef NO_CIE1931
|
||||||
c = unGamma24(c); // to use the driver linear brightness feature, we first need to undo WLED gamma correction
|
c = unGamma24(c); // to use the driver linear brightness feature, we first need to undo WLED gamma correction
|
||||||
#endif
|
#endif
|
||||||
@@ -719,6 +722,7 @@ void __attribute__((hot)) BusHub75Matrix::setPixelColor(uint16_t pix, uint32_t
|
|||||||
int y = pix / pxwidth;
|
int y = pix / pxwidth;
|
||||||
display->drawPixelRGB888(int16_t(x), int16_t(y), r, g, b);
|
display->drawPixelRGB888(int16_t(x), int16_t(y), r, g, b);
|
||||||
}
|
}
|
||||||
|
isBlack = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BusHub75Matrix::setBrightness(uint8_t b, bool immediate) {
|
void BusHub75Matrix::setBrightness(uint8_t b, bool immediate) {
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ class BusHub75Matrix : public Bus {
|
|||||||
display->flipDMABuffer(); // Show the back buffer, set currently output buffer to the back (i.e. no longer being sent to LED panels)
|
display->flipDMABuffer(); // Show the back buffer, set currently output buffer to the back (i.e. no longer being sent to LED panels)
|
||||||
// while(!previousBufferFree) delay(1); // experimental - Wait before we allow any writing to the buffer. Stop flicker.
|
// while(!previousBufferFree) delay(1); // experimental - Wait before we allow any writing to the buffer. Stop flicker.
|
||||||
display->clearScreen(); // Now clear the back-buffer
|
display->clearScreen(); // Now clear the back-buffer
|
||||||
|
isBlack = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,6 +370,7 @@ class BusHub75Matrix : public Bus {
|
|||||||
// delete fourScanPanel;
|
// delete fourScanPanel;
|
||||||
delete display;
|
delete display;
|
||||||
_valid = false;
|
_valid = false;
|
||||||
|
isBlack = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
~BusHub75Matrix() {
|
~BusHub75Matrix() {
|
||||||
@@ -379,6 +381,7 @@ class BusHub75Matrix : public Bus {
|
|||||||
MatrixPanel_I2S_DMA *display = nullptr;
|
MatrixPanel_I2S_DMA *display = nullptr;
|
||||||
VirtualMatrixPanel *fourScanPanel = nullptr;
|
VirtualMatrixPanel *fourScanPanel = nullptr;
|
||||||
HUB75_I2S_CFG mxconfig;
|
HUB75_I2S_CFG mxconfig;
|
||||||
|
bool isBlack = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user