From 9af02b96ecd1319f129e88fbe4e241fac4f38cab Mon Sep 17 00:00:00 2001 From: Patrick Lapointe Date: Thu, 25 Nov 2021 07:46:14 -0500 Subject: [PATCH] Fix: prevent resetting WiFi if we dont handle it (#96) --- src/EspMQTTClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EspMQTTClient.cpp b/src/EspMQTTClient.cpp index 7bd5a82..723d47e 100644 --- a/src/EspMQTTClient.cpp +++ b/src/EspMQTTClient.cpp @@ -317,7 +317,7 @@ bool EspMQTTClient::handleMQTT() Serial.printf("MQTT!: Failed MQTT connection count: %i \n", _failedMQTTConnectionAttemptCount); // When there is too many failed attempt, sometimes it help to reset the WiFi connection or to restart the board. - if(_failedMQTTConnectionAttemptCount == 8) + if(_handleWiFi && _failedMQTTConnectionAttemptCount == 8) { if (_enableSerialLogs) Serial.println("MQTT!: Can't connect to broker after too many attempt, resetting WiFi ...");