[SYS] Improve max buffer (#1981)
* [SYS] Reduce the usage scope of json maximum buffer usage * Reduce procBLETask stack size
This commit is contained in:
1 parent
2d5b8b403e
commit
b1b4bddcbc
2 files changed
+4
-4
No files matched your search
+1
-1
@@ -902,7 +902,7 @@ void setupBTTasksAndBLE() {
|
|||||||
procBLETask, /* Function to implement the task */
|
procBLETask, /* Function to implement the task */
|
||||||
"procBLETask", /* Name of the task */
|
"procBLETask", /* Name of the task */
|
||||||
# ifdef USE_BLUFI
|
# ifdef USE_BLUFI
|
||||||
13500,
|
12000,
|
||||||
# else
|
# else
|
||||||
8500, /* Stack size in bytes */
|
8500, /* Stack size in bytes */
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
+3
-3
@@ -80,7 +80,7 @@ bool ready_to_sleep = false;
|
|||||||
#include <PubSubClient.h>
|
#include <PubSubClient.h>
|
||||||
|
|
||||||
struct JsonBundle {
|
struct JsonBundle {
|
||||||
StaticJsonDocument<JSON_MSG_BUFFER_MAX> doc;
|
StaticJsonDocument<JSON_MSG_BUFFER> doc;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::queue<JsonBundle> jsonQueue;
|
std::queue<JsonBundle> jsonQueue;
|
||||||
@@ -416,7 +416,7 @@ void pubMainCore(JsonObject& data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a document to the queue
|
// 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) {
|
if (jsonDoc.size() == 0) {
|
||||||
Log.error(F("Empty JSON, skipping" CR));
|
Log.error(F("Empty JSON, skipping" CR));
|
||||||
return;
|
return;
|
||||||
@@ -435,7 +435,7 @@ void enqueueJsonObject(const StaticJsonDocument<JSON_MSG_BUFFER_MAX>& jsonDoc) {
|
|||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
// Semaphore check before enqueueing a document
|
// 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))) {
|
if (xSemaphoreTake(xQueueMutex, pdMS_TO_TICKS(timeout))) {
|
||||||
enqueueJsonObject(jsonDoc);
|
enqueueJsonObject(jsonDoc);
|
||||||
xSemaphoreGive(xQueueMutex);
|
xSemaphoreGive(xQueueMutex);
|
||||||
|
|||||||
Reference in new issue
Block a user