From 1f45a7711be5fff061deb37afa268c52eb98ef4d Mon Sep 17 00:00:00 2001 From: Florian Date: Fri, 15 Nov 2024 10:37:20 -0600 Subject: [PATCH] [SYS] Avoid queue overloading at start (#2114) Give one cycle of the loop without starting BT Co-authored-by: Florian <1technophile@users.noreply.github.com> --- main/main.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/main.ino b/main/main.ino index b226c20..07b70ee 100644 --- a/main/main.ino +++ b/main/main.ino @@ -69,7 +69,7 @@ bool firstStart = true; #define ARDUINOJSON_ENABLE_STD_STRING 1 #include -int queueLength = 0; +int queueLength = -1; // We want to give one cycle of the loop before starting modules that are big msgs producers (example BT), to avoid queue overloading unsigned long queueLengthSum = 0; unsigned long blockedMessages = 0; unsigned long receivedMessages = 0; @@ -522,7 +522,7 @@ void emptyQueue() { if (queueLength > maxQueueLength) { maxQueueLength = queueLength; } - if (queueLength == 0) { + if (queueLength <= 0) { return; } Log.trace(F("Dequeue JSON" CR));