AR: trying to improve coexistence with HUB75

Hub75 is very memory hungry. So we try to make a bit more RAM available
* use 16bit samples when compiling with HUB75 support --> 3KB saved
* avoid using aPLL (HUB75 needs it)
* move audio buffers from BSS (always allocated) to heap (only allocated when FFTtask runs) --> 10Kb saved
* suspend live preview for 6 seconds when out-of-memory
This commit is contained in:
Frank
2024-10-13 23:06:50 +02:00
parent d21b9b0687
commit 0dd036cdce
3 changed files with 74 additions and 19 deletions

View File

@@ -186,6 +186,12 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static"
AsyncWebSocketClient * wsc = ws.client(wsClient);
if (!wsc || wsc->queueLength() > 0) return false; //only send if queue free
#ifdef ARDUINO_ARCH_ESP32
static unsigned long ws_delay = 0;
if ((ws_delay > 0) && (millis() - ws_delay < 6000)) return false; // out of memory -> suspend for 6 seconds
else ws_delay = 0;
#endif
#ifdef ESP8266
constexpr size_t MAX_LIVE_LEDS_WS = 256U;
#else
@@ -223,6 +229,10 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static"
last_err_time = millis();
}
errorFlag = ERR_LOW_WS_MEM;
#ifdef ARDUINO_ARCH_ESP32
ws_delay = millis(); // suspend for next 6 seconds
USER_PRINTLN("out of memory - live preview suspended for 6 seconds.");
#endif
return false; //out of memory
}
uint8_t* buffer = reinterpret_cast<uint8_t*>(wsBuf.data());