HUB75 trying to reduce glitches
the HUB75 driver seems to randomly produce glitches, especially on hight contrast edges. * roll back to HUB75 version 3.0.10 (known good) * limit max brightness to 238 (=92%) * add short delay after starting the driver
This commit is contained in:
@@ -1038,7 +1038,8 @@ HUB75_build_flags =
|
|||||||
-D S3_LCD_DIV_NUM=20 ;; Attempt to fix wifi performance issue when panel active with S3 chips
|
-D S3_LCD_DIV_NUM=20 ;; Attempt to fix wifi performance issue when panel active with S3 chips
|
||||||
;; HUB75_lib_deps = https://github.com/mrcodetastic/ESP32-HUB75-MatrixPanel-DMA.git @ 3.0.11 ;; breaks the build (2024-07-30)
|
;; HUB75_lib_deps = https://github.com/mrcodetastic/ESP32-HUB75-MatrixPanel-DMA.git @ 3.0.11 ;; breaks the build (2024-07-30)
|
||||||
;; HUB75_lib_deps = https://github.com/mrcodetastic/ESP32-HUB75-MatrixPanel-DMA.git#1e4c80a26454aca7b8129bd5a966b0af329d2703 ;; 3.0.10 - something strange is going on here ...
|
;; HUB75_lib_deps = https://github.com/mrcodetastic/ESP32-HUB75-MatrixPanel-DMA.git#1e4c80a26454aca7b8129bd5a966b0af329d2703 ;; 3.0.10 - something strange is going on here ...
|
||||||
HUB75_lib_deps = https://github.com/mrcodetastic/ESP32-HUB75-MatrixPanel-DMA.git#c4ecdcfeeb5aa668d92ddf3c3c74bc93316f6e10 ;; 3.0.11
|
HUB75_lib_deps = https://github.com/mrcodetastic/ESP32-HUB75-MatrixPanel-DMA.git#1e4c80a26454aca7b8129bd5a966b0af329d2703 ;; 3.0.10 - something strange is going on here ...
|
||||||
|
;; HUB75_lib_deps = https://github.com/mrcodetastic/ESP32-HUB75-MatrixPanel-DMA.git#c4ecdcfeeb5aa668d92ddf3c3c74bc93316f6e10 ;; 3.0.11
|
||||||
HUB75_lib_ignore = ESP32 HUB75 LED MATRIX PANEL DMA Display ;; to remove the HUB75 lib dependancy (saves a few bytes)
|
HUB75_lib_ignore = ESP32 HUB75 LED MATRIX PANEL DMA Display ;; to remove the HUB75 lib dependancy (saves a few bytes)
|
||||||
|
|
||||||
NetDebug_build_flags =
|
NetDebug_build_flags =
|
||||||
|
|||||||
@@ -685,17 +685,18 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
|
|||||||
USER_PRINTLN("MatrixPanel_I2S_DMA created");
|
USER_PRINTLN("MatrixPanel_I2S_DMA created");
|
||||||
// let's adjust default brightness
|
// let's adjust default brightness
|
||||||
display->setBrightness8(25); // range is 0-255, 0 - 0%, 255 - 100%
|
display->setBrightness8(25); // range is 0-255, 0 - 0%, 255 - 100%
|
||||||
|
_bri = 25;
|
||||||
|
|
||||||
|
delay(24); // experimental
|
||||||
// Allocate memory and start DMA display
|
// Allocate memory and start DMA display
|
||||||
if( not display->begin() ) {
|
if( not display->begin() ) {
|
||||||
USER_PRINTLN("****** MatrixPanel_I2S_DMA !KABOOM! I2S memory allocation failed ***********");
|
USER_PRINTLN("****** MatrixPanel_I2S_DMA !KABOOM! I2S memory allocation failed ***********");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
delay(18); // experiment - give the driver a moment (~ one full frame @ 60hz) to settle
|
||||||
_valid = true;
|
_valid = true;
|
||||||
display->clearScreen(); // initially clear the screen buffer
|
display->clearScreen(); // initially clear the screen buffer
|
||||||
display->setBrightness8(127); // range is 0-255, 0 - 0%, 255 - 100%
|
|
||||||
_bri = 127;
|
|
||||||
|
|
||||||
if (_ledBuffer) free(_ledBuffer); // should not happen
|
if (_ledBuffer) free(_ledBuffer); // should not happen
|
||||||
if (_ledsDirty) free(_ledsDirty); // should not happen
|
if (_ledsDirty) free(_ledsDirty); // should not happen
|
||||||
@@ -736,8 +737,12 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_valid) {
|
||||||
|
_panelWidth = fourScanPanel ? fourScanPanel->width() : display->width(); // cache width - it will never change
|
||||||
|
}
|
||||||
|
|
||||||
USER_PRINT(F("MatrixPanel_I2S_DMA "));
|
USER_PRINT(F("MatrixPanel_I2S_DMA "));
|
||||||
USER_PRINTF("%sstarted.\n", _valid? "":"not ");
|
USER_PRINTF("%sstarted, width=%u, %u pixels.\n", _valid? "":"not ", _panelWidth, _len);
|
||||||
|
|
||||||
if (mxconfig.double_buff == true) USER_PRINTLN(F("MatrixPanel_I2S_DMA driver native double-buffering enabled."));
|
if (mxconfig.double_buff == true) USER_PRINTLN(F("MatrixPanel_I2S_DMA driver native double-buffering enabled."));
|
||||||
if (_ledBuffer != nullptr) USER_PRINTLN(F("MatrixPanel_I2S_DMA LEDS buffer enabled."));
|
if (_ledBuffer != nullptr) USER_PRINTLN(F("MatrixPanel_I2S_DMA LEDS buffer enabled."));
|
||||||
@@ -772,12 +777,12 @@ void __attribute__((hot)) BusHub75Matrix::setPixelColor(uint16_t pix, uint32_t c
|
|||||||
uint8_t b = B(c);
|
uint8_t b = B(c);
|
||||||
|
|
||||||
if(fourScanPanel != nullptr) {
|
if(fourScanPanel != nullptr) {
|
||||||
unsigned width = fourScanPanel->width();
|
int width = _panelWidth;
|
||||||
int x = pix % width;
|
int x = pix % width;
|
||||||
int y = pix / width;
|
int y = pix / width;
|
||||||
fourScanPanel->drawPixelRGB888(int16_t(x), int16_t(y), r, g, b);
|
fourScanPanel->drawPixelRGB888(int16_t(x), int16_t(y), r, g, b);
|
||||||
} else {
|
} else {
|
||||||
unsigned width = display->width();
|
int width = _panelWidth;
|
||||||
int x = pix % width;
|
int x = pix % width;
|
||||||
int y = pix / width;
|
int y = pix / width;
|
||||||
display->drawPixelRGB888(int16_t(x), int16_t(y), r, g, b);
|
display->drawPixelRGB888(int16_t(x), int16_t(y), r, g, b);
|
||||||
@@ -794,16 +799,19 @@ uint32_t BusHub75Matrix::getPixelColor(uint16_t pix) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BusHub75Matrix::setBrightness(uint8_t b, bool immediate) {
|
void BusHub75Matrix::setBrightness(uint8_t b, bool immediate) {
|
||||||
this->display->setBrightness(b);
|
|
||||||
_bri = b;
|
_bri = b;
|
||||||
|
if (_bri > 238) _bri=238;
|
||||||
|
display->setBrightness(_bri);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((hot)) BusHub75Matrix::show(void) {
|
void __attribute__((hot)) BusHub75Matrix::show(void) {
|
||||||
if (!_valid) return;
|
if (!_valid) return;
|
||||||
|
display->setBrightness(_bri);
|
||||||
|
|
||||||
if (_ledBuffer) {
|
if (_ledBuffer) {
|
||||||
// write out buffered LEDs
|
// write out buffered LEDs
|
||||||
bool isFourScan = (fourScanPanel != nullptr);
|
bool isFourScan = (fourScanPanel != nullptr);
|
||||||
unsigned width = isFourScan ? fourScanPanel->width() : display->width();
|
//if (isFourScan) fourScanPanel->setRotation(0);
|
||||||
unsigned height = isFourScan ? fourScanPanel->height() : display->height();
|
unsigned height = isFourScan ? fourScanPanel->height() : display->height();
|
||||||
|
|
||||||
//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.
|
||||||
@@ -837,6 +845,7 @@ void __attribute__((hot)) BusHub75Matrix::show(void) {
|
|||||||
void BusHub75Matrix::cleanup() {
|
void BusHub75Matrix::cleanup() {
|
||||||
if (display && _valid) display->stopDMAoutput(); // terminate DMA driver (display goes black)
|
if (display && _valid) display->stopDMAoutput(); // terminate DMA driver (display goes black)
|
||||||
_valid = false;
|
_valid = false;
|
||||||
|
_panelWidth = 0;
|
||||||
deallocatePins();
|
deallocatePins();
|
||||||
USER_PRINTLN("HUB75 output ended.");
|
USER_PRINTLN("HUB75 output ended.");
|
||||||
|
|
||||||
|
|||||||
@@ -389,6 +389,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;
|
||||||
|
unsigned _panelWidth = 0;
|
||||||
CRGB *_ledBuffer = nullptr;
|
CRGB *_ledBuffer = nullptr;
|
||||||
byte *_ledsDirty = nullptr;
|
byte *_ledsDirty = nullptr;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user