[SYS] Improve max buffer (#1981)

* [SYS] Reduce the usage scope of json maximum buffer usage

* Reduce procBLETask stack size
This commit is contained in:
Florian authored and GitHub committed 2024-06-23 15:28:52 -05:00
1 parent 2d5b8b403e
commit b1b4bddcbc
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -902,7 +902,7 @@ void setupBTTasksAndBLE() {
procBLETask, /* Function to implement the task */
"procBLETask", /* Name of the task */
# ifdef USE_BLUFI
13500,
12000,
# else
8500, /* Stack size in bytes */
# endif
+3 -3
View File
@@ -80,7 +80,7 @@ bool ready_to_sleep = false;
#include <PubSubClient.h>
struct JsonBundle {
StaticJsonDocument<JSON_MSG_BUFFER_MAX> doc;
StaticJsonDocument<JSON_MSG_BUFFER> doc;
};
std::queue<JsonBundle> jsonQueue;
@@ -416,7 +416,7 @@ void pubMainCore(JsonObject& data) {
}
// Add a document to the queue
void enqueueJsonObject(const StaticJsonDocument<JSON_MSG_BUFFER_MAX>& jsonDoc) {
void enqueueJsonObject(const StaticJsonDocument<JSON_MSG_BUFFER>& jsonDoc) {
if (jsonDoc.size() == 0) {
Log.error(F("Empty JSON, skipping" CR));
return;
@@ -435,7 +435,7 @@ void enqueueJsonObject(const StaticJsonDocument<JSON_MSG_BUFFER_MAX>& jsonDoc) {
#ifdef ESP32
// Semaphore check before enqueueing a document
bool handleJsonEnqueue(const StaticJsonDocument<JSON_MSG_BUFFER_MAX>& jsonDoc, int timeout) {
bool handleJsonEnqueue(const StaticJsonDocument<JSON_MSG_BUFFER>& jsonDoc, int timeout) {
if (xSemaphoreTake(xQueueMutex, pdMS_TO_TICKS(timeout))) {
enqueueJsonObject(jsonDoc);
xSemaphoreGive(xQueueMutex);