|
@ -65,6 +65,18 @@ static void onWebsocketEvent(AsyncWebSocket *server, AsyncWebSocketClient *clien |
|
|
static String templateProcessor(const String &templ); |
|
|
static String templateProcessor(const String &templ); |
|
|
static void webserverStart(void); |
|
|
static void webserverStart(void); |
|
|
|
|
|
|
|
|
|
|
|
// If PSRAM is available use it allocate memory for JSON-objects
|
|
|
|
|
|
struct SpiRamAllocator { |
|
|
|
|
|
void* allocate(size_t size) { |
|
|
|
|
|
return ps_malloc(size); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
void deallocate(void* pointer) { |
|
|
|
|
|
free(pointer); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
using SpiRamJsonDocument = BasicJsonDocument<SpiRamAllocator>; |
|
|
|
|
|
|
|
|
void Web_Init(void) { |
|
|
void Web_Init(void) { |
|
|
wServer.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { |
|
|
wServer.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { |
|
|
request->send_P(200, "text/html", accesspoint_HTML); |
|
|
request->send_P(200, "text/html", accesspoint_HTML); |
|
@ -278,7 +290,12 @@ String templateProcessor(const String &templ) { |
|
|
// Takes inputs from webgui, parses JSON and saves values in NVS
|
|
|
// Takes inputs from webgui, parses JSON and saves values in NVS
|
|
|
// If operation was successful (NVS-write is verified) true is returned
|
|
|
// If operation was successful (NVS-write is verified) true is returned
|
|
|
bool processJsonRequest(char *_serialJson) { |
|
|
bool processJsonRequest(char *_serialJson) { |
|
|
StaticJsonDocument<1000> doc; |
|
|
|
|
|
|
|
|
#ifdef BOARD_HAS_PSRAM
|
|
|
|
|
|
SpiRamJsonDocument doc(1000); |
|
|
|
|
|
#else
|
|
|
|
|
|
StaticJsonDocument<1000> doc; |
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
DeserializationError error = deserializeJson(doc, _serialJson); |
|
|
DeserializationError error = deserializeJson(doc, _serialJson); |
|
|
JsonObject object = doc.as<JsonObject>(); |
|
|
JsonObject object = doc.as<JsonObject>(); |
|
|
|
|
|
|
|
@ -592,7 +609,12 @@ void explorerHandleFileStorageTask(void *parameter) { |
|
|
// requires a GET parameter path for the directory
|
|
|
// requires a GET parameter path for the directory
|
|
|
void explorerHandleListRequest(AsyncWebServerRequest *request) { |
|
|
void explorerHandleListRequest(AsyncWebServerRequest *request) { |
|
|
//DynamicJsonDocument jsonBuffer(8192);
|
|
|
//DynamicJsonDocument jsonBuffer(8192);
|
|
|
StaticJsonDocument<8192> jsonBuffer; |
|
|
|
|
|
|
|
|
#ifdef BOARD_HAS_PSRAM
|
|
|
|
|
|
SpiRamJsonDocument jsonBuffer(65636); |
|
|
|
|
|
#else
|
|
|
|
|
|
StaticJsonDocument<8192> jsonBuffer; |
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
String serializedJsonString; |
|
|
String serializedJsonString; |
|
|
AsyncWebParameter *param; |
|
|
AsyncWebParameter *param; |
|
|
char filePath[MAX_FILEPATH_LENTGH]; |
|
|
char filePath[MAX_FILEPATH_LENTGH]; |
|
|