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:
@@ -606,6 +606,10 @@ pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), Pin
|
|||||||
if(dmxEnablePin > 0) pinManager.allocatePin(dmxEnablePin, true, PinOwner::DMX);
|
if(dmxEnablePin > 0) pinManager.allocatePin(dmxEnablePin, true, PinOwner::DMX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0 && defined(WLED_USE_PSRAM_JSON)
|
||||||
|
doc.garbageCollect(); // WLEDMM experimental - this seems to move the complete doc[] into PSRAM
|
||||||
|
#endif
|
||||||
|
|
||||||
// WLEDMM experimental: support for single neoPixel on Adafruit boards
|
// WLEDMM experimental: support for single neoPixel on Adafruit boards
|
||||||
#if 0
|
#if 0
|
||||||
//#ifdef PIN_NEOPIXEL
|
//#ifdef PIN_NEOPIXEL
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ struct PSRAM_Allocator {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
using PSRAMDynamicJsonDocument = BasicJsonDocument<PSRAM_Allocator>;
|
using PSRAMDynamicJsonDocument = BasicJsonDocument<PSRAM_Allocator>;
|
||||||
|
//#define DynamicJsonDocument PSRAMDynamicJsonDocument // WLEDMM experiment
|
||||||
#else
|
#else
|
||||||
#define PSRAMDynamicJsonDocument DynamicJsonDocument
|
#define PSRAMDynamicJsonDocument DynamicJsonDocument
|
||||||
#endif
|
#endif
|
||||||
@@ -784,7 +785,17 @@ WLED_GLOBAL int8_t spi_sclk _INIT(HW_PIN_CLOCKSPI);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// global ArduinoJson buffer
|
// 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;
|
WLED_GLOBAL StaticJsonDocument<JSON_BUFFER_SIZE> doc;
|
||||||
|
#endif // WLEDMM end
|
||||||
WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0);
|
WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0);
|
||||||
|
|
||||||
// enable additional debug output
|
// enable additional debug output
|
||||||
|
|||||||
Reference in New Issue
Block a user