Skip to content

Commit 2593b11

Browse files
authored
Merge pull request wled#4950 from netmindz/HUB75-AC-Fixes
Hub75 fixes
2 parents e7652e3 + 77f3426 commit 2593b11

File tree

3 files changed

+24
-28
lines changed

3 files changed

+24
-28
lines changed

platformio_override.sample.ini

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,9 @@ platform_packages =
549549
build_unflags = ${common.build_unflags}
550550
build_flags = ${common.build_flags}
551551
-D WLED_RELEASE_NAME=\"ESP32_hub75\"
552-
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX -D NO_CIE1931
553-
; -D ESP32_FORUM_PINOUT ;; enable for SmartMatrix default pins
552+
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX
553+
-D LED_TYPES=65 -D DATA_PINS=64,64,1
554+
-D WLED_DEBUG_BUS
554555
; -D WLED_DEBUG
555556
lib_deps = ${esp32_idf_V4.lib_deps}
556557
https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git#3.0.11
@@ -563,11 +564,14 @@ board_build.flash_mode = dio
563564
extends = env:esp32dev_hub75
564565
build_flags = ${common.build_flags}
565566
-D WLED_RELEASE_NAME=\"ESP32_hub75_forum_pinout\"
566-
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX -D NO_CIE1931
567+
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX
567568
-D ESP32_FORUM_PINOUT ;; enable for SmartMatrix default pins
569+
-D LED_TYPES=65 -D DATA_PINS=64,64,1
570+
-D WLED_DEBUG_BUS
568571
; -D WLED_DEBUG
569572

570573

574+
571575
[env:adafruit_matrixportal_esp32s3]
572576
; ESP32-S3 processor, 8 MB flash, 2 MB of PSRAM, dedicated driver pins for HUB75
573577
board = adafruit_matrixportal_esp32s3
@@ -581,9 +585,12 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=
581585
-DLOLIN_WIFI_FIX ; seems to work much better with this
582586
-D WLED_WATCHDOG_TIMEOUT=0
583587
${esp32.AR_build_flags}
584-
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX -D NO_CIE1931
588+
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX
585589
-D S3_LCD_DIV_NUM=20 ;; Attempt to fix wifi performance issue when panel active with S3 chips
586590
-D ARDUINO_ADAFRUIT_MATRIXPORTAL_ESP32S3
591+
-D LED_TYPES=65 -D DATA_PINS=64,64,1
592+
-D WLED_DEBUG_BUS
593+
587594

588595
lib_deps = ${esp32s3.lib_deps}
589596
${esp32.AR_lib_deps}
@@ -607,9 +614,11 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=
607614
-DLOLIN_WIFI_FIX ; seems to work much better with this
608615
-D WLED_WATCHDOG_TIMEOUT=0
609616
${esp32.AR_build_flags}
610-
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX -D NO_CIE1931
617+
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX
611618
-D S3_LCD_DIV_NUM=20 ;; Attempt to fix wifi performance issue when panel active with S3 chips
612619
-D MOONHUB_S3_PINOUT ;; HUB75 pinout
620+
-D LED_TYPES=65 -D DATA_PINS=64,64,1
621+
-D WLED_DEBUG_BUS
613622

614623
lib_deps = ${esp32s3.lib_deps}
615624
${esp32.AR_lib_deps}

