Fix to be non blocking without tasks
This commit is contained in:
@@ -150,5 +150,4 @@ void setup() {
|
||||
|
||||
void loop() {
|
||||
victron.loop();
|
||||
delay(100);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,17 @@ void setup() {
|
||||
Serial.println("\nStarting BLE scan...\n");
|
||||
}
|
||||
|
||||
static uint32_t loopCount = 0;
|
||||
static uint32_t lastReport = 0;
|
||||
|
||||
void loop() {
|
||||
victron.loop();
|
||||
delay(100);
|
||||
victron.loop(); // Non-blocking: returns immediately if scan is running
|
||||
loopCount++;
|
||||
|
||||
uint32_t now = millis();
|
||||
if (now - lastReport >= 10000) {
|
||||
Serial.printf("Loop iterations in last 10s: %lu\n", loopCount);
|
||||
loopCount = 0;
|
||||
lastReport = now;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ void setup() {
|
||||
}
|
||||
|
||||
void loop() {
|
||||
victron.loop();
|
||||
victron.loop(); // Blocks for scanDuration seconds
|
||||
|
||||
unsigned long now = millis();
|
||||
if (now - lastSendTime >= SEND_INTERVAL_MS) {
|
||||
@@ -171,5 +171,4 @@ void loop() {
|
||||
blePacketCount, sendCount, sendFailCount, cachedCount);
|
||||
}
|
||||
|
||||
delay(100);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user