Remove PSRAM use from global LED buffer.

This commit is contained in:
Blaz Kristan 2023-05-21 18:37:18 +02:00
parent e4a9f115cb
commit bffeec1615

View File

@ -199,13 +199,12 @@ void Segment::setUpLeds() {
#else #else
leds = &Segment::_globalLeds[start]; leds = &Segment::_globalLeds[start];
#endif #endif
else if (leds == nullptr) { else if (leds == nullptr && length() > 0) { //softhack007 quickfix - avoid malloc(0) which is undefined behaviour (should not happen, but i've seen it)
//#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM) //#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM)
//if (psramFound()) //if (psramFound())
// leds = (CRGB*)ps_malloc(sizeof(CRGB)*length()); // softhack007 disabled; putting leds into psram leads to horrible slowdown on WROVER boards // leds = (CRGB*)ps_malloc(sizeof(CRGB)*length()); // softhack007 disabled; putting leds into psram leads to horrible slowdown on WROVER boards
//else //else
//#endif //#endif
if (length() > 0) //softhack007 quickfix - avoid malloc(0) which is undefined behaviour (should not happen, but i've seen it)
leds = (CRGB*)malloc(sizeof(CRGB)*length()); leds = (CRGB*)malloc(sizeof(CRGB)*length());
} }
} }
@ -1070,11 +1069,12 @@ void WS2812FX::finalizeInit(void)
} }
if (useLedsArray) { if (useLedsArray) {
size_t arrSize = sizeof(CRGB) * getLengthTotal(); size_t arrSize = sizeof(CRGB) * getLengthTotal();
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM) // softhack007 disabled; putting leds into psram leads to horrible slowdown on WROVER boards (see setUpLeds())
if (psramFound()) //#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM)
Segment::_globalLeds = (CRGB*) ps_malloc(arrSize); //if (psramFound())
else // Segment::_globalLeds = (CRGB*) ps_malloc(arrSize);
#endif //else
//#endif
Segment::_globalLeds = (CRGB*) malloc(arrSize); Segment::_globalLeds = (CRGB*) malloc(arrSize);
memset(Segment::_globalLeds, 0, arrSize); memset(Segment::_globalLeds, 0, arrSize);
} }