wled00/bus_manager.cpp

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -812,14 +812,15 @@ BusHub75Matrix::BusHub75Matrix(const BusConfig &bc) : Bus(bc.type, bc.start, bc.
812812
virtualDisp = nullptr;
813813

814814
if (bc.type == TYPE_HUB75MATRIX_HS) {
815-
mxconfig.mx_width = min((u_int8_t) 64, bc.pins[0]);
816-
mxconfig.mx_height = min((u_int8_t) 64, bc.pins[1]);
817-
if(bc.pins[2] > 1 && bc.pins[3] > 0 && bc.pins[4]) {
818-
virtualDisp = new VirtualMatrixPanel((*display), bc.pins[3], bc.pins[4], mxconfig.mx_width, mxconfig.mx_height, CHAIN_BOTTOM_LEFT_UP);
819-
}
815+
mxconfig.mx_width = min((uint8_t) 64, bc.pins[0]);
816+
mxconfig.mx_height = min((uint8_t) 64, bc.pins[1]);
817+
// Disable chains of panels for now, incomplete UI changes
818+
// if(bc.pins[2] > 1 && bc.pins[3] != 0 && bc.pins[4] != 0 && bc.pins[3] != 255 && bc.pins[4] != 255) {
819+
// virtualDisp = new VirtualMatrixPanel((*display), bc.pins[3], bc.pins[4], mxconfig.mx_width, mxconfig.mx_height, CHAIN_BOTTOM_LEFT_UP);
820+
// }
820821
} else if (bc.type == TYPE_HUB75MATRIX_QS) {
821-
mxconfig.mx_width = min((u_int8_t) 64, bc.pins[0]) * 2;
822-
mxconfig.mx_height = min((u_int8_t) 64, bc.pins[1]) / 2;
822+
mxconfig.mx_width = min((uint8_t) 64, bc.pins[0]) * 2;
823+
mxconfig.mx_height = min((uint8_t) 64, bc.pins[1]) / 2;
823824
virtualDisp = new VirtualMatrixPanel((*display), 1, 1, bc.pins[0], bc.pins[1]);
824825
virtualDisp->setRotation(0);
825826
switch(bc.pins[1]) {
@@ -849,7 +850,7 @@ BusHub75Matrix::BusHub75Matrix(const BusConfig &bc) : Bus(bc.type, bc.start, bc.
849850
} else mxconfig.setPixelColorDepthBits(8);
850851
#endif
851852

852-
mxconfig.chain_length = max((u_int8_t) 1, min(bc.pins[2], (u_int8_t) 4)); // prevent bad data preventing boot due to low memory
853+
mxconfig.chain_length = max((uint8_t) 1, min(bc.pins[2], (uint8_t) 4)); // prevent bad data preventing boot due to low memory
853854

854855
if(mxconfig.mx_height >= 64 && (mxconfig.chain_length > 1)) {
855856
DEBUGBUS_PRINTLN("WARNING, only single panel can be used of 64 pixel boards due to memory");
@@ -996,7 +997,6 @@ BusHub75Matrix::BusHub75Matrix(const BusConfig &bc) : Bus(bc.type, bc.start, bc.
996997
DEBUGBUS_PRINT(F("MatrixPanel_I2S_DMA "));
997998
DEBUGBUS_PRINTF("%sstarted, width=%u, %u pixels.\n", _valid? "":"not ", _panelWidth, _len);
998999

999-
if (mxconfig.double_buff == true) DEBUGBUS_PRINTLN(F("MatrixPanel_I2S_DMA driver native double-buffering enabled."));
10001000
if (_ledBuffer != nullptr) DEBUGBUS_PRINTLN(F("MatrixPanel_I2S_DMA LEDS buffer enabled."));
10011001
if (_ledsDirty != nullptr) DEBUGBUS_PRINTLN(F("MatrixPanel_I2S_DMA LEDS dirty bit optimization enabled."));
10021002
if ((_ledBuffer != nullptr) || (_ledsDirty != nullptr)) {
@@ -1021,9 +1021,6 @@ void __attribute__((hot)) BusHub75Matrix::setPixelColor(unsigned pix, uint32_t c
10211021
if ((c == IS_BLACK) && (getBitFromArray(_ledsDirty, pix) == false)) return; // ignore black if pixel is already black
10221022
setBitInArray(_ledsDirty, pix, c != IS_BLACK); // dirty = true means "color is not BLACK"
10231023

1024-
#ifndef NO_CIE1931
1025-
c = unGamma24(c); // to use the driver linear brightness feature, we first need to undo WLED gamma correction
1026-
#endif
10271024
uint8_t r = R(c);
10281025
uint8_t g = G(c);
10291026
uint8_t b = B(c);
@@ -1069,9 +1066,6 @@ void BusHub75Matrix::show(void) {
10691066
for (int y=0; y<height; y++) for (int x=0; x<width; x++) {
10701067
if (getBitFromArray(_ledsDirty, pix) == true) { // only repaint the "dirty" pixels
10711068
uint32_t c = uint32_t(_ledBuffer[pix]) & 0x00FFFFFF; // get RGB color, removing FastLED "alpha" component
1072-
#ifndef NO_CIE1931
1073-
c = unGamma24(c); // to use the driver linear brightness feature, we first need to undo WLED gamma correction
1074-
#endif
10751069
uint8_t r = R(c);
10761070
uint8_t g = G(c);
10771071
uint8_t b = B(c);
@@ -1082,13 +1076,6 @@ void BusHub75Matrix::show(void) {
10821076
}
10831077
setBitArray(_ledsDirty, _len, false); // buffer shown - reset all dirty bits
10841078
}
1085-
1086-
if(mxconfig.double_buff) {
1087-
display->flipDMABuffer(); // Show the back buffer, set current output buffer to the back (i.e. no longer being sent to LED panels)
1088-
// while(!previousBufferFree) delay(1); // experimental - Wait before we allow any writing to the buffer. Stop flicker.
1089-
display->clearScreen(); // Now clear the back-buffer
1090-
setBitArray(_ledsDirty, _len, false); // dislay buffer is blank - reset all dirty bits
1091-
}
10921079
}
10931080

10941081
void BusHub75Matrix::cleanup() {

wled00/bus_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class Bus {
165165
inline bool containsPixel(uint16_t pix) const { return pix >= _start && pix < _start + _len; }
166166

167167
static inline std::vector<LEDType> getLEDTypes() { return {{TYPE_NONE, "", PSTR("None")}}; } // not used. just for reference for derived classes
168-
static constexpr size_t getNumberOfPins(uint8_t type) { return isVirtual(type) ? 4 : isPWM(type) ? numPWMPins(type) : is2Pin(type) + 1; } // credit @PaoloTK
168+
static constexpr size_t getNumberOfPins(uint8_t type) { return isVirtual(type) ? 4 : isPWM(type) ? numPWMPins(type) : isHub75(type) ? 3 : is2Pin(type) + 1; } // credit @PaoloTK
169169
static constexpr size_t getNumberOfChannels(uint8_t type) { return hasWhite(type) + 3*hasRGB(type) + hasCCT(type); }
170170
static constexpr bool hasRGB(uint8_t type) {
171171
return !((type >= TYPE_WS2812_1CH && type <= TYPE_WS2812_WWA) || type == TYPE_ANALOG_1CH || type == TYPE_ANALOG_2CH || type == TYPE_ONOFF);

0 commit comments

Comments
 (0)