experimental: trying to get the main JSON doc into PSRAM

Its not enough to declare "doc" as DynamicJsonPSRAMDocument - PSRAM is not yet initialized when "doc" is created. So we need a trick to get the main doc into PSRAM later, during WLED::setup().

Code is very experimental, may or may not work, and need more testing
-> disabled with "#if 0"
This commit is contained in:
Frank
2023-12-16 22:50:05 +01:00
parent c68890992c
commit d25835ceae
2 changed files with 15 additions and 0 deletions

View File

@@ -191,6 +191,7 @@ struct PSRAM_Allocator {
}
};
using PSRAMDynamicJsonDocument = BasicJsonDocument<PSRAM_Allocator>;
//#define DynamicJsonDocument PSRAMDynamicJsonDocument // WLEDMM experiment
#else
#define PSRAMDynamicJsonDocument DynamicJsonDocument
#endif
@@ -784,7 +785,17 @@ WLED_GLOBAL int8_t spi_sclk _INIT(HW_PIN_CLOCKSPI);
#endif
// global ArduinoJson buffer
#if 0 && defined(WLED_USE_PSRAM_JSON)
// WLEDMM experimental : always use dynamic JSON
#warning experimental - trying to always use dynamic JSON
#ifndef WLED_DEFINE_GLOBAL_VARS
WLED_GLOBAL PSRAMDynamicJsonDocument doc;
#else
WLED_GLOBAL PSRAMDynamicJsonDocument doc(JSON_BUFFER_SIZE);
#endif
#else
WLED_GLOBAL StaticJsonDocument<JSON_BUFFER_SIZE> doc;
#endif // WLEDMM end
WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0);
// enable additional debug output