no effect data limits for PSRAM boards (upstream backport)

This commit is contained in:
Frank
2025-12-17 01:19:24 +01:00
parent 87fc226213
commit 5849e02e23

View File

@@ -230,6 +230,9 @@ bool Segment::allocateData(size_t len, bool allowOverdraft) { // WLEDMM allowOv
//DEBUG_PRINTF("allocateData(%u) start %d, stop %d, vlen %d\n", len, start, stop, virtualLength());
deallocateData();
if (len == 0) return false; // nothing to do
// limit to MAX_SEGMENT_DATA if there is no PSRAM, otherwise prefer functionality over speed
#ifndef BOARD_HAS_PSRAM
if (Segment::getUsedSegmentData() + len > MAX_SEGMENT_DATA) {
if (!allowOverdraft || (Segment::getUsedSegmentData() + len > MAX_SEGMENT_OVERDATA)) { // WLEDMM 50% overdraft allowed temporarily
static unsigned lastMsgTime = 0;
@@ -241,6 +244,8 @@ bool Segment::allocateData(size_t len, bool allowOverdraft) { // WLEDMM allowOv
return false; //not enough memory
}
}
#endif
// do not use SPI RAM on ESP32 since it is slow
//#if defined(ARDUINO_ARCH_ESP32) && defined(BOARD_HAS_PSRAM) && defined(WLED_USE_PSRAM)
//if (psramFound())