From 31655b0a4fc49873aaec88559552f067fbcacb82 Mon Sep 17 00:00:00 2001 From: Phat Nguyen Date: Thu, 20 Jun 2024 10:12:19 +0700 Subject: [PATCH] [Fix] PCB 4.3: Boot loop if not connected to Dashboard, #186 --- src/MqttClient.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/MqttClient.cpp b/src/MqttClient.cpp index 9dc0f02..66c71e6 100644 --- a/src/MqttClient.cpp +++ b/src/MqttClient.cpp @@ -249,6 +249,10 @@ int MqttClient::getConnectionFailedCount(void) { return connectionFailedCount; } #ifdef ESP8266 bool MqttClient::connect(String id) { + if (isBegin == false) { + return false; + } + if (this->uri.isEmpty()) { return false; } @@ -264,6 +268,9 @@ bool MqttClient::connect(String id) { return CLIENT()->connect(id.c_str(), user.c_str(), password.c_str()); } void MqttClient::handle(void) { + if (isBegin == false) { + return; + } CLIENT()->loop(); } #endif