Skip to content

Commit

Permalink
[SYS] Avoid queue overloading at start (#2114)
Browse files Browse the repository at this point in the history
Give one cycle of the loop without starting BT

Co-authored-by: Florian <[email protected]>
  • Loading branch information
1technophile and 1technophile authored Nov 15, 2024
1 parent 8bad846 commit 1f45a77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main/main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ bool firstStart = true;
#define ARDUINOJSON_ENABLE_STD_STRING 1

#include <queue>
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;
Expand Down Expand Up @@ -522,7 +522,7 @@ void emptyQueue() {
if (queueLength > maxQueueLength) {
maxQueueLength = queueLength;
}
if (queueLength == 0) {
if (queueLength <= 0) {
return;
}
Log.trace(F("Dequeue JSON" CR));
Expand Down

0 comments on commit 1f45a77

Please sign in to comment.