Implement JSON buffer in PSRAM to free up DRAM.

This commit is contained in:
Blaz Kristan
2023-12-21 21:30:17 +01:00
parent 4e105492ca
commit 1f81fb9284
19 changed files with 106 additions and 75 deletions

View File

@@ -115,21 +115,21 @@ void handleSerial()
bool verboseResponse = false;
if (!requestJSONBufferLock(16)) return;
Serial.setTimeout(100);
DeserializationError error = deserializeJson(doc, Serial);
DeserializationError error = deserializeJson(*pDoc, Serial);
if (error) {
releaseJSONBufferLock();
return;
}
verboseResponse = deserializeState(doc.as<JsonObject>());
verboseResponse = deserializeState(pDoc->as<JsonObject>());
//only send response if TX pin is unused for other purposes
if (verboseResponse && (!pinManager.isPinAllocated(hardwareTX) || pinManager.getPinOwner(hardwareTX) == PinOwner::DebugOut)) {
doc.clear();
JsonObject state = doc.createNestedObject("state");
pDoc->clear();
JsonObject state = pDoc->createNestedObject("state");
serializeState(state);
JsonObject info = doc.createNestedObject("info");
JsonObject info = pDoc->createNestedObject("info");
serializeInfo(info);
serializeJson(doc, Serial);
serializeJson(*pDoc, Serial);
Serial.println();
}
releaseJSONBufferLock